How can we create a text Based Menu for complex Linux Operations
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
That link only provides terse information. No D/L link for the SW is given. No licensing information is given. The contact link is a form asking for name and email. This is not the default way to promote or provide OSS.
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.
Last edited by catkin; 07-01-2010 at 12:37 PM.
Reason: General Typodynamics
Please do not post links that do not directly provide useful information or that could simply be seen as advertising.
Well, i am not selling, so.... advertising? I made the dialogs myself and the internet site is not done yet. If you had filled out the form i would have send you the tar-file (cgi-scripts) with install instructions. Free to test!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.