Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed pesky \r from getting into work array

  • Loading branch information...
commit 95604f35111952e5e3c8b3b0a6bfd306305f6b85 1 parent 5c375c5
graysky authored September 16, 2012

Showing 1 changed file with 17 additions and 5 deletions. Show diff stats Hide diff stats

  1. 22  profile-cleaner
22  profile-cleaner
@@ -46,31 +46,43 @@ do_chrome() {
46 46
 }
47 47
 
48 48
 do_xulbased() {
  49
+	# prepath should be defined in the do_whatever function
  50
+	if [[ -h "$prepath" ]]; then
  51
+		path=$(readlink $prepath)
  52
+	else
  53
+		path="$prepath"
  54
+	fi
  55
+
  56
+	if [[ ! -d "$path" ]]; then
  57
+		echo "Error: cannot locate $path"
  58
+		exit 0
  59
+	fi
  60
+
49 61
 	if [[ ! -f $path/profiles.ini ]]; then
50 62
 		echo "Error: cannot locate $path/profiles.ini to determine names of profiles."
51 63
 		exit 0
52 64
 	fi
53 65
 
54 66
 	# read each profile into the work array
55  
-	work=( $(grep Path $path/profiles.ini | sed 's/Path=//') )
  67
+	work=( $(grep Path $path/profiles.ini | sed -e 's/Path=//' -e 's/\r//') )
56 68
 
57 69
 	for i in "${work[@]}"; do
58  
-		find ${path} -maxdepth 2 -name '*.sqlite' -print0 | xargs -0 -n 1 -I {} bash -c "do_clean {} 2>/dev/null"
  70
+		find ${path}/$i -maxdepth 2 -name '*.sqlite' -print0 | xargs -0 -n 1 -I {} bash -c "do_clean {} 2>/dev/null"
59 71
 	done
60 72
 }
61 73
 
62 74
 do_firefox() {
63  
-	path=$HOME/.mozilla/firefox
  75
+	prepath=$HOME/.mozilla/firefox
64 76
 	do_xulbased
65 77
 }
66 78
 
67 79
 do_conkeror() {
68  
-	path=$HOME/.conkeror.mozdev.org/conkeror
  80
+	prepath=$HOME/.conkeror.mozdev.org/conkeror
69 81
 	do_xulbased
70 82
 }
71 83
 
72 84
 do_thunderbird() {
73  
-	path=$HOME/.thunderbird
  85
+	prepath=$HOME/.thunderbird
74 86
 	do_xulbased
75 87
 }
76 88
 

0 notes on commit 95604f3

Please sign in to comment.
Something went wrong with that request. Please try again.