Results 1 to 2 of 2
i created a piece of linux code but i'm having problems exiting it. Any advice about rectifying this is welcomed. options 1,2,3 work well. as well as the wildcard values, ...
- 02-18-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 1
help needed to exit my code.
i created a piece of linux code but i'm having problems exiting it. Any advice about rectifying this is welcomed. options 1,2,3 work well. as well as the wildcard values, however i can't get my exit option to work.
#! /bin/sh
echo "System Manager Version 1.0"
echo "==========================================="
echo "1. Show current user information"
echo "2. Show most recent users"
echo "3. Show current user"
echo " "
echo "Select an option from the menu above [1-3] or press Q to quit:"
read input
while [ $input != "1" ] || [ $input != "2" ] || [ $input != "3" ] || [ $input != "Q" ]
do
case "$input" in
1)`clear`
./sysproginfo ;
echo " "
echo " "
./sysmgr ;
;;
2)`clear`
./mrusers ;
echo " "
echo " "
./sysmgr ;
;;
3)`clear`
./whoison ;
echo " "
echo " "
./sysmgr ;
;;
*)`clear`
echo "Wrong value entered"
echo " "
echo " "
./sysmgr;
;;
Q)`clear`
echo "Terminating program....GoodBye."
exit;
;;
esac
done
- 02-19-2008 #2
A case statement will match the first option it can. In your case, the first option that a 'Q' matches is the * operator, and therefore, you never actually reach the 'Q' case.
The '*' case should always be the last case, to avoid this very thing.DISTRO=Arch
Registered Linux User #388732


Reply With Quote
