[Gllug] bash indirect variable referencing ugliness

Tethys sta296 at astradyne.co.uk
Tue Nov 21 15:09:09 UTC 2006


Julian Somers writes:

>Is there a more elegant way to do this? I wrote it yesterday, and
>already I have forgotten what half of those evals and backtics are for!

Errr... yes. Just get rid of them all. They're not necessary:

	adapter="adapter_$service"
	lnb="lnb_$service"
	szapout="szapout_$service"
	pid="pid_$service"
	ip="ip_$service"

	echo "Config values for service $service:"
	for value in adapter lnb_settings szapout pid ip
	do
		varname="${value}_$service"
		echo "  $value: ${!varname}"
	done

Tet
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list