LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 11-07-2003, 02:33 PM   #1
k41184
Member
 
Registered: Nov 2003
Location: Sioux Center, IA
Distribution: RH9, Fedora Core I,II,III
Posts: 37

Rep: Reputation: 15
Question 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.
 
Old 11-07-2003, 02:39 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Welcome to LQ.

Just write a bash script with a read option to take user input.
 
Old 07-15-2009, 01:55 AM   #3
eekie
LQ Newbie
 
Registered: Jul 2009
Location: The Netherlands
Distribution: Ubuntu server 9.04
Posts: 1

Rep: Reputation: 0
Smile 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
 
Old 07-15-2009, 01:57 AM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
Quote:
Distribution: RH9, Fedora Core I,II,III
Yikes!
 
Old 07-15-2009, 09:10 AM   #5
voyciz
Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 425

Rep: Reputation: 40
Curses?
 
Old 07-15-2009, 10:22 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 07-15-2009, 10:37 AM   #7
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
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.
 
Old 07-15-2009, 03:12 PM   #8
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
you probably want to uses ncurses
 
Old 07-15-2009, 07:27 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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
 
Old 07-01-2010, 11:32 AM   #10
Fjdude
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
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.
 
Old 07-01-2010, 11:58 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Fjdude View Post
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.
 
Old 07-01-2010, 12:36 PM   #12
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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
 
Old 07-02-2010, 08:50 AM   #13
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Fjdude;

Please do not post links that do not directly provide useful information or that could simply be seen as advertising.
 
Old 07-26-2010, 01:53 PM   #14
Fjdude
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
hi,

Quote:
Originally Posted by pixellany View Post
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
 
Old 07-26-2010, 06:55 PM   #15
elfoozo
Member
 
Registered: Feb 2004
Location: Washington, USA
Distribution: Debian
Posts: 265

Rep: Reputation: 32
k41184,

I used this as a starter for making my own menu options:

http://bash.cyberciti.biz/decision-m...-shell-script/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Text-Based Linux williamjonah Linux - Software 7 08-29-2005 02:03 PM
why use text based Linux dcc Slackware 13 04-26-2005 11:23 AM
Any Text-Based Word Processors for Linux? linguae Linux - Software 10 07-06-2004 05:21 PM
how to browse from a text based linux daaku_n01 Linux - Newbie 2 05-20-2004 06:39 AM
RH Linux 8 pico ; text based login Pillay Linux - Newbie 2 11-02-2003 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration