more changes to better handle undef vars

This is only needed if we make undefined vars an error as proposed in
issue #4163 but it's a good idea anyway.
This commit is contained in:
Kurtis Rader
2017-07-03 10:16:31 -07:00
parent 4f345fdee7
commit 763063e741
4 changed files with 13 additions and 6 deletions

View File

@@ -18,10 +18,13 @@ function pushd --description 'Push directory to stack'
end
end
set -q dirstack
or set -g dirstack
# emulate bash: an empty pushd should switch the top of dirs
if test (count $argv) -eq 0
if not set -q argv[1]
# check that the stack isn't empty
if test (count $dirstack) -eq 0
if not set -q dirstack[1]
echo "pushd: no other directory"
return 1
end