summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Cable <wozz@wookie.net>2010-04-22 11:26:08 -0600
committerMatt Cable <wozz@wookie.net>2010-09-19 19:33:42 -0600
commit181a2ed5379f5bf9d0420c0caaea56034eb22732 (patch)
tree172627e6d4e17018a781b6447bdd2f3a04f61099
parent21e2a913bff765b8dc23f12309059f7446e0ff99 (diff)
downloadzsh-181a2ed5379f5bf9d0420c0caaea56034eb22732.tar.gz
zsh-181a2ed5379f5bf9d0420c0caaea56034eb22732.tar.bz2
zsh-181a2ed5379f5bf9d0420c0caaea56034eb22732.zip
Escape some metachars that trip up .zdirstore script
-rw-r--r--lib/dirspersist.zsh3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh
index 973107c52..d694c55e2 100644
--- a/lib/dirspersist.zsh
+++ b/lib/dirspersist.zsh
@@ -5,8 +5,7 @@
# Run dirpersiststore in ~/.zlogout
dirpersiststore () {
-# FIXME: need to escape all shell metacharacters, not just spaces!
- dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
+ dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore
}
dirpersistrestore () {