zshrc: Do not use bogus array index `0' in dirstack code [Closes: issue1055]
authorFrank Terbeck <ft@grml.org>
Tue, 27 Sep 2011 10:19:05 +0000 (12:19 +0200)
committerFrank Terbeck <ft@grml.org>
Tue, 27 Sep 2011 10:22:45 +0000 (12:22 +0200)
Instead, use `1' which is the correct way to address the first item of
an array in zsh (with the default settings and the ones we are using).

Reported-by: Daniel Hahler <grml@thequod.de>
Signed-off-by: Frank Terbeck <ft@grml.org>
etc/zsh/zshrc

index 5d908f0..f5088f6 100644 (file)
@@ -1077,7 +1077,7 @@ DIRSTACKFILE=${DIRSTACKFILE:-${HOME}/.zdirs}
 if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
     dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
     # "cd -" won't work after login by just setting $OLDPWD, so
-    [[ -d $dirstack[0] ]] && cd $dirstack[0] && cd $OLDPWD
+    [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
 fi
 
 chpwd() {