Hacker News new | ask | show | jobs
by joseluisq 1940 days ago
Many of us use it, I personally in my daily basis development Fish shell is pretty neat and increases productivity in terminal. However I still use Bash in the server side where I need for example, explicit error aborting like `set -e` that Fish doesn't have yet. https://github.com/fish-shell/fish-shell/issues/510
2 comments

set -e is not great and is not recommended. http://mywiki.wooledge.org/BashFAQ/105
-e is in the class of things that can be fine to use, but the people least-likely to be prepared to know when it can be are the most likely to expect it to behave better than it does.

Sort of a combination finger-trap/cigar cutter for newbies.

Yeah.. but still useful despite the "false positives" that the link states which are addressable with proper error handling.
`-eu -o pipefail` catches most of what newcomers expect anyway.
I agree with the second to last recommendation:

> rking's personal recommendation is to go ahead and use set -e, but beware of possible gotchas. It has useful semantics, so to exclude it from the toolbox is to give into FUD.

Manual error handling would be ideal but it's too easy for me to mess up and miss something. Plus, if you really wanted to catch everything with proper error handling you would need to wrap every command in your script.

I read this as "bash has unintuitive footguns" rather than "set -e has unintuitive footguns with its usage".
Bash doesn't have unintuitive footguns, bash <<is>> a unintuitive footgun :-)
Agree with the "false positives" however in combination with error handling I don't see why not use it.
if you use a bash shebang in your scripts, does it not matter (honest question, I never have used fish)?