cat a.sh#! /bin/bash#going forward report subshell or command exit value if errors#set -e(cat b.txt)echo "hi"./a.sh; echo $?cat: b.txt: No such file or directoryhi0
with set -e commented out we see that echo "hi" exit status being reported and hi is printed.
cat a.sh#! /bin/bash#going forward report subshell or command exit value if errorsset -e(cat b.txt)echo "hi"./a.sh; echo $?cat: b.txt: No such file or directory1
Now we see b.txt error being reported instead and no hi printed.
So default behaviour of shell script is to ignore command errors and continue processing and report exit status of last command. If you want to exit on error and report its status we can use -e option.