Building command line parameters of arbitrary length

I couldn't find an existing thread that addressed this question, so hopefully this isn't redundant with anything previously posted. Here goes:

I am writing a C-Shell script that runs a program that takes an arbitrary number of parameters:

myprog -a file1 \
-b file2 \
-c file3 ... \
-n fileN \
-operation "a+b+c+...+n"

The files on which myprog operates are in subdirectories: 01/01.ext, 02/02.ext, ... etc.

Since the filenames happen to match the directory names, I would like to be able to pass the script an arbitrary number of directories (in practice, there will be fewer than 26, so there is no concern with running out of "-x" tags). The script would then construct the argument list for myprog so that
myscript.sh 01 02 03 ... 12
would expand into:
myprog -a 01/01.ext -b 02/02.ext ... -k 11/11.ext -l 12/12.ext \
-operation "a+b+c+...+k+l"

Is there a straightforward way to do this?

untested but it should get you pretty close

#!/bin/sh
if [ $# -gt 26 ]
then
   echo "Too many args!"
   exit 1
fi

letters="a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z"
cli="myprog"
count=1
operation=""
for argument in $*
do
   count=`expr $count + 1`
   letter=`echo $letters | head +$count | tail -1`
   cli="$cli -$letter ${argument}/${argument}.ext"
   if [ -z "$operation" ]
   then
      operation=$letter
   else
      operation="${operation}+${letter}"
   fi
done
cli="$cli -operation \"$operation\""
$cli
#!/bin/sh

echo $1 |
awk 'BEGIN {
n="abcdefghijklmnopqrstuvwxyz"
printf("myprog")}
{ for (i=1;i<=$0;i++) {
  printf(" -%s %02d/%02d.ext", substr(n,i,1), i, i)
  op=op substr(n,i,1)"+"
  }
  op=substr(op,1,length(op)-1)
  printf(" -operation \"%s\"\n",op)
}'

Usage: "scriptname 5" instead of "scriptname 01 ... 05".

One value suffice.

Regards