indirect shell-vars
Ruud Harmsen
ruud at targon.UUCP
Mon Sep 11 20:29:28 AEST 1989
I'm looking for a way to reference a variable in the Bourne-shell,
whose name is given in another variable. I found the following solution
using a sub-shell myself, but it seems rather clumsy:.
export x1; x1=one
export x2; x2=two
echo which var\?
read xx
sh -c "echo \$x`echo $xx`"
Are there any better/faster/shorter ways? Perhaps using "eval", but
also executes the string, which is too much.
More information about the Comp.unix.questions
mailing list