Problem with variable expension using for loop.

Hi,

I have a problem with expending variables when used in a for loop:

#!/bin/ksh
VAR1=aaa
VAR2=bbb
VAR3=ccc

for ITEM in VAR1 VAR2 VAR3
do
echo "${ITEM}"
done

This gives:

VAR1
VAR2
VAR3

but I want:

aaa
bbb
ccc

Can it be done ?
How ?

Thanks in advance,

ejdv

Try it this way:

#!/bin/ksh
VAR1=aaa
VAR2=bbb
VAR3=ccc

for ITEM in $VAR1 $VAR2 $VAR3
do
echo "${ITEM}"
done

Hope this helps.

Live is so simple sometimes :slight_smile:

Thanks a lot !

ejdv