how to disable and enable <control>-c or -z in a shell script


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to disable and enable <control>-c or -z in a shell script
# 1  
how to disable and enable <control>-c or -z in a shell script

Dear all,
good day.

i'm asking about how to disable <control>-c or <control>-z in the beginning of a shell script then enable it again before the script exit

Best Regards

---------- Post updated at 04:41 AM ---------- Previous update was at 04:18 AM ----------

Dear All
i found the answer


trap '' 2
echo "This is a test. Hit [Ctrl+C] to test it..."
sleep 20
trap 2


thank you
# 2  
Or you can use

PHP Code:
trap '' INT

trap 
'' HUP 
For more Details
trap
# 3  
can you please tell me the difference ????
# 4  
This is basically a symbolic name of the actual signal (that's an integar value). If you follow the link above in reply from amitranjansahu, you can see it gives you all the details.

The benefit of using a symbolic name is that it's more descriptive coding.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #590
Difficulty: Easy
In a linear search algorithm, the input size is the number of elements in the collection (n) divided by 2.
True or False?

10 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

OID to disable/enable printing

Hi @ all, we are a non-profit educational organisation. Now my company wants to disable printers, when a room is not used. I do a lot monitoring, using snmp. So I had the idea of disabling and enabling the printers by using snmp. After searching for hours, I only found some status-objects (ro)... (1 Reply)
Discussion started by: karls0
1 Replies

2. HP-UX

FTP service Enable/Disable

hi everybody, I can easily enable /disable the FTP service from SAM, how can I do this via command line? using inetd? how? cheers, messi (1 Reply)
Discussion started by: messi777
1 Replies

3. UNIX for Dummies Questions & Answers

Enable and disable the auto mount

How to enable and disable the auto mount option for USB devices.? (3 Replies)
Discussion started by: ungalnanban
3 Replies

4. UNIX for Dummies Questions & Answers

crontab: disable/enable

since i don't have root access, i have been doing: crontab -l > /tmp/username.crontab crontab -r vi /tmp/username.crontab and copy page crontab -e, and paste sometimes, /tmp/username.crontab has more than 1 page, so i have to copy twice. how do i copy all contents from... (2 Replies)
Discussion started by: tjmannonline
2 Replies

5. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

6. Solaris

SSH enable, Telnet disable ...

Hi... How do I enable SSH and disable telnet.. Also - is there anything special I need to do to ensure that a new user can use ssh and su but not telnet? Adel (15 Replies)
Discussion started by: ArabOracle.com
15 Replies

7. Cybersecurity

How to disable RIP and enable EGP

Hello, We recently had a Nessus scan done of our system and the solution to one of the findings was this: disable the RIP agent and use an EGP routing protocol I have been unable to find any specific instruction on how to do either. We are running Solaris 8. Any help would be greatly... (3 Replies)
Discussion started by: stringman
3 Replies

8. Shell Programming and Scripting

Enable & disable cronjob

Hi All, I am new to cronjob and need some guidance on this. 1) How do i enable a cronjob ? Can it be done by "crontab mycronfile" or "crontab -e mycronfile" 2) How can i disable the cronjob? Can deleting of the "mycronfile" disable the cron or do i need to perform "crontab -r mycronfile"... (7 Replies)
Discussion started by: Raynon
7 Replies

9. UNIX for Advanced & Expert Users

Disable and Enable Backspace or Ctrl^H in vi

Could anybody tell me how I can disable or enable the backspace key in vi editor. I would like to feel the essence of the commands of vi editor but as I have the latest version and it is supporting the backspace key. I do it on promp using the command stty erase - This command stops the... (5 Replies)
Discussion started by: mobile01
5 Replies

10. Linux

Enable and disable ttyS0

I have a modem connect it to ttyS0 , in unix sco i know i can disable and enable the port , how can i do this , is there a command that will allow me to do this. **** I'm running Redhat 9 *****External Usrobotics 56k Thanks a lot guys (1 Reply)
Discussion started by: josramon
1 Replies

Featured Tech Videos