Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
Showing results for 
Search instead for 
Did you mean: 

ask for "trap" example

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?
Luciano Carvalho
Respected Contributor

Re: ask for "trap" example


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.

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
stty '' \377

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

All paths lead to destiny