mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 19:31:14 -03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user