how to trap the ctrl c in unix shell script
my script is running in while loop it should not be terminate with ctrl c.
if i press ctrl c while running script it shloud ignore the same.
please healp..........
thanks in advance
how to trap the ctrl c in unix shell script
my script is running in while loop it should not be terminate with ctrl c.
if i press ctrl c while running script it shloud ignore the same.
please healp..........
thanks in advance
There is plenty on the web already:
Trapping Exits Caused by Interrupts | O'Reilly Media
So trap signal 2 and 3.
trap sig_handler 15
or trap sig_handler SIGTERM