Bash script to give multiple choices and a varying number of answers

Hello everybody,

I use `case' quite a lot but , excellent as it is , it only gives one
final result ; can anyone suggest a way whereas , say long
lists of choices are given and I , or a user could select either one
two or any number of results to be echoed .

many thanks in anticipation

v686.

Im not sure I understand... could you give a sample of your case usage( in code tags...), and what more you would like?
I dont get the "one two or any number of results to be echoed . "

Eventually sth along this line:

ARR=( ABC DEF GHI JKL MNO PQR STU )
select CH in ${ARR[@]}
  do for ((i=0; i<${#REPLY}; i++))   
       do SE=${REPLY:$i:1}           
#          echo "CH= " $CH ", SE= " $SE ", REPLY= " $REPLY 
          case $SE in
                1) echo "Selected "$SE ", " ${ARR[0]} " = " ${ARR[$SE-1]};;
                2) echo "Selected "$SE ", " ${ARR[1]} " = " ${ARR[$SE-1]};; 
                3) echo "Selected "$SE ", " ${ARR[2]} " = " ${ARR[$SE-1]};; 
                4) echo "Selected "$SE ", " ${ARR[3]} " = " ${ARR[$SE-1]};; 
                5) echo "Selected "$SE ", " ${ARR[4]} " = " ${ARR[$SE-1]};; 
                6) echo "Selected "$SE ", " ${ARR[5]} " = " ${ARR[$SE-1]};; 
                7) echo "Selected "$SE ", " ${ARR[6]} " = " ${ARR[$SE-1]};; 
          esac
       done
  done
1) ABC
2) DEF
3) GHI
4) JKL
5) MNO
6) PQR
7) STU
#? 127       #          <----------- THREE selections in one go!
Selected 1 ,  ABC  =  ABC
Selected 2 ,  DEF  =  DEF
Selected 7 ,  STU  =  STU

hello vbe ,

I haven't used case for this problem,for I know I'll only get one answer.
I should have been more specific rather than say : "one two or any number of results to be echoed ".
Directories: what I am trying, is to create a script that does this:
a) Echo a list of all directories;
b) Give a number or letter to each one;
c)I can then choose which directory or directories I wish to
be displayed using `ls' or its octal variation.

---------- Post updated at 07:48 PM ---------- Previous update was at 07:37 PM ----------

RudiC ,

I'm working on your code, I'll get back ,probably tomorrow.
Maybe I'll have indigestion ,{words !}.

v686.