Is is possible to pass multiple entries in PS3 select ?

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 . .?

It won't. It will display

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?

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?

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 .

sure, evaluate $REPLY (don't use DIR).
REPLY is set to the "reply" entered by the user.

1 Like