Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
|
11-07-2003, 02:33 PM
|
#1
|
Member
Registered: Nov 2003
Location: Sioux Center, IA
Distribution: RH9, Fedora Core I,II,III
Posts: 37
Rep:
|
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.
|
|
|
11-07-2003, 02:39 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Welcome to LQ.
Just write a bash script with a read option to take user input.
|
|
|
07-15-2009, 01:55 AM
|
#3
|
LQ Newbie
Registered: Jul 2009
Location: The Netherlands
Distribution: Ubuntu server 9.04
Posts: 1
Rep:
|
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
|
|
|
07-15-2009, 01:57 AM
|
#4
|
Senior Member
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168
|
Quote:
Distribution: RH9, Fedora Core I,II,III
|
Yikes!
|
|
|
07-15-2009, 09:10 AM
|
#5
|
Member
Registered: Mar 2004
Distribution: Slackware
Posts: 425
Rep:
|
Curses?
|
|
|
07-15-2009, 10:22 AM
|
#6
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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.
|
|
|
07-15-2009, 10:37 AM
|
#7
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
|
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.
|
|
|
07-15-2009, 03:12 PM
|
#8
|
Member
Registered: Aug 2006
Posts: 609
Rep:
|
you probably want to uses ncurses
|
|
|
07-01-2010, 11:32 AM
|
#10
|
LQ Newbie
Registered: Jul 2010
Posts: 3
Rep:
|
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
Last edited by pixellany; 07-02-2010 at 08:50 AM.
|
|
|
07-01-2010, 11:58 AM
|
#11
|
Moderator
Registered: May 2001
Posts: 29,415
|
Quote:
Originally Posted by Fjdude
You could try:
|
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.
|
|
|
07-01-2010, 12:36 PM
|
#12
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
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
|
|
|
07-02-2010, 08:50 AM
|
#13
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Fjdude;
Please do not post links that do not directly provide useful information or that could simply be seen as advertising.
|
|
|
07-26-2010, 01:53 PM
|
#14
|
LQ Newbie
Registered: Jul 2010
Posts: 3
Rep:
|
hi,
Quote:
Originally Posted by pixellany
Fjdude;
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!
Greetz
|
|
|
All times are GMT -5. The time now is 10:28 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|