Visit Our UNIX and Linux User Community


Is is possible to pass multiple entries in PS3 select ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is is possible to pass multiple entries in PS3 select ?
# 1  
Old 11-11-2012
Is is possible to pass multiple entries in PS3 select ?

Code:
PS3="Enter corresponding number and hit enter:"
select DIR in `cat mylist`  QUIT
do
if [ -z "$DIR" ]
   then
   echo "INVALID INPUT"
else
if [ -d "$mysource/$DIR" ]; then
my commands .....               
else
     break
  fi
  fi
  REPLY=''
done

The above will return something like below :

Select from the list of choices
1) 595
2) 596
3) 597
4) 598

Is there a way i can make it possible to enter multiple choices like 1, 2 . .?
# 2  
Old 11-11-2012
Quote:
Originally Posted by ningy
. . .
The above will return something like below :

Select from the list of choices
1) 595
2) 596
3) 597
4) 598
It won't. It will display
Code:
1) 595
2) 596
3) 597
4) 598
5) QUIT
Enter corresponding number and hit enter:

Where and how do you want multiple choices to show up?
# 3  
Old 11-11-2012
That correct. So from the display i can choose only one option at a time like 1 then 2 and 3 etc..

But my question was if its possible to enter multiple choices like 1, 2 .. at one go?
# 4  
Old 11-11-2012
Ah, got you. Sorry for my misunderstanding. I can't give a terminal answer, but to my knowledge that's not possible with select. Unless some other guy can show you a tricky solution, you need to do this kind of selection with echo and read.
# 5  
Old 11-11-2012
sure, evaluate $REPLY (don't use DIR).
REPLY is set to the "reply" entered by the user.
This User Gave Thanks to sandholm For This Post:

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Select multiple column from multiple files

Hi Friends, $ cat test1.txt emeka:1438 shelley:1439 dmeyer:1440 kurtarn:1441 abdul:1442 $ cat test2.txt 1:a 2:b 3:c 4:d $ cat test3.txt cat:dog:bat man:hot:cold (5 Replies)
Discussion started by: Jewel
5 Replies

2. UNIX for Advanced & Expert Users

Pass Multiple Commands and Open Multiple Xterms via PSS

Hello, I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Discussion started by: icemanj
11 Replies

3. Shell Programming and Scripting

Concatenate select lines from multiple files

I have about 6000 files of the following format (three simplified examples shown; actual files have variable numbers of columns, but the same number of lines). I would like to concatenate the ID (*Loc*) and data lines, but not the others, as shown below. The result would be one large file (or... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

4. Shell Programming and Scripting

How to pass Variable from shell script to select query for SqlPlus?

echo "set echo off"; echo "set feedback off"; echo "set linesize 4000"; echo " set pagesize 0"; echo " set sqlprompt ''"; echo " set trimspool on"; Select statement is mentioned below echo "select res.ti_book_no from disney_ticket_history res where res.ti_status =${STATUS} and... (7 Replies)
Discussion started by: aroragaurav.84
7 Replies

5. Shell Programming and Scripting

How to use a multiple line list with the select command in ksh?

I copied the below program to play around with displaying a list of items using the select command in ksh. When I put all items in the same line, it works fine. I am trying to use multiple lines instead of a single row...my list is too large for a single line. How do I get the line continuation... (3 Replies)
Discussion started by: haganator
3 Replies

6. Shell Programming and Scripting

PS3 select when wrong input given

Hi All I am using the below code to chose a file to view : PS3="Select file to view : " select FILE in `ls` QUIT do if ; then clear cat $FILE else break fi REPLY='' done Everything works fine as long as I am giving the correct choice . But when i give a... (4 Replies)
Discussion started by: ningy
4 Replies

7. Shell Programming and Scripting

PS3 and SELECT, is it possible to put a line break?

Hi all, Before I give up on using SELECT for my first attempt at creating a menu driven script, can anyone please advise if it is possible to include a line break for PS3, I've tried putting in a \n and it does not work. Tried for both bash and ksh and both gives the same result. Preference... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. UNIX for Dummies Questions & Answers

Select Distinct on multiple fields

How do I create a script that provides a count of distinct values of a particular field in a file utilizing commonly available UNIX commands (sh or awk)? Field1|Field2|Field3|Field4 AAA|BBB|CCC|DDD 111|222|333|777 AAA|EEE|ZZZ|EEE 111|555|333|444 AAA|EEE|CCC|DDD 111|222|555|444 For... (2 Replies)
Discussion started by: Refresher
2 Replies

9. Shell Programming and Scripting

Dynamic select with multiple word menu items

Hello all, I'm developing a deployment script at work and at one point it would need to display something like this: Which version of ADMIN would you like to deploy? 1) 1.0.0 (store1, 10 Jan 2004) 2) 1.0.1 (store1, 20 Jun 2004) 3) 1.0.2 (store1, 15 Jul 2004) Select a version : I know... (5 Replies)
Discussion started by: domivv
5 Replies

10. Programming

Multiple fds in select()

Hi I want to read messages from multiple interfaces using one select() statement. Does anybody knows if I can specify multiple fds in the *readfds parameter? If yes, what's the max num of fds? Something like the following: fd_set descrSet = {0}; int retVal; MyStructS *msg = NULL; ... (1 Reply)
Discussion started by: amatsaka
1 Replies

Featured Tech Videos