If I'm set -ein a Bash script, the script will terminate on future errors. I am confused about how this works with functions. Consider the following, which will only output the onestandard:
set -e
fun(){
echo one
non_existing_command
echo two
}
fun
It is clear that this non_existing_commandis a mistake, and therefore the script exits before the second echo. You can usually use an operator or ||execute another command if and only if the first command fails. That is, I would suspect the following to print as oneand three, but not two:
set -e
fun(){
echo one
non_existing_command
echo two
}
fun || echo three
one two. || ( ), .
?