Bash script menu with sub menu
Hi All,
I am hoping someone is able to help me out with a script, the first component of the menu works fine with selections and goes to the sub menu, but the sub menu does not does not accept input correctly or exit when enter is pressed like on the main menu here is the script: Code:
#!/bin/sh thanks |
The input checks should be part of the function and not part of the main body.
The first thing called in your script is the show_menu function. If you select 5 (Sub Menu 1) you exit the show_menu function and the first while loop is entered (which checks opt). From there you enter the sub_menu1 function. Once you leave the sub_menu1 you are back inside the first while loop and opt is checked (and not sub1). And now you are stuck in the first loop. Have a look at this: Code:
#!/bin/sh Code:
3) clear; |
Hi Druuna,
thankyou for your explanation and solution it is greatly appreciated thanks |
You're welcome :)
BTW: Can you put up the [SOLVED] tag if you think this is solved. - above the first post -> Please Mark this thread as solved if you feel a solution has been provided. - -or- - - first post -> Thread Tools -> Mark this thread as solved |
Follow up
hi, thanks for posting a nice menu/submenu example script. I know I am asking a simple question, but how would one pass first menu input value to second menu. I d like to see a trace of all menu options used before performing an action at the last level nested menu? opt is just a menu option not the value.
|
Remember previously picked menu options?
Store them in variables! If you have one variable per option then you can see all combinations. |
kremenko, If you have a specific question it would be better if you started a new thread instead of asking in an old solved thread.
|
All times are GMT -5. The time now is 03:23 PM. |