- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- menu scrpit question (loop)
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
01-24-2001 12:15 PM
01-24-2001 12:15 PM
And it works great. But I have a main menu,
and a sub menu as shown in the attachment.
But from the submenu I execute a choice and tail the log and break out of the log it takes me to the main menu. But I would like it to take me back to submenu1 not the main menu.
And then from the submenu1 I can break out to the main menu. Is there a way to do that or do i always have to go back to the main menu?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 12:21 PM
01-24-2001 12:21 PM
Re: menu scrpit question (loop)
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 12:30 PM
01-24-2001 12:30 PM
Re: menu scrpit question (loop)
If you change your 'if [ "${X}" -eq "1" ]; then' statement to a 'while [ "${X}" -eq "1" ]; do' statement (and change the matching 'fi' to a 'done', that should do the trick. I have one like yours, with sub-menus, and if you'd like I'll post it for you.
Hope this helps,
Mo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 12:36 PM
01-24-2001 12:36 PM
Re: menu scrpit question (loop)
I cant break back the the main menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 12:40 PM
01-24-2001 12:40 PM
Re: menu scrpit question (loop)
One way to structure menu scripts like this is to form an outer 'while true do' loop which uses a case statement to call functions within you shell script. Each function can have its own 'while true do' loop to select, read, case, etc. Use 'return' to exit the function back to the outer loop, etc.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 12:45 PM
01-24-2001 12:45 PM
SolutionIf you add a line like:
echo " 0) Return to main menu \n"
when the user presses 0, change the assignment of variable 'X' to 0, then it won't be equal to 1 anymore.
By the way, I have posted my script, you can take what you want from it. It's real long, and kinda involved, but look for the 'REALSTART' part, and that'll get you started.
Peace!
Mo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 01:01 PM
01-24-2001 01:01 PM
Re: menu scrpit question (loop)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 01:02 PM
01-24-2001 01:02 PM
Re: menu scrpit question (loop)
But I dont understand where you want me to change X. With this one I get to the sub menu, but that is where i get stuck. I cant break out of the sub menu back to the main menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 02:06 PM
01-24-2001 02:06 PM
Re: menu scrpit question (loop)
I'm working on it. I'll attach a revised copy when I figure it out.
Mo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 02:15 PM
01-24-2001 02:15 PM
Re: menu scrpit question (loop)
X=99
while [ ! $X -eq 0 ]
---
and if you look at option 3 it reads the 99.
---
I know 3 menus deep is too much.. But im just wondering if I did. can I put
X=99
X=98
X=97
---
to control what menu the sub or sub/sub will go? I may try that just for fun later on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 02:16 PM
01-24-2001 02:16 PM
Re: menu scrpit question (loop)
Forgot to mention that.. thanks for all your help.
Richard ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 02:20 PM
01-24-2001 02:20 PM
Re: menu scrpit question (loop)
#Add Another choice to your list
echo "PRESS '3' to exit"
#Add the choice
#choice 3
if [ "${Y}" -eq "3" ];then
clear
X=2
fi
This will make X != 1 thus exiting the look for the submenu and returning you to the main menu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2001 02:22 PM
01-24-2001 02:22 PM
Re: menu scrpit question (loop)
Yeah after taking a break and looking at it .. it hit me like a ton of bricks !