LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-27-2004, 04:22 PM   #1
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
Bash Select Function: Formatting Output


#!/bin/bash
clear
OPTIONS="option1 option2 option3 option4 option5 option6"
select opt in $OPTIONS; do

When writing menus for the CLI I start off with the above then use if statements to set up the menus. It works great but I would like to format the output displayed on the screen. As it is the menu script will display:

1) option 1 3) option3 5) option5
2) option 2 4) option4 6) option6

I would like to have the output look more like this for small menus:

1) option 1
2) option 2
3) option3
4) option4
5) option5
6) option6

I am sure the solution is simple but I can't seem to find the answer.

How would you format the output as wanted?

Thanks,
Ted.
 
Old 03-27-2004, 05:12 PM   #2
AutOPSY
Member
 
Registered: Mar 2004
Location: US
Distribution: Redhat 9 - Linux 2.6.3
Posts: 836

Rep: Reputation: 31
Im not absolutely sure but try \n after each option and see if that helps.
 
Old 03-28-2004, 07:26 AM   #3
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Nope, it just sees the \n as another option to display on the screen. If I put \n after the OPTION line it just says it can't find the directory.

Thanks,
Ted.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP: html Form Select function problem camlinux Programming 2 05-15-2005 09:23 PM
Formatting output of ls doodar Linux - Newbie 29 07-29-2004 02:25 PM
select function as timeout? frostmagic Programming 2 02-09-2004 12:56 PM
need hlp formatting output from ls test* Evan P. Programming 1 11-06-2003 09:40 PM
bash: can't get out of SELECT adam_boz Programming 2 09-17-2002 12:53 AM


All times are GMT -5. The time now is 06:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration