diff --git a/share/functions/fish_add_path.fish b/share/functions/fish_add_path.fish index cac0d9d4f..cc6ff15f6 100644 --- a/share/functions/fish_add_path.fish +++ b/share/functions/fish_add_path.fish @@ -63,7 +63,7 @@ function fish_add_path --description "Add paths to the PATH" set -l newvar $$var if set -q _flag_move; and set -q indexes[1] # We remove in one step, so the indexes don't move. - set -e newvar[$indexes] + set -e newvar["$indexes"] end set $mode newvar $newpaths diff --git a/tests/checks/fish_add_path.fish b/tests/checks/fish_add_path.fish index 661cf2556..b509236fb 100644 --- a/tests/checks/fish_add_path.fish +++ b/tests/checks/fish_add_path.fish @@ -54,4 +54,8 @@ fish_add_path -nP $tmpdir/etc | string replace -- $tmpdir '' test "$oldpath" = "$PATH" or echo "PATH CHANGED!!!" >&2 +# See that moving multiple arguments removes the correct ones - #7776 +PATH=$tmpdir/{bin,etc,link,sbin} fish_add_path -nPpm $tmpdir/{link,sbin} | string replace -a $tmpdir '' +# CHECK: set PATH /link /sbin /bin /etc + exit 0