👤
Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Creating a menu

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 02-06-2008
Creating a menu

Hi,
I need your help co create a very small menu somthing that look like this:

1. first step
2. second step
3. last step
from step : ___
to step : ___

If the user choose 1 --> it will echo : Hellow
If the user choose 2 --> it will echo : World
If the user choose 3 --> it will echo : Bye
If the the user choose from 1 to 2 --> it will echo : Hello
World
And so on.

Thank you very much for your help.
# 2  
Old 02-06-2008
Code:
echo 1. first step
echo 2. second step
echo 3. last step
echo 4. from step:_ to step:

FIRST=hello
SECOND=WORLD
LAST=Bye

read CHOICE
case $CHOICE in
 1) echo $FIRST ;;
 2) echo $SECOND ;;
 3) echo $LAST ;;
 4) read -p step1: ONE; read -p step2: TWO

      case $ONE$TWO in
       11) echo $FIRST ;;
       12) echo $FIRST $SECOND ;;
       13) echo $FIRST $SECOND $LAST ;;
       22) echo $SECOND ;;
       23) echo $SECOND $LAST ;;
       33) echo $LAST ;;
      esac

esac

# 3  
Old 02-06-2008
The program 'dialog' does a good job of this type of work it seems:

Dialog: An Introductory Tutorial
# 4  
Old 02-07-2008
Creating Menu

Hi ,
I runed the code above. if i choose just one option its work fine.
But if i choose to run it between two option its retun nathing.
For example:

/software >./tafrit.sh
1. first step
2. second step
3. last step
4. from step:_ to step:
2
WORLD

/software >./tafrit.sh
1. first step
2. second step
3. last step
4. from step:_ to step:
12
/software >

Thanks.
# 5  
Old 02-08-2008
hm you are right, doesn't work, somethings wrong with the semicolons

this one should work:

Code:
echo 1. first step
echo 2. second step
echo 3. last step
echo 4. from step:_ to step:

FIRST=hello
SECOND=WORLD
LAST=Bye


FROMTO()
 {
      case $ONE$TWO in
       11) echo $FIRST ;;
       12) echo $FIRST $SECOND ;;
       13) echo $FIRST $SECOND $LAST ;;
       22) echo $SECOND ;;
       23) echo $SECOND $LAST ;;
       33) echo $LAST ;;
      esac
 }

read CHOICE
case $CHOICE in
 1) echo $FIRST ;;
 2) echo $SECOND ;;
 3) echo $LAST ;;
 4) read -p step1: ONE; read -p step2: TWO; FROMTO;;



esac

👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Creating bash script to process a data file based on the menu ultimaxtrd Shell Programming and Scripting 3 12-01-2017 12:22 PM
Need help creating a menu. rajeshwebspere Shell Programming and Scripting 1 10-26-2013 03:48 PM
Need help in create menu with 3 sub menu using the case command chercm Shell Programming and Scripting 0 11-17-2012 08:27 AM
Menu with sub-menu options sukhdip Shell Programming and Scripting 3 05-30-2012 10:32 AM
Menu in Menu script issue iDdraig Shell Programming and Scripting 1 11-27-2010 06:35 PM
Creating a menu from find markrj Shell Programming and Scripting 3 01-22-2008 11:50 AM
Creating a menu within a script file sinjin Shell Programming and Scripting 8 12-10-2007 12:18 AM
Creating menu list from configuration file nir_s Shell Programming and Scripting 8 01-11-2006 02:45 AM
creating a menu for recycling and permanently deleting files. strmy_ngts Shell Programming and Scripting 2 11-28-2005 08:33 PM


All times are GMT -4. The time now is 01:32 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password