How to do whilespace-insensitive string compare in fish

From razwiki
Jump to navigation Jump to search

The problem:

test "a b " = "a b"

exits with 1; this comes up with `fish_postexec`:

if test "$argv" = "$EDITOR ~/.profile"
test vim ~/.profile  = vim ~/.profile

which itself happens because tab completion adds a space at the end.


test (echo "$argv" | string trim) = "$EDITOR ~/.profile"

See also

How to automatically source ~/.profile after editing it in fish shell