- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: creating a menu
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 08:18 PM
10-01-2002 08:18 PM
here is an example:
i.e.)
echo " 1. who am I"
echo " who is login"
echo " enter your choice \c:"
read VAR
case $VAR in
1) whoami
;;
2) finger|pg
;;
* ) echo " you have not entered a valid option"
esac
echo "end of program
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:25 PM
10-01-2002 09:25 PM
Re: creating a menu
simply create a while-loop that is always true:
while true
do
echo " 1. who am I"
echo " who is login"
echo " enter your choice \c:"
read VAR
case $VAR in
1) whoami
;;
2) finger|pg
;;
3) exit
;;
* ) echo " you have not entered a valid option"
esac
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:29 PM
10-01-2002 09:29 PM
Re: creating a menu
simply create a while-loop which is always true:
while true
do
echo " 1. who am I"
echo " who is login"
echo " enter your choice \c:"
read VAR
case $VAR in
1) whoami
;;
2) finger|pg
;;
3) exit
;;
* ) echo " you have not entered a valid option"
esac
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:30 PM
10-01-2002 09:30 PM
Re: creating a menu
simply create a while-loop which is always true:
while true
do
echo " 1. who am I"
echo " who is login"
echo " enter your choice \c:"
read VAR
case $VAR in
1) whoami
;;
2) finger|pg
;;
3) exit
;;
* ) echo " you have not entered a valid option"
esac
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:31 PM
10-01-2002 09:31 PM
Re: creating a menu
you can put a until-do-done construction around it like:
VAR=0
until (( VAR = 3 ))
do
case
add an option 3 exit ;;
done
Good luck
Donald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:33 PM
10-01-2002 09:33 PM
Re: creating a menu
simply create a while-loop which is always true:
while true
do
echo " 1. who am I"
echo " who is login"
echo " enter your choice \c:"
read VAR
case $VAR in
1) whoami
;;
2) finger|pg
;;
3) exit
;;
* ) echo " you have not entered a valid option"
esac
done
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 09:37 PM
10-01-2002 09:37 PM
Re: creating a menu
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 10:17 PM
10-01-2002 10:17 PM
Re: creating a menu
you already have the solution in the above replies.
to add on to them, a piece of code that i frquently use:
=============================
ANSW="X"
until [ $ANSW = "Y" -o $ANSW = "N" -o $ANSW = "y" -o $ANSW = "n" ] 2> /dev/null
do
echo "Do you want to continue?\c "
read ANSW
ANSW=${ANSW:-n}
done
=============================
Hope this helps too!
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2002 11:51 PM
10-01-2002 11:51 PM
Re: creating a menu
Thanks guys for the quick support.
Yojeeraj,
My man Yojeeraj, do I add it right under each option!
appreciate your advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2002 03:42 AM
10-02-2002 03:42 AM
Re: creating a menu
Instead of checking input from a 'read' for uppercase and lowercase strings, declare the receiving variable of the read like this:
# typeset -l VAR
Now uppercase letters are converted to lowercase ones and you only need test for the lowercase variant.
Conversely, if you wsnt to convert all lowercase characters to uppercase characters, use:
# typeset -u VAR
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2005 05:00 AM
02-24-2005 05:00 AM