I have a shell that starts where the predefined env variables include:
FOOCOUNT=4
FOO_0=John
FOO_1=Barry
FOO_2=Lenny
FOO_3=Samuel
I can’t change the way I get this data.
I want to run a loop that generates a variable and uses the contents.
echo "Hello $FOO_count"
This syntax, however, is incorrect, and that is what I am looking for ...
count=$FOOCOUNT
counter=0
while [ $counter -lt $count ]
do
counter=`expr $counter + 1`
echo "Greeting #$counter: Hello, ${myContructedVar}."
done
Many thanks
source
share