181a2ed5379f5bf9d0420c0caaea56034eb22732
- Author
- Matt Cable <wozz@wookie.net>
- Committer
- Matt Cable <wozz@wookie.net>
- Date
Message
Escape some metachars that trip up .zdirstore script
Diff
1diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh
2index 973107c52184de7e8d1a9e00acf9452e155309ef..d694c55e244e15d2c7864f821298ac6220df797b 100644
3--- a/lib/dirspersist.zsh
4+++ b/lib/dirspersist.zsh
5@@ -5,8 +5,7 @@
6 # Run dirpersiststore in ~/.zlogout
7
8 dirpersiststore () {
9-# FIXME: need to escape all shell metacharacters, not just spaces!
10- dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore
11+ dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore
12 }
13
14 dirpersistrestore () {