- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to create a operation 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
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
08-31-2004 06:14 PM
08-31-2004 06:14 PM
Any where I can find a template shell that use on creating menu window for operator using.
Example,
In the Menu window have selection 1,2,3...to select to execute the job, select to view the log....etc. Exit & finish will close section of the terminal.
Thks..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2004 07:41 PM
08-31-2004 07:41 PM
Solution#!/bin/sh
# The menu script
while [ : ]
do
echo Choose One:
echo 1 Add file
echo 2 Remove file
echo 3 Edit file
echo 4 View file
echo 5 Quit
read i
if [ $? -eq 1 ]; then
exit 0
fi
case $i in
1) exit 1;;
2) exit 2;;
3) exit 3;;
4) exit 4;;
5) exit 5;;
*)
echo
echo Invalid choice.
echo Try again.
echo
;;
esac
done
If you want multiple menus, you can duplicate this script for submenus.
Greetings MB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2004 07:55 PM
08-31-2004 07:55 PM
Re: How to create a operation Menu
Use a script shell. If you want to be sure to exit terminal session when you exit menu, tell the script from the .profile of operators accounts with exec command:
.
.
exec Menu_Script
exec command doesn't create a child environnement, but REPLACE current session. When you exit menu you exit session.
Example of menu script:
...
affiche_menu
{
Your Menu (echo commands)
}
REP=1
while [ $REP != 0 ]
do
affiche_menu
read REP
case $REP in
1) Choix1;;
2) Choix2;;
....
0) echo "Bye Bye" ;;
done
exit 0
Rgds
JMB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2004 08:04 PM
08-31-2004 08:04 PM
Re: How to create a operation Menu
Good code is:
affiche_menu
{
Your Menu (echo commands)
}
REP=1
while [ $REP != 0 ]
do
affiche_menu
read REP
case $REP in
1) Choix1;;
2) Choix2;;
....
0) echo "Bye Bye" ;;
esac
done
exit 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2004 11:12 PM
08-31-2004 11:12 PM
Re: How to create a operation Menu
It's also possible to use builtin functions like "select" in posix shell (see man sh-posix). Example :
#!/usr/bin/sh
PS3="Your choice ? "
select A in MONDAY TUESDAY WEDNESDAY exit
do
[ -z "$A" ] && continue
[ "$A" = exit ] && break
echo "My prefered day is $A (choice $REPLY)"
done
Execution :
phelix> /tmp/a
1) MONDAY
2) TUESDAY
3) WEDNESDAY
4) exit
Your choice ? 2
My prefered day is TUESDAY (choice 2)
Your choice ? 0
Your choice ? 4
phelix>
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2004 02:11 AM
09-01-2004 02:11 AM
Re: How to create a operation Menu
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2004 04:37 AM
09-01-2004 04:37 AM