postitional parameters

Is it possible and how would you use postional parameter to prompt user input?

I want to ask the user a question like the following:

Enter the tablespace_name to backup:

Read the response if it is 2,3, or so on ..

parse the answer into a statement like:

restore datafile 2, 3;

Is this possible if the user enters 2 or 3 or 4 tablespace_names?

you can do that with read.

echo "Enter the tablespace_name to backup:"
read val1 val2
echo $val1 $val2

you might require some checks as per your requirement.

No. It has to be dynamic.

It could be 2 vars or 3 vars or more.

#!/bin/bash
read foo junk
echo $foo
echo  $junk


$ ./t foo junk rest

foo junk rest
foo
junk rest

Or:

#!/bin/bash
read foo
set $foo
echo $1 $2 $3 etc.

./t foo junk rest more
foo junk rest more
foo junk rest etc.

How about this

print "enter the tablespace_names: "

read INPUT

array=$(echo -e "$INPUT")

print ${#array[*]}
print  ${array[*]}

If I read the values into a variable like INPUT ( that would hold users, tools, and so on ) what is the must efficient way to chop that variable up and populate the array?

thanks.

Try with the -a option of read

echo "Enter the tablespace_name(s) to backup:"
read -a TBLS
for ((i=0; i<${#TBLS[@]}; i++))
do
    echo "$i ${TBLS[$i]}
done