useful for small scripts and debugging, but the proper way to ensure that a command only executes if the previous command succeeds is to use the && you seem to not like.
using your methodology, my script would simply die if any exit code were non-zero, but one should not rely on this. so, say I'm setting a variable to the output of a command. this would result in a return code of zero if the assignment succeeded, not just if the command's exit code were zero.
i recommend you investigate further into some bash best practices. set -e is good for debugging, but once a script is working as expected, you'll want to remove set -e in most cases and catch failures within the script to take appropriate action, not just always bail out.
Comment
useful for small scripts and debugging, but the proper way to ensure that a command only executes if the previous command succeeds is to use the && you seem to not like.
using your methodology, my script would simply die if any exit code were non-zero, but one should not rely on this. so, say I'm setting a variable to the output of a command. this would result in a return code of zero if the assignment succeeded, not just if the command's exit code were zero.
i recommend you investigate further into some bash best practices. set -e is good for debugging, but once a script is working as expected, you'll want to remove set -e in most cases and catch failures within the script to take appropriate action, not just always bail out.