in posix shell:
>value=value >foobar=value now how print value of $foobar? $$foobar not work - goes left-to-right interprets $$ first process id.
the duplicate question before me people pointing to, yes contain answer question buried in ton of irrelevant gunk. question simpler , point.
the way in posix use eval, very foobar contains nothing more valid variable name.
$ value=value $ foobar=value $ valid_var='[[:alpha:]_][[:alnum:]_]*$' $ expr "$foobar" : "$valid_var" > /dev/null && eval "echo \$$foobar"
Comments
Post a Comment