[NTLUG:Discuss] sh coding problem

Fred James fredjame at concentric.net
Fri Mar 23 16:12:36 CST 2001


BINGO!
My humble thanks!

Chris Cox wrote:

> In pure Bourne shell...
>
> MOM_CHAIR="Too soft"
> POP_CHAIR="Too hard"
> KID_CHAIR="Just right"
> while read person; do
>     chair_var="${person}_CHAIR"
>     eval chair_value=\$${chair_var}
>     echo "$chair_value"
> done
>
> Fred James wrote:
> >
> > This is Bourne shell scripting.
> >
> > Given similar environment variables such as
> >      MOM_CHAIR
> >      POP_CHAIR
> >      KID_CHAIR
> > I want to build the variable name on the fly and retrieve the value to base a decision
> > on in my script.
> > Hints?
> >
> >
> > --
> > Consider Fractals
> > a large, calm, black cat
> > who seems often to be my spiritual leader.
> >
> >
> _______________________________________________
> http://ntlug.org/mailman/listinfo/discuss

--
Consider Fractals
a large, calm, black cat
who seems often to be my spiritual leader.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ntlug.org/pipermail/discuss/attachments/20010323/06f34951/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fredjame.vcf
Type: text/x-vcard
Size: 150 bytes
Desc: Card for Fred James
Url : http://ntlug.org/pipermail/discuss/attachments/20010323/06f34951/fredjame.vcf


More information about the Discuss mailing list