Reputation: 21
Are there any ways to catch a signal for a program where you don't have access to source code of the program. Is having a signal handler the only way?
Upvotes: 2
Views: 1166
Reputation: 127
trap command traps the signals and other events.
# vim my_script.sh
trap "{ /usr/bin/rm -r "/tmp/*.txt" }" SIGINT SIGTERM ERR EXIT
Upvotes: 3