Path: utzoo!attcan!uunet!mcvax!unido!sbsvax!greim From: greim@sbsvax.UUCP (Michael Greim) Newsgroups: comp.unix.questions Subject: Re: Csh question Summary: here is the answer Message-ID: <565@sbsvax.UUCP> Date: 25 Jul 88 12:00:10 GMT References: <8807191241.AA18881@decwrl.dec.com> Organization: Universitaet des Saarlandes, Saarbruecken, West Germany Lines: 33 In article <8807191241.AA18881@decwrl.dec.com>, ellis@ultra.dec.com (David Ellis) writes: < In the csh, the expression $name or ${name} looks up the variable with the < given name and substitutes its value. < < Is there any way to get the value of a variable whose name is the value of < another variable? < < e.g. if we've done set x=a and set a=3, is there any simple csh expression < in terms of x that yields the value of a (3)? < < Csh gives an error message "Variable syntax." if I try something like < echo ${$x} < or even < echo "`echo {\$}$x`" < < ---- < David Ellis Yes. Here it is: eval echo \$$x Works in all csh's I could get my hands on quickly. -mg -- +------------------------------------------------------------------------------+ | UUCP: ...!uunet!unido!sbsvax!greim | Michael T. Greim | | or greim@sbsvax.UUCP | Universitaet des Saarlandes | | CSNET: greim%sbsvax.uucp@Germany.CSnet| FB 10 - Informatik (Dept. of CS) | | ARPA: greim%sbsvax.uucp@uunet.UU.NET | Bau 36, Im Stadtwald 15 | | Phone: +49 681 302 2434 | D-6600 Saarbruecken 11, West Germany | +------------------------------------------------------------------------------+ | # include | +------------------------------------------------------------------------------+