I have two scripts. script1 spawns script2 and then sends a
kill -SIGINT $!
trap 'echo you hit ctrl-c, waking up...' SIGINT
I guess what you are trying to achieve is that when
script2 receives the SIGINT it continues and prints the message. Then, you need
#!/bin/bash echo "~~ENTRY" trap 'echo you hit ctrl-c, waking up...; CONT=true' SIGINT CONT=false while ! $CONT do sleep 1 done echo "~~EXIT"