[ale] variable variables in bash/ksh?

John Wells jb at devsea.com
Mon Apr 19 09:44:36 EDT 2004


Guys,

I'm trying to figure out a way to use, to borrow from PHP, variable variables in shell.

For example, consider the following:

XYZ="ABC"
ABC=123456

# in php, I can do the following and get "123456" as the result, so it
# first evals XYZ to get ABC, and then applies the second $ to ABC to
# get the value of $ABC
echo $$XYZ

Anyone know how to do this in bash or ksh?  Seems like something I once knew, but it escapes me now...

Thanks,
John



More information about the Ale mailing list