![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Creating a menu | yoavbe | Shell Programming and Scripting | 4 | 02-08-2008 08:18 AM |
| Creating a menu from find | markrj | Shell Programming and Scripting | 3 | 01-22-2008 09:50 AM |
| Creating a menu within a script file | sinjin | Shell Programming and Scripting | 8 | 12-09-2007 10:18 PM |
| creating a file with a list | hinman | UNIX for Dummies Questions & Answers | 5 | 02-06-2007 01:25 PM |
| Creating User Accounts from a list in file | Laila Saif | Shell Programming and Scripting | 8 | 12-21-2005 08:23 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Creating menu list from configuration file
Hi folks,
I have the following function ,which generates menu for installation type: Code:
select_install_type()
{
echo
echo ========================================
echo Please select the type of installation:
echo ========================================
echo
pass=fail
until [[ ${pass} = pass ]] ; do
select installType in `cat /tmp/layers.conf`
do
if [[ ${installType} = "Quit" ]] ; then
echo "\n**** !! Exiting by user's request !! ****\n"
exit 2
elif [[ -z "${installType}" ]] ; then
echo "\n**** !! Invalid Option !! ****\n"
continue
elif [[ ${installType} = "Database_Layer" ]] ; then
export installType=DatabaseLayer
pass=pass
break
elif [[ ${installType} = "RiGHTv_Admin_Layer" ]] ; then
export installType=RTEAdminLayer
pass=pass
break
elif [[ ${installType} = "RTEsub_Layer" ]] ; then
export installType=RTESubLayer
pass=pass
break
else
echo "Invalid Install Type"
exit
fi
done
done
}
Code:
root# cat layers.conf Database Layer RiGHTv Adminstration Layer RTE Subscribers Layer Quit Code:
root# ./get_layer.ksh ======================================== Please select the type of installation: ======================================== 1) Database 2) Layer 3) RiGHTv 4) Adminstration 5) Layer 6) RTE 7) Subscribers 8) Layer 9) Quit #? How can I overcome it? The expected result is: Code:
======================================== Please select the type of installation: ======================================== 1) Database Layer 2) RiGHTv Adminstration Layer 3) RTE Subscribers Layer 4) Quit #? Nir |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
one idea i could suggest is have delimiters like "|" instead of spaces in your configuration file so that it look like
Database|Layer Database_Layer though this idea is not efficient this would solve your problem for sure. Last edited by matrixmadhan; 01-10-2006 at 04:07 AM. |
|
#3
|
|||
|
|||
|
Thanks but it does not work
Code:
======================================== Please select the type of installation: ======================================== 1) Database|Layer 2) RiGHTv|Adminstration|Layer 3) RTE|Subscribers|Layer 4) Quit #? 4 Thanks in advance, Nir |
|
#4
|
|||
|
|||
|
I could see a mismatch in your configuration file and the hard-coded values in script,
Quote:
elif [[ ${installType} = "Database_Layer" ]] ; then the underscore between Database and Layer !!! hope this helps. |
|
#5
|
|||
|
|||
|
Yes I saw this mismatch but it is does not influence about how the menu is displayed. It is still displayed incorrectly on the screen.
|
|
#6
|
||||
|
||||
|
hmm, i had always faced this problem with for loop, so i used to use a while loop
cat filename|while read a do .. done but in this scenario, you may have to implement your own type of select, i.e ability to link these lines with line numbers.
__________________
War doesnt determine who is right, it determines who is left |
|
#7
|
||||
|
||||
|
Quote:
while read line; do . . done < filename |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|