Sponsored Content
Top Forums Shell Programming and Scripting Creating menu list from configuration file Post 95298 by nir_s on Tuesday 10th of January 2006 04:46:33 AM
Old 01-10-2006
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
}

The content of conf file layers.conf is:
Code:
root# cat layers.conf
Database Layer
RiGHTv Adminstration Layer
RTE Subscribers Layer
Quit

If I run it:
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
#?

As you can see ,The problem is the spaces between the words which cause the menu to display each word in different line.
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
#?

Thanks in advance,
Nir
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a menu for recycling and permanently deleting files.

Trying to alias rm to move files to a hidden trash directory in the bash shell. I've tried to create this alias numberous ways and it's just not working. Here's what I've tried, anyone have any suggestions. alias rm='mv $* ~/.trash' alias rm= 'mv$* ~/.trash' things like that... I've also... (2 Replies)
Discussion started by: strmy_ngts
2 Replies

2. Shell Programming and Scripting

Creating User Accounts from a list in file

I have a file that contains a list of names. I need a loop that creates user accounts to all the names in the list where username = names in file password = username Another question: how can i validate that a particular var is of 6 characters length I need an if statement that will... (8 Replies)
Discussion started by: Laila Saif
8 Replies

3. UNIX for Dummies Questions & Answers

creating a file with a list

I would like to create a text file that contains the list (names of files and dirs) of a particular directory... any ideas ? (5 Replies)
Discussion started by: hinman
5 Replies

4. Shell Programming and Scripting

Creating a menu within a script file

I am very new to Unix and know the basic commands. I have to write a script file and I'm completely lost. The script file is to show the following at the beginning: Menu of Options 1. Display all files in a user's home directory. 2. Welcome yourself to the program. 3. Display System... (8 Replies)
Discussion started by: sinjin
8 Replies

5. Shell Programming and Scripting

Creating a menu from find

Hi I am wanting to create a menu that will list all the log files in a specific directory such as /apps/logs. So it would be something like this: #!/bin/ksh print 'Select The Required Log File' PS3='log? ' select choice in <this is to contain a list of files that are in a directory that... (3 Replies)
Discussion started by: markrj
3 Replies

6. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: yoavbe
4 Replies

7. Shell Programming and Scripting

ls > file - Creating file containing the list of all files present in a directory

Hi All, I need to create a file which contains the list of all the files present in that directory. e.g., ls /export/home/user/*.dat > list_file.dat but what i am getting is: $ ls /export/home/user/*.dat > list_file.dat /export/home/user/*.dat: No such file or directory But I have... (1 Reply)
Discussion started by: pranavagarwal
1 Replies

8. Shell Programming and Scripting

Need help creating a menu.

Hi Master of masters, Thanks for ur reply. Need ur help for following. Is it possible to create menu for following in linux or a function. > Look in logs > Status > Action > End Action > CONFSUCCESS > Success > Show message as successful > Enter to continue > CONFFAIL > Failure > Show... (1 Reply)
Discussion started by: rajeshwebspere
1 Replies

9. Shell Programming and Scripting

Creating bash script to process a data file based on the menu

Hey, im fairly new to unix and Im trying to make this unix project that would display a menu and do the following. MENU =========================== (p, P) Print users info (a, A) Add new user (s, S) Search user (d, D) Delete user (x,X) Exit Enter your choice: Trying to... (3 Replies)
Discussion started by: ultimaxtrd
3 Replies
Net::Write::Layer4(3pm) 				User Contributed Perl Documentation				   Net::Write::Layer4(3pm)

NAME
Net::Write::Layer4 - object for a transport layer (layer 4) descriptor SYNOPSIS
use Net::Write::Layer qw(:constants); use Net::Write::Layer4; my $desc = Net::Write::Layer4->new( dst => '192.168.0.1', protocol => NW_IPPROTO_TCP, family => NW_AF_INET, ); $desc->open; $desc->send('G'x666); $desc->close; DESCRIPTION
This is the class for creating a layer 4 descriptor. ATTRIBUTES
dst The target IPv4 or IPv6 address we will send frames to. family Address family, see Net::Write::Layer CONSTANTS section. protocol Transport layer protocol to use, see Net::Write::Layer CONSTANTS section. METHODS
new Object constructor. You MUST pass a valid dst attribute. Default values: protocol: NW_IPPROTO_TCP family: NW_AF_INET open Open the interface. send (scalar) Send raw data to the network. close Close the descriptor. CAVEATS
Does not work at all under Win32 systems. They can't send frames at layer 4. SEE ALSO
Net::Write::Layer AUTHOR
Patrice <GomoR> Auffret COPYRIGHT AND LICENSE
Copyright (c) 2006-2009, Patrice <GomoR> Auffret You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive. perl v5.10.1 2009-06-10 Net::Write::Layer4(3pm)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy