[comp.unix.questions] recursive variable substitution in csh

jmacdon@cg-atla.agfa.com (Jeff MacDonald) (08/16/90)

In the C-shell, how does one evaluate a variable which contains the
name of a variable in order to get the value of the variable
contained by the variable that one is evaluating?

To wit:

set x = 'ABC'
set y = '$x'
set z =      # some function of y such that $z == "ABC"


Don't ask how I got into this predicament, it's not funny!
-- 
Jeff MacDonald   ([decvax|samsung|ima|ulowell]!cg-atla!jmacdon)
Agfa/Compugraphic Division  200-2-9F (jmacdon@cg-atla.agfa.com)
200 Ballardvale, Wilmington MA 01887
(508) 658-0200,  extension 5406                        Hi, Mom!

tchrist@convex.COM (Tom Christiansen) (08/17/90)

In article <9045@cg-atla.agfa.com> jmacdon@cg-atla.UUCP (Jeff MacDonald) writes:
>In the C-shell, how does one evaluate a variable which contains the
>name of a variable in order to get the value of the variable
>contained by the variable that one is evaluating?
>
>set x = 'ABC'
>set y = '$x'
>set z =      # some function of y such that $z == "ABC"

% eval set z = "$y"
% echo $z
% ABC

--tom
--
Tom Christiansen                       {uunet,uiucdcs,sun}!convex!tchrist 
Convex Computer Corporation                            tchrist@convex.COM
  "UNIX was never designed to keep people from doing stupid things,
   because that policy would also keep them from doing clever things." [gwyn]