You are not logged in.
I am trying to trap ctrl-c and it doesn't work if a child process is running from the script (rsync for example). The process does exit but the parent script does not catch the signal, I suspect this has something to do with the child process running at the time. What I would like to do is perform some clean up / logging tasks if the user decides to abort the script via control-c.
Does anyone have any idea how handle this?
Offline
Of course I manage to resolve this shortly after posting. A slightly different approach but it works.
- Added "set -e" to script.
- check exit code via "if [ $? -ne 0 ]; then"
Offline