Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable 'ctrl c' sequence in a script

Status
Not open for further replies.

redsydus

Programmer
Nov 21, 2003
23
0
0
FR
HI all,

How can I disable 'ctrl c' sequence when a script is runing ?

Thks in advance for your replies !!

bye
 

The ^C command sends an Interrupt signal (2) to the running process.

Use the trap command to ignore this signal:

trap "" 2

Loosely, this command means: when you receive a signal 2, do nothing ("")

Use 'man trap' to find out more about this command
 
In csh you can do this replacing the ls command with your script -

#!/bin/csh -f

onintr int
echo "trapping interrupt for ls -l"
ls -l



int:
echo "ls -l interrupted"
exit 1


Steve

 
If you 're on SCO, you can:
Code:
stty intr '^-' # single quote, caret, minus, single quote


Theophilos.

-----------

There are only 10 kinds of people: Those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top