[Gllug] bash indirect variable referencing ugliness

Julian Somers lists at bigpip.com
Thu Nov 23 18:28:48 UTC 2006


On 21:18 Tue 21 Nov     , Mark Williams wrote:
> 
> > Take a deep breath, hold your nose, and scroll down to my hideous
> > hack to do indirect variable reference in this bash script.
> > 
> > Is there a more elegant way to do this?
> > 
> > [...]
> > 
> > #!/bin/bash
> 
> I would use an array of arrays to declare the values---one array for
> each `service' and then just straightforwardly iterate through them
> along the lines suggested by Tet et al.  Array support in bash is IMO
> better than any of the other common shells (including zsh).
> 
> No, of course I can't remember the syntax :-)!  I'll look it up if you
> get stuck, though.

Of course. For some reason I thought bash didn't do arrays. 

Thanks all, 

Julian

> 
> -- 
> Mark

> -- 
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug


-- 

Julian Somers
+44 208 265 5407
-------------- 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