[Gllug] bash indirect variable referencing ugliness

Mark Williams mark at aziraphale.homeip.net
Tue Nov 21 21:18:33 UTC 2006


> 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.

-- 
Mark
-------------- 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