I am working on a shell script, and want to handle various exit codes that I might come across. To try things out, I am using this script:
#!/bin/sh
echo "Starting"
trap "echo "first one"; echo "second one"; " 1
exit 1;
I suppose I am missing something, but it seems I can t trap my own "exit 1". If I try to trap 0 everything works out:
#!/bin/sh
echo "Starting"
trap "echo "first one"; echo "second one"; " 0
exit
Is there anything I should know about trapping HUP (1) exit code?