Question: How do I read from kb using shell script but I need to read it from same line? Script :- Code: echo "Please Enter Your Choice "
But it goes to next line I need it to read it next to Choice and not new line. Solution: Code: printf "Please Enter Your Choice "
or Code: echo -n "Please Enter Your Choice "
Question: csh exit while loop on keystroke #!/bin/csh I'm using a `while(1)` loop to dispaly real-time information about various files on my system, and I use ^C to exit it when needed. I was hoping there was a way to exit the script on a normal keystroke such as "q". Solution: Use a signal and have your script listen for the signal. The syntax depends on the shell you are using. If you are using ksh, see man ksh. trap "command to run when signal trapped" "list of signals" trap "" signals # Will trap the signals you define but not allow them to affect your script. You can get a list of signals by typing kill -l on the command line. Note: You cannot trap signal 9. Your "command to run" can be a function if you so choose. Code: User Commands trap(1) NAME
SYNOPSIS
csh
ksh
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|