Is it possible to do something like this
#!/bin/bash
noOfParameters=2
paramname1="test1"
paramname2="test2"
i=0
while [ $i -ne ${noOfParameters} ]
do
i=`expr $i + 1`
echo ${paramname$i}
done
I am trying to achieve output as
test1
test2
I am getting "main.sh: line 10: ${paramname$i}: bad substitution" error
i=$((i + 1))or just((i++)), instead ofexpr.