Regarding trap command
I have written service start stop shell script and it is running fine but only problem is while running if I hit CTRL-C after it comes out and if I run again it will not go through as previous run had created a temp file and it did not get removed.
So I need to call a function below like this it seems but it is throwing me an error some ting is missing. settrap() { trap 'print \'You hit control-C!\'' INT rm -rf /tmp/dummy.startup } start () { settrap () ... ... ... } Please anybody can let me know how to trap the ctrl-c and once that ctrl-c hit while I am running it shold directly remove /tmp/dummy.startup file. Thanks! sharp |
See Example 29-6 here http://www.tldp.org/LDP/abs/html/debugging.html#EX76
|
All times are GMT -5. The time now is 11:35 PM. |