Craig Dickson wrote: > echo $var=$(eval echo \$$var) That works. Personally I prefer to eval the entire line. This way you only use one layer of processing rather than the two in the above.
for var in FOO BLAH ; do
eval echo $var = \$$var;
done
For those following this scripting discussion, eval scans the line in
a shell evaluation pass one more time. Therefore in the first pass
the $var becomes FOO, the \$ becomes $, the $var becomes FOO. So you
then get 'eval echo FOO = $var', which is then evaluated again due to
the eval statement to become, 'echo FOO = bar' and then the echo is
executed with those arguments.
Bob
pgp00000.pgp
Description: PGP signature

