3 ms·
I like the notion of 'set -e' and at the same time I hate it. First, because it behaves inconsistently across shells/versions [1] and second, because it doesn'
by arendtio 6y ago
I like the notion of 'set -e' and at the same time I hate it.
First, because it behaves inconsistently across shells/versions [1] and second, because it doesn't always work as expected. For example, when you depend on the 'set -e' behavior in a function and call the function from within a condition, the 'set -e' has no effect at all. So you better don't count on 'set -e'.
But don't expect me to follow my own advice, as not using 'set -e' isn't a good option either...
[1] https://www.in-ulm.de/~mascheck/various/set-e/ https://www.in-ulm.de/~mascheck/various/set-e/
- chubot 6y agoYup, I am fixing this with Oil: https://news.ycombinator.com/item?id=24740842 https://news.ycombinator.com/item?id=24740842 (2 of 4 problems fixed so far, more problems welcome) Try it out on your shell scripts and let me know what happens :) OSH has the "broken" POSIX/bash behavior to maintain compatibility, while Oil opts you in to the better error semantics.