hi to all.
im a newbie in unix shell scripts. i want to make a simple unix shell script using the bash shell that asks a user to press any key after a series of commands, or an x if he wishes to exit. here's a sample script that i made:
#!/usr/bin/bash
pause(){
/usr/bin/echo "\t\t Press any key to continue... or [x] to Exit... \c"
read -s -n 1 any_key
if [ "$any_key" = "x|X" ]
then
exit
else
continue
fi
/usr/bin/echo
}
while :
do
clear
/usr/bin/echo "\t\t Sample Press Any Key Routine \n"
/usr/bin/echo "\n\t\t Please enter your name : \c"
read name
/usr/bin/echo "\n\n\t\t Your name is $name. \n"
/usr/bin/echo "\n"
pause
done
my problem is it does not exit when i press the letter x
it still continues the routine.
any help would be greatly appreciated.
thanks.