How Do I Create A Multi Line Menu Variable?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How Do I Create A Multi Line Menu Variable?
# 1  
Old 04-08-2010
How Do I Create A Multi Line Menu Variable?

I want something that would show up basically like:

Menu
-----
1) Option 1
2) Option 2
3) Option 3

Pick one:


I tried menu = " Menu \r\n ----- \r\n 1)Option 1 \r\n..............etc etc etc"

but that didnt work (just got the whole menu one one line, with the \r\n showing)

I also tried doing it multi line:
menu = " Menu
-----
1) Option 1"
u get the idea


edit: I am doing this is CentOS, bash

Last edited by SoVi3t; 04-08-2010 at 06:33 PM..
# 2  
Old 04-08-2010
You can use echo's "-e" option to convert \n into real newlines.

given it's bash you can also just let the line cross multiple lines.

Code:
VAR="this
is
a
really
tall
variable"

# 3  
Old 04-08-2010
or just simply use 'select' to build up your menu.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with reformat single-line multi-fasta into multi-line multi-fasta

Input File: >Seq1 ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD >Seq2 SDASDAQEQWEQeqAdfaasd >Seq3 ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG ...... Desired Output File >Seq1 ASDADAFASF ASFADGSDGF SDFSDFSDFS DFSDFSDFSD FSDFSDFSDF SD >Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies

2. Shell Programming and Scripting

awk - Multi-line data to be stored in variable

Greetings Experts, As part of automating the sql generation, I have the source table name, target table name, join condition stored in a file join_conditions.txt which is a delimited file (I can edit the file if for any reason). The reason I needed to store is I have built SELECT list without... (5 Replies)
Discussion started by: chill3chee
5 Replies

3. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

4. Shell Programming and Scripting

Multi-line filtering based on multi-line pattern in a file

I have a file with data records separated by multiple equals signs, as below. ========== RECORD 1 ========== RECORD 2 DATA LINE ========== RECORD 3 ========== RECORD 4 DATA LINE ========== RECORD 5 DATA LINE ========== I need to filter out all data from this file where the... (2 Replies)
Discussion started by: Finja
2 Replies

5. IP Networking

How to create a multi-chat server using UDP?

Hifriends I have a doubt . how to create a multi-chat server using UDP which can run on MAC systems.. Thank u in advance (3 Replies)
Discussion started by: babbu25
3 Replies

6. Shell Programming and Scripting

Create a multi user input form

Hi All, Please ignore if terminology used is incorrect as I am new to Unix. I want to create a Multi user input form which looks something like this: ABCD TOOL Logged User: abcd12 ... (4 Replies)
Discussion started by: vidhu0007
4 Replies

7. Shell Programming and Scripting

Multi line variable script... needs help.

I am trying to write a script that will help me put a file into excel with little manipulation. Below is a sample of the file im using. Group1:*:gid1:user,user Group2:*:gid2:user,user Group3:*:gid3:user,user,user,user,user,user,user Group4:*:gid4:user,user I marked in red the part that is... (1 Reply)
Discussion started by: rookieuxixsa
1 Replies

8. Shell Programming and Scripting

Can someone show me how to create a menu?

Can someone show me how to create a menu? I want a script someone who is not unix literate can use, with some simple commands like ls -al a directory or find files based on a date, does anyone know how to make a simple menu ? Thanks. (4 Replies)
Discussion started by: taekwondo
4 Replies

9. UNIX for Advanced & Expert Users

using fmli to create menu's

I am currently having a problem creating a dynamic Menu that reads in from a file and appends this Menu list with an exit menu item. the syntax I am using to create the dynamic Menu is menu="$ARG1 Host names" `cat Hosts.data | regex '^(''.*)$0$' ' name="$m0" action=open Menu.Login.mnu... (0 Replies)
Discussion started by: craigmckeeman
0 Replies

10. Shell Programming and Scripting

using fmli to create menu's

I am currently having a problem creating a dynamic Menu that reads in from a file and appends this Menu list with an exit menu item. the syntax I am using to create the dynamic Menu is menu="$ARG1 Host names" `cat Hosts.data | regex '^(''.*)$0$' ' name="$m0" action=open... (2 Replies)
Discussion started by: craigmckeeman
2 Replies
Login or Register to Ask a Question