I have a shellscript that needs to exit with code 1 when any of its steps fail, in order to prevent the subsequent script from running.
But in the logs, i see the exit code is always 0, and the next shellscript starts anyway.
I tried:
#!/bin/bash
set -e
and
<<command execution>>
if [ $? -ne 0 ]; then { echo "Failed" ; exit 1; } fi
But the logs always state that the exit code is 0
Why can’t i make the script exit with code 1 ? Could there be some shell code setting that is preventing the shell script from exiting with non-zero code ?