From faca005fe6682611273fd2769cd7a6d0a5c6706e Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Thu, 22 Apr 2010 11:26:08 -0600 Subject: [PATCH] Escape some metachars that trip up .zdirstore script --- lib/dirspersist.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh index 973107c5..d694c55e 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 () {