![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ctrl-M at end of each line | navi | Shell Programming and Scripting | 3 | 06-04-2008 03:09 AM |
| how to enable Ctrl + C in ksh | dradhzn | Shell Programming and Scripting | 0 | 05-01-2006 10:32 PM |
| Disable ctrl-c,ctrl-d,ctrl-d in ksh script | wtofu | AIX | 6 | 06-29-2005 04:41 PM |
| my ctrl+c doesn't work | yankee428 | UNIX for Dummies Questions & Answers | 3 | 06-02-2005 01:35 PM |
| Script ctrl+c | newtounix | UNIX for Dummies Questions & Answers | 1 | 03-19-2001 05:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Catching ctrl-C or ctrl-D
Hi there,
I'm using HP-UX 11 machine. I am running a script, thats gonna take a long time to execute. When I press ctrl-c to come out of my script, I have to catch that signal(ctrl-c) and display that ctrl-c had been pressed. How can I do it. Thanks in advance |
|
||||
|
I use this trap in one of my install scripts. So if someone hits control -c when my install script is running, it prints that the install was aborted.
USER=$(logname) LOG=/tmp/sample_install.log #Set Trap trap 'print "Install was aborted in the middle of the install by $USER" | tee -a $LOG; exit 1' 1 2 15 Trap based on the signals. I think there is a total of 31 or so. The above line traps for signal 1, 2, and 15. 1 = HUP 2 = INT 15 = TERM *The output of this command may differ slightly with operating systems. PS..Buy the book, "Unix Shells by example" Ellie Quigley -X |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|