[Gllug] bash indirect variable referencing ugliness

Progga progga at BengaLinux.Org
Tue Nov 21 15:39:18 UTC 2006


On Tue, Nov 21, 2006 at 03:45:38PM +0000, Julian Somers wrote:
> 
> for service in $services;
> do
> 
> 	# indirect variable name MADNESS!
> 	adapter=`eval echo "$(eval echo adapter_${service})"` 
> 	lnb=`eval echo "$(eval echo lnb_settings_${service})"` 
> 	szapout=`eval echo "$(eval echo szapout_${service})"` 
> 	pid=`eval echo "$(eval echo pid_${service})"` 
> 	ip=`eval echo "$(eval echo ip_${service})"` 
> 
> 	$szap  -a ${!adapter} -l ${!lnb} -c frequencies $service 2>&1 > ${!szapout} &
> 

 for service in $services;
 do
 	adapter=adapter_$service 
	eval adapter=\$$adapter

 	lnb=lnd_settings_$service 
	eval lnb=\$$lnb

 	szapout=szapout_$service 
	eval szapout=\$$szapout

 	pid=pid_$service 
	eval pid=\$$pid

 	ip=ip_$service 
	eval ip=\$$ip
 
 	$szap  -a $adapter -l $lnb -c frequencies $service 2>&1 > $szapout &

        .................


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20061121/e41c2b30/attachment.pgp>
-------------- 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