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 how I could do this in the hardcoded way, BUT the list of menu items being displayed is collected dynamically when needed.

The actual question being : Is it possible to somehow parameterise the select statement so that it displays menu items in which blanks can appear.

Example of hardcoded way :
select option in "one one" "two two"; do
break
done

displays:
1) one one
2) two two

So, how can this "one one" "two two" part in the select be replaced by something that is parameterised.

Thanks.

You don't say which shell you are using. Using ksh...

#!/usr/bin/ksh

set "one one" "two two"

select x in "$@"
do
  break
done

1) one one
2) two two
#?

I'm indeed using ksh. I'll give it a try...
Thx

Ok, tried it. The example works of course.

Now image that the actual data is completely unknown and dynamically created. The result in my case is put in file. This would mean a flat text file with something like this :

one one
two two

in it.

The contents of the file can be modified to make it work, but I don't seem to succeed.

Ok, just figured it out ! For those who might be interested, this is what I did.

1) source file with following contents:
one one
two two

2) the coding:
ix=0
while read record; do
item[$ix]="$record"
ix=$(($ix+1))
done < cat source

set "${item[@]}"

select n in "$@"; do
break
done

3) the result:
1) one one
2) two two
#?

Example using a file named "source" instead of parameters...

#!/usr/bin/ksh

IFS="
"
select x in $(<source)
do
  break
done

Note that you may have to restore the original value of IFS afterwards.