- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Capturing CTRL + C
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 04:00 PM
11-03-2003 04:00 PM
I would like to catch the signal ctrl + C(SIGINIT). Please could you let me know the corresponding value for this.
Also, I would be following the approach that needs to be implemented should be as follows: trap "numeric value". Is this the correct approach
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 05:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 05:41 PM
11-03-2003 05:41 PM
Re: Capturing CTRL + C
If you are talking about a shell script it would be
trap "command" 2
The command will be executed when signal 2 is received. If you leave it blank (you still need the quotes) then the script will ignore SIGINT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 05:49 PM
11-03-2003 05:49 PM
Re: Capturing CTRL + C
Then it would perform your script without braking at control-C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 10:00 PM
11-04-2003 10:00 PM
Re: Capturing CTRL + C
trap is correct for korn/bourne/posix shell, but in csh you use onintr.
#!/usr/bin/csh
onintr CTRLC
LOOP:
echo 'Continue Until
read DUMMY
goto LOOP
CTRLC:
echo "You pressed Ctrl+C"
exit
--------------------------------------
#!/usr/bin/sh
trap CTRLC 2
function CTRLC
{
print "You pressed Ctrl+C"
exit
}
while true
do
print 'Continue Until
read DUMMY
done
/Tor-Arne