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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user prompt with control C in shell scripts

Status
Not open for further replies.

buffagm

IS-IT--Management
Apr 15, 2003
4
US
Hello,

I started work in an enviornment running AIX, when running shell scripts, hitting control-C kills the script. Is there any way I can write a simple program that prompts the user when control-C is hit to ensure a second level of confirmation? Thanks in advance for any help.
 
man trap

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
no man entry for trap. if that what you meant
 
Here is a way I would try.

################################################
Clean_up() #clean up on exit
################################################
{

Echo “Are you sure you wish to quit this program? [y\n] \c”
read Q

if [ $Q = y ] ;then
exit
else
break
fi

}
trap Clean_up INT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top