I am working on a shell script and want to handle various exit codes that I may have come across. To try, I use this script:
#!/bin/sh
echo "Starting"
trap "echo \"first one\"; echo \"second one\"; " 1
exit 1;
I suppose I'm missing something, but it seems like I can't catch the trap of my "exit 1". If I try to catch a trap, everything will work out:
#!/bin/sh
echo "Starting"
trap "echo \"first one\"; echo \"second one\"; " 0
exit
Is there anything I should know about catching the HUP (1) exit code?
source
share