The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Use of TRAP Command Deepakh Shell Programming and Scripting 2 12-12-2006 01:24 AM
trap command mobile01 UNIX for Dummies Questions & Answers 1 11-30-2006 08:54 AM
trap command onlyc UNIX for Dummies Questions & Answers 3 07-11-2006 12:15 AM
Trap command problem superprogrammer Shell Programming and Scripting 3 06-06-2005 06:50 AM
Using TRAP command dbrundrett Shell Programming and Scripting 3 07-15-2004 06:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-09-2006
Registered User
 

Join Date: Nov 2006
Posts: 24
trap command in Unix

Could anybody tell me what the trap command does and how it performs the action it does. I had read the trap manual page but it is too concise that nothing is clear about it. Please tell how it works.
Reply With Quote
Forum Sponsor
  #2  
Old 12-09-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
It catches a signal sent to the process. It takes action on the signal using the action defined in the trap command - instead of letting the signal take it's default effect on the process. Blocking a SIGINT signal from terminating the process, for example.

Code:
trap "echo 'interrupt singal recevied'" INT
This turns cntl-c into a harmless message on the console. It stops cntl-c (SIGINT normally) from making the process exit.

Some signals cannot be trapped (blocked is the right term)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0