|
From: | Paul Jarc |
Subject: | Re: variable variable name |
Date: | Thu, 07 Feb 2002 14:26:25 -0500 |
User-agent: | Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu) |
"Matt P." <matt@scyld.com> wrote: > NAME=chet > MEAL=pizza > eval $NAME.meal=$MEAL That would be fine except that "chet.meal" is not a valid variable name. Try this instead: eval "${NAME}_meal="'"$MEAL"' eval 'echo "$'"${NAME}"'_meal"' (This version also ensures that the contents of $MEAL are not re-expanded.) paul
[Prev in Thread] | Current Thread | [Next in Thread] |