- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to remove trap ( unset )
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
03-18-2010 02:56 PM
- Tags:
- trap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010 03:08 PM
03-18-2010 03:08 PM
Re: how to remove trap ( unset )
If you mean a shell 'trap' then:
...
trap 'echo sorry' INT
...
trap '' INT
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010 03:15 PM
03-18-2010 03:15 PM
Re: how to remove trap ( unset )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010 03:27 PM
03-18-2010 03:27 PM
Re: how to remove trap ( unset )
> my requriment is to remove all trap..... there should not be any trap...
Again, I assume that this whole discussion relates to the shell. Thus if you had set a 'trap' for (example) SIGHUP, SIGINT, SIGQUIT and SIGTERM you could reset (restore) their default action by doing:
# trap '' HUP INT QUIT TERM
You can see what's set in your script, you can do:
# trap
...which will simply print the handler associated with each set trap.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010 03:48 PM
03-18-2010 03:48 PM
SolutionI'm sorry, I think I understand what you mean by "unset".
To restore a trap (signal) to it's original (DEFAULT) value do:
# trap - INT
If, however, you do:
# trap '' INT
...this is equivalent to an IGNORE action.
This script snippet will help you see the various actions:
#!/usr/bin/sh
trap 'echo sorry' INT QUIT HUP KILL
trap
echo "I'm safe"
read REPLY
trap - INT
trap - QUIT
echo "I'm no longer immune"
read REPLY
trap
exit
...run the above and attempt a CTL_C to break the script after the first and then after the second read().
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010 04:24 PM
03-18-2010 04:24 PM