Using the following shebang for my bash script:
#!/bin/bash -e
I would like the script to display the exit code whenever it exits upon non-zero status. How can I do this?
Add this to your script:
trap 'echo $?' EXIT