Browse code

Escape &'s in path name. Need to find general function for escaping all shell metacharacters.

Matt Cable authored on 02/04/2010 at 21:24:41
Showing 1 changed files
... ...
@@ -5,7 +5,8 @@
5 5
 # Run dirpersiststore in ~/.zlogout
6 6
 
7 7
 dirpersiststore () {
8
-    dirs -p | sed 's/ /\\ /g;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
8
+# FIXME: need to escape all shell metacharacters, not just spaces!
9
+    dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
9 10
 }
10 11
 
11 12
 dirpersistrestore () {
... ...
@@ -19,4 +20,4 @@ setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
19 19
 dirpersistrestore
20 20
 
21 21
 # Make popd changes permanent without having to wait for logout
22
-alias popd="popd;dirpersiststore"
23 22
\ No newline at end of file
23
+alias popd="popd;dirpersiststore"