Hi I have written a script which works well .. It's divided into a series of jobs one running after another
But on pressing the enter key the whole script goes haywire .. I want a way to trap this enter command and echo it as invalid input ..
Any suggestions highly appreciated...
Thanks
"read answer" is they keyword. (waits for input)
--
Actual button/command I use:
read answer && host -t ns $answer | while read dom ns server; do dig +short $dom | echo $server "shows an IP of" `dig +short $dom` for $dom ; done | sort
hth.
ultimatix:
Hi I have written a script which works well .. It's divided into a series of jobs one running after another
But on pressing the enter key the whole script goes haywire .. I want a way to trap this enter command and echo it as invalid input ..
How do you get any input if the user doesn't press enter?
Do you mean: you have problems if the user presses enter without any other input? If so, just check that the user has entered something:
read x
case $x in
"") echo "You must enter something"; exit 1 ;;
esac