Hacker News new | ask | show | jobs
by diegocg 2352 days ago
Many of these crazy corner cases are the reason why I switched to fish. Eg, in fish all variables are arrays, so arguments are passed in the $argv array, and number of elements in the array is "count $argv" (in bash the number of arguments is passed in $#, but the hieroglyphic required to count the number of elements in an array is ${#var[@]} )

$PATH is just an array where each path is an element, so removing or adding a path equals to adding/removing an element from the array which is trivial.

Iterating over files names with spaces works exactly as expected and no IFS tweaking is needed (fun thing, in bash, doing for i in * .foobar; do echo $i; done; in a directory with no files with that extension will return the string "*.foobar"). No "[" craziness, nicer syntax, etc.

Unfortunately fish still lacks other important features (eg. no set -e equivalent).

There is an space for sane Unix shells but everybody has settled on bash and changing the status quo is difficult.

1 comments

But why use Fish for scripting? Why not just use Python3 and be done?