Sponsored Content
Top Forums Shell Programming and Scripting Need Menu option each on a new line Post 302986724 by mohtashims on Tuesday 29th of November 2016 10:36:16 AM
Old 11-29-2016
RedHat Need Menu option each on a new line

Here is my script for the menu options.
Code:
# Bash Menu Script Example

PS3='Please enter your choice: '
options=("Option 1:" "Option 2:" "Other Reason:" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1 :")
            echo "you chose choice 1"
            ;;
        "Option 2:")
            echo "you chose choice 2"
            ;;
        "Other Reason:")
            echo "you chose choice 3"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

When i run the script i see the output as below.

Quote:
1) Option 1: 3) Other Reason:
2) Option 2: 4) Quit
when i need it to look like

Quote:
1) Option 1:
2) Option 2:
3) Other Reason:
4) Quit
Can you let me know what needs to be done.
 

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

How to add Win2000, Win Me option to Lilo menu?

Hi All, I have installed RH Linux 7.1, windows 2000 and windows ME in the same machine. There are two booting menu: Lilo: Linux Dos Dos : Windows2000 WindowsME If I want to use windowME, I need to boot lilo and choose dos and final choose windows ME. Have any... (3 Replies)
Discussion started by: wilsonchan1000
3 Replies

2. Shell Programming and Scripting

a main menu option?

I have created a main menu in the following way: while true; do echo " " echo "Main Menu: " echo "Please Select An Option Using The Options Provided." echo " " echo "1 - Search All Files" echo " " echo "2 - Search Individual Files" echo " " ... (1 Reply)
Discussion started by: amatuer_lee_3
1 Replies

3. Shell Programming and Scripting

Unix Shell Script: With Menu Option

I am attempting to create a shell script with the following capaciblities: 1. Listed options to choice from 2. Use to perform awk statements 3. Print a report with the awk results My questions are 1. How do I select more than one file for option #5 and #6 2. How to I create an... (11 Replies)
Discussion started by: jroberson
11 Replies

4. Shell Programming and Scripting

script to show menu option & need to be autorun

hi i need to perform following task have to write script to display menu like 1) login as user1 2) login as user2 3) login as user3 4) go to shell script will be run through root user user1, user2 will be logged to specific thr account. if 4th option selected it must pass... (3 Replies)
Discussion started by: anup13
3 Replies

5. Shell Programming and Scripting

How do I add the option to change the path in a menu?

How do I add the option to change the path in a menu? I have this script. The user chooses a number and had the option of doing something, looking for log files etc. There is a possibility they might want to look at a different path other than what I have given them such as... (2 Replies)
Discussion started by: taekwondo
2 Replies

6. UNIX for Dummies Questions & Answers

What is a menu or command line option driven script?

i'm confused what this means. i was asked to design a menu or command line option driven script that reads out of a DB and displays info such as read_data.pl -u <user> -e <event> which would print commands run by <user>with the <event> in the db. any suggestions? i've been using... (2 Replies)
Discussion started by: kpddong
2 Replies

7. Ubuntu

Add Option To Right Menu

hey all, I already installed nautilus-actions now , I want to add "print path" script(option) to the right context menu!.. I did : http://img853.imageshack.us/img853/6973/59818245.png http://img847.imageshack.us/img847/8758/37217230.png the script print located in... (2 Replies)
Discussion started by: eawedat
2 Replies

8. Shell Programming and Scripting

sh file: READ (menu) but now run with option

I have a script which uses READ to detect choice of menu option...now I want to change the script without doing whole rewrite such that when user runs ./script.sh 5 it would execute menu option 5 rather than user running ./script.sh waiting for it to load and then pressing "5 enter" Is it... (1 Reply)
Discussion started by: holyearth
1 Replies

9. Programming

Listing Option Menu Choices from Text File

Hello, I am starting up a tool and one of the initial steps is to select a site/location which is being read from a text file. Here is the text file contents: site1 site2 site3 Here is the code: #!/usr/bin/python from Tkinter import * (3 Replies)
Discussion started by: tattoostreet
3 Replies

10. Shell Programming and Scripting

Passing positioning array as whiptail -- menu option

I may have asked this before, so forgive OF. Problem: I can pass positioning array as -- menu option to whiptail, but it does not show in the whiptail form as an array - only single (first member "lsusb" ) entry / line shows up. Code: DynamicEntry=$(whiptail \ --title "DEBUG... (1 Reply)
Discussion started by: annacreek
1 Replies
mod_auth(3erl)						     Erlang Module Definition						    mod_auth(3erl)

NAME
mod_auth - User authentication using text files, dets or mnesia database. DESCRIPTION
This module provides for basic user authentication using textual files, dets databases as well as mnesia databases. EXPORTS
add_user(UserName, Options) -> true| {error, Reason} add_user(UserName, Password, UserData, Port, Dir) -> true | {error, Reason} add_user(UserName, Password, UserData, Address, Port, Dir) -> true | {error, Reason} Types UserName = string() Options = [Option] Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPass- word} Password = string() UserData = term() Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword =string() Reason = term() add_user/2, add_user/5 and add_user/6 adds a user to the user database. If the operation is successful, this function returns true . If an error occurs, {error,Reason} is returned. When add_user/2 is called the Password, UserData Port and Dir options is mandatory. delete_user(UserName,Options) -> true | {error, Reason} delete_user(UserName, Port, Dir) -> true | {error, Reason} delete_user(UserName, Address, Port, Dir) -> true | {error, Reason} Types UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() delete_user/2, delete_user/3 and delete_user/4 deletes a user from the user database. If the operation is succesfull, this function returns true . If an error occurs, {error,Reason} is returned. When delete_user/2 is called the Port and Dir options are mandatory. get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason} get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason} get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason} Types UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() get_user/2, get_user/3 and get_user/4 returns a httpd_user record containing the userdata for a specific user. If the user cannot be found, {error, Reason} is returned. When get_user/2 is called the Port and Dir options are mandatory. list_users(Options) -> {ok, Users} | {error, Reason} list_users(Port, Dir) -> {ok, Users} | {error, Reason} list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Users = list() AuthPassword = string() Reason = atom() list_users/1, list_users/2 and list_users/3 returns a list of users in the user database for a specific Port/Dir . When list_users/1 is called the Port and Dir options are mandatory. add_group_member(GroupName, UserName, Options) -> true | {error, Reason} add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason} add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason} Types GroupName = string() UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() add_group_member/3, add_group_member/4 and add_group_member/5 adds a user to a group. If the group does not exist, it is created and the user is added to the group. Upon successful operation, this function returns true . When add_group_members/3 is called the Port and Dir options are mandatory. delete_group_member(GroupName, UserName, Options) -> true | {error, Reason} delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason} delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason} Types GroupName = string() UserName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() AuthPassword = string() Reason = term() delete_group_member/3, delete_group_member/4 and delete_group_member/5 deletes a user from a group. If the group or the user does not exist, this function returns an error, otherwise it returns true . When delete_group_member/3 is called the Port and Dir options are mandatory. list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason} list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason} list_group_members(GroupName, Address, Port, Dir) -> {ok, Users} | {error, Reason} Types GroupName = string() Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Users = list() AuthPassword = string() Reason = term() list_group_members/2, list_group_members/3 and list_group_members/4 lists the members of a specified group. If the group does not exist or there is an error, {error, Reason} is returned. When list_group_members/2 is called the Port and Dir options are mandatory. list_groups(Options) -> {ok, Groups} | {error, Reason} list_groups(Port, Dir) -> {ok, Groups} | {error, Reason} list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() Groups = list() AuthPassword = string() Reason = term() list_groups/1, list_groups/2 and list_groups/3 lists all the groups available. If there is an error, {error, Reason} is returned. When list_groups/1 is called the Port and Dir options are mandatory. delete_group(GroupName, Options) -> true | {error,Reason} <name>delete_group(GroupName, Port, Dir) -> true | {error, Reason} delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason} Types Options = [Option] Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword} Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() GroupName = string() AuthPassword = string() Reason = term() delete_group/2, delete_group/3 and delete_group/4 deletes the group specified and returns true . If there is an error, {error, Rea- son} is returned. When delete_group/2 is called the Port and Dir options are mandatory. update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason} update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason} Types Port = integer() Address = {A,B,C,D} | string() | undefined Dir = string() GroupName = string() OldPassword = string() NewPassword = string() Reason = term() update_password/5 and update_password/6 Updates the AuthAccessPassword for the specified directory. If NewPassword is equal to "NoPassword" no password is requires to change authorisation data. If NewPassword is equal to "DummyPassword" no changes can be done without changing the password first. SEE ALSO
httpd(3erl) , mod_alias(3erl) , Ericsson AB inets 5.5.2 mod_auth(3erl)
All times are GMT -4. The time now is 05:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy