[Nottingham] A quick bourne shell scripting question

laccata nottingham at mailman.lug.org.uk
Fri Nov 8 11:39:01 2002


On Friday 08 November 2002 10:57, Michael Erskine wrote:
> Hi,
>
> Here's a query for any shell scripting folks...
>
> I have a list of variables I'd like to echo to STDOUT so I have a loop
> thus...
>
> for var in VAR1 VAR2 VAR3 VAR4
> do
>     echo "${var}=3D${${var}}"
> done
>
> ...but it doesn't work -- how can I get the desired result?
>
> BTW: the shell in use is ash as provided by BusyBox 0.60.5.
>
> Regards,
>
> Michael.

#!/bin/ash
for var in VAR1 VAR2 VAR3 VAR4
do
=09echo "var=3D${var}"
done

laccata@homemade:~/tmp> ./eko
var=3DVAR1
var=3DVAR2
var=3DVAR3
var=3DVAR4

hope this helps