Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!uhccux!munnari.oz.au!cs.mu.oz.au!ok From: ok@cs.mu.oz.au (Richard O'Keefe) Newsgroups: comp.unix.questions Subject: Re: indirect shell-vars Message-ID: <2088@munnari.oz.au> Date: 12 Sep 89 11:45:42 GMT References: <627@targon.UUCP> Sender: news@cs.mu.oz.au Lines: 13 In article <627@targon.UUCP>, ruud@targon.UUCP (Ruud Harmsen) writes: > I'm looking for a way to reference a variable in the Bourne-shell, > whose name is given in another variable. ... Perhaps using "eval", but > also executes the string, which is too much. x="foo ugh" y=x Method 1: eval 'z="${'$y'}"' Method 2: cmd="echo \"\${$y}\"" z=`eval $cmd` They're not perfect, mind.