Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Traping Ctrl-Z in KSH Shell script
Name: vs Date: July 1, 2003 at 04:10:00 Pacific OS: SunOs 5.6 CPU/Ram: 2GB
Comment:
Hi,
I am writing a shell script to accept input from user and upload the data files using sqlloader. I want to trap Ctrl-Z which is SIGTSTP so that user do not come out of the shell script using Ctrl-Z key. I could successfully capture Ctrl-C key with following command trap 'echo "Invalid Keys Pressed" ' INT but Ctrl-Z key can not be trapped. Can any one give me the way around to stop user coming out of the shell script by Ctrl-Z?
Name: nails Date: July 1, 2003 at 07:26:28 Pacific
Reply:
Hi:
Some Unix variants (Sun and SCO), suspend a job, by default, using control-z. I don't know of a way of trapping the control-z, but you can disable job control.
Execute stty -a
and among other things you should see:
susp=^z
In the login process (.profile or /etc/profile), install this:
stty susp ""
and that should release control-z. Obviously, if you have a user that requires job control, you can't do this or pick something other than control-z.
Summary: Hello Can anybody explain how I can ftp the reult of a sql script in a shell script that is executed via a cronjob??I would like the result to be sent to a a folder on a different server or to a per...
Summary: Hi, I need to run a command and hit 4 times in response to the prompts after the command is run. I don't know how to do this in a shell script. Could someone please help me? Thank you very much. ...
Summary: Hi all, I'm writing a shell script to execute PGP, then FTP to several FTP site at the same time. Please let me know how to put in the script so that it'll automatic say y and don't promp me for it. ...