469,945 Members | 1,830 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

quit command

77
i have the following script.. but i cant get the quit command working...

can some1 help

quit = n

host="$(hostname)"
todaysdate="$(date)"
lastboot="$(last reboot)"
licensinginfo="$(uname -a)"

currenthardwareinfo="$(info)"
diskspace="$(df)"

IPAddress="$(/sbin/ifconfig)"

while [ "$quit" = "n" ]
do
clear

echo "1. General machine information"
echo "2. Machine hardware/software information"
echo "3. Network related information"
echo "4. User related information"
echo "Q. Quit"

echo "Please make your selection"

read menunumber
if [ $menunumber -eq 1 ]
then
echo " The hostname is $host"
echo " The date is $todaysdate"
echo " The system last rebooted is $lastboot"
echo " Licensing info:$licensinginfo"

echo " Press Enter Key to continue"
read ;


else if [ $menunumber -eq 2 ]
then
echo " Current Hardware: $currenthardwareinfo"
echo " Disk space: $diskspace"

echo " Press Enter Key to continue"
read ;


else if [ $menunumber -eq 3 ]
then
echo "IP Address: $IPAddress"

echo " Press Enter Key to continue"
read ;

else if Q|q) quit=y;
*) echo "Invalid Choice"



fi

fi

fi

sleep 1
done
Mar 28 '07 #1
5 3031
Motoma
3,237 Expert 2GB
Rather than having a variable, and checking that again and again, just check for the quit command, and exit.
Mar 29 '07 #2
Mubs
77
Rather than having a variable, and checking that again and again, just check for the quit command, and exit.
and how can i do that...
Mar 29 '07 #3
Motoma
3,237 Expert 2GB
inside the while loop:
Expand|Select|Wrap|Line Numbers
  1. else if Q|q) exit;
  2.  
Mar 29 '07 #4
Mubs
77
inside the while loop:
Expand|Select|Wrap|Line Numbers
  1. else if Q|q) exit;
  2.  
i have tried that it stil doesnt work
Apr 5 '07 #5
Motoma
3,237 Expert 2GB
i have tried that it stil doesnt work
What happens?
Are you sure that section of code is actually being called? Put some echo statements in choice sections of code to make sure the flow is going the way you think it should be going.
Apr 5 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jane Austine | last post: by
1 post views Thread by G.Gerard | last post: by
2 posts views Thread by Lauren Quantrell | last post: by
6 posts views Thread by Max | last post: by
5 posts views Thread by mzdude | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.