1827802 Members
2341 Online
109969 Solutions
New Discussion

ask for "trap" example

 
neocosmic
Occasional Contributor

ask for "trap" example

Could you show me some trap examples?

the trap command is used within the script to ignore signal or not?
2 REPLIES 2
LucianoCarvalho
Respected Contributor

Re: ask for "trap" example

hi,

Thats right, the trap comand is used to ignore some signals.

One example could be:

# Ignore HUP, INT, QUIT now.

trap "" 1 2 3

This part of a /etc/.profile file.

Regards.
John Meissner
Esteemed Contributor

Re: ask for "trap" example

in a script file sometime you may not want the user to interupt your actions at a certain point....

trap '' int
or you can use
trap '' 2
or
stty '' \377

to restore the ctrl+c feature
stty intr '^C'


All paths lead to destiny