21e2a913bff765b8dc23f12309059f7446e0ff99

Author
Matt Cable <wozz@wookie.net>
Committer
Matt Cable <wozz@wookie.net>
Date

Message

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

Diff

 1diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh
 2index 8364a879cc47e9c41811d52847497136655d047d..973107c52184de7e8d1a9e00acf9452e155309ef 100644
 3--- a/lib/dirspersist.zsh
 4+++ b/lib/dirspersist.zsh
 5@@ -5,7 +5,8 @@
 6 # Run dirpersiststore in ~/.zlogout
 7 
 8 dirpersiststore () {
 9-    dirs -p | sed 's/ /\\ /g;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
10+# FIXME: need to escape all shell metacharacters, not just spaces!
11+    dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
12 }
13 
14 dirpersistrestore () {
15@@ -19,4 +20,4 @@ setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
16 dirpersistrestore
17 
18 # Make popd changes permanent without having to wait for logout
19-alias popd="popd;dirpersiststore"
20+alias popd="popd;dirpersiststore"