Ignore/Disable Ctrl-C (SIGINT) in a shell script
How do I write my trap statement in shell script to ignore SIGINT.
Reason being is that the script is used to update records in database. I want to avoid inconsistency in database when user presses Ctrl-C ... The result should be 1. Totally ignore Ctrl-C (SIGINT) when user presses Ctrl-C 2. Continue with the rest of processing |
|
Hey,
try this: trap "" 2 The number 2 stands for SIGINT (CTRL+C). This should then ignore the interrupt, at least bourne shell (sh) and bash :-) - Andi - |
It does not work..
The database still interrupts the operation when I press Ctrl-C I think it is due to the handling within the database software, not on the shell .... |
All times are GMT -5. The time now is 03:31 PM. |