How can we create a text Based Menu for complex Linux Operations
I work as a student for the local internet service provider. We are setting up a new linux server. We would like to have a text based menu system that we can activate when logged in though ssh that will allow us to perform complex actions with only a few numbered or lettred key strokes. For example, we may have 7 steps to set up a new customer, and we want to be able to just type "n" and it will run through all those steps, prompting us at the right times for inputs. Or, we want to see if a user exits, rather than have to type in the search options, we need a menu option that we select, and all it asks for is the name, and then reports if they exists. What we would would like is a premade menu if possible that we can customize.
|
Welcome to LQ.
Just write a bash script with a read option to take user input. |
text menu
Nice but.... is there no example of such a menu?
I am setting up a mailserver with Ubuntu. I dont get out of the screen menu what i want. Id like to build a menu to start and stop services and add users etc. in a simple way. Help would be appriciated much Eelco |
Quote:
|
Curses?
|
Hmmm---an unusually high number of unhelpful replies........
Use something like kdialog or zenity to get the user input---Better yet, set it up so you can just click on the option you want. **Oops--you said "text based"----for this just use the "read" command. (It has an option for the prompt text) Then use a series of if statements (or maybe a "case" construct) to perform the specific operations Regardless, you will need to think through what variants will be allowed in the user input. For example, if it's expecting "n", will it accept: "N", "new", "NEW", "nx"----etc.? AND, include a "fall-through" so that something rational happens if the user types in something unexpected. |
What about the 'dialog' command in bash? It would create a menu where you navigate via arrow keys. It is text based, isn't it. You could run it without X.
|
you probably want to uses ncurses
|
Exapnding in jhwilliams post #4, you do realise all those distro versions are long dead and unsupported?
This includes no more security updates ... You should (try) to get a more current distro eg Centos 5.3 or Fedora 11. Here's a basic menu example http://techspalace.blogspot.com/2008...u-example.html See also http://www.tldp.org/LDP/abs/html/testbranch.html |
make easy menu
You could try:
<<mod edit: Link deleted--See below>> You only have to install apache and some cgi's/binaries and you've got a webbased menu. Adding menu's is making directories in "menu" path. Commands are files in the menu directory. Example for "show files in a users home directory" : ------------------------------------------- info%This command shows files in a users home directory list%Select user%USR%cat /etc/passwd|cut -d: -f1 command%ls -la $(grep $USR /etc/passwd|cut -d: -f6) ------------------------------------------- info is just text on screen. list makes a dropdown "Select user" is text before drop down "USR" is the environment parm used for dropdown "cat /etc/p...." is command to populate dropdown command is the final command. besides "list" you can use "check" for checkbox, "radio" for radiobutton and "text" free text input. grtz Freddy |
Quote:
|
How about starting by writing the back-end scripts? That way you would get the benefit of them before worrying about the menu and all for the price of typing the script name at the command prompt. It's a stage you will go through during development anyway. For the menus, the bash select command is simple, extensible and may be "good enough", certainly for phase I before going for a "pretty" menu with ncurses or whatever.
|
Fjdude;
Please do not post links that do not directly provide useful information or that could simply be seen as advertising. |
hi,
Quote:
Greetz |
k41184,
I used this as a starter for making my own menu options: http://bash.cyberciti.biz/decision-m...-shell-script/ |
All times are GMT -5. The time now is 11:20 PM. |