... | ... |
@@ -5,8 +5,7 @@ |
5 | 5 |
# Run dirpersiststore in ~/.zlogout |
6 | 6 |
|
7 | 7 |
dirpersiststore () { |
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 |
|
8 |
+ dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore |
|
10 | 9 |
} |
11 | 10 |
|
12 | 11 |
dirpersistrestore () { |