Solved

Disable "Ctrl+C"

Posted on 2006-06-19
3
371 Views
Last Modified: 2010-04-21
Dear All,

Can I prevent the user from terminating the program by pressing "Ctrl+C" after running the script developed by me?

Please advise.
I am using Sun Solaris 8 & ksh.

Thanks.
0
Comment
Question by:iecu
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
tfewster earned 125 total points
ID: 16940132
Yes, using the shell built-in comand `trap`, e.g.
trap 'echo "Ctrl-C disabled" ' 0 1 2 3

For more examples, please see
http://www.experts-exchange.com/Developer/Operating_Systems/Solaris/Q_20311700.html
http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_10074403.html


0
 
LVL 48

Expert Comment

by:Tintin
ID: 16956566
or to disable completely, add

stty intr ''

in the user's .profile

0
 
LVL 48

Expert Comment

by:Tintin
ID: 16997233
trap 'echo "Ctrl-C disabled" ' 0 1 2 3

is more accurately written

trap 'echo "SIGINT is trapped, which may or may not be Ctrl-C"' 2
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now