Se usa para especificar las acciones a realizar cuando se reciban las señales.
Mostrar un mensaje cuando se envían las señales SIGINT SIGTERM
1 2 3 4 5 6 7 |
#!/bin/bash trap "echo No me mataras!" SIGINT SIGTERM echo "pid is $" while true do sleep 60 done |