I was wondering what would be the best way to check the exit status in an if statement in order to echo a specific output.
I\'m thinking of it being
$? is a parameter like any other. You can save its value to use before ultimately calling exit.
$?
exit
exit_status=$? if [ $exit_status -eq 1 ]; then echo "blah blah blah" fi exit $exit_status