[NTLUG:Discuss] sh coding problem
Chris Cox
cjcox at acm.org
Fri Mar 23 15:49:22 CST 2001
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.
>
>
More information about the Discuss
mailing list