Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!hellgate.utah.edu!fcom.cc.utah.edu!npd.novell.com!news From: bcardoza@npd.Novell.COM (Bryan Cardoza) Newsgroups: comp.unix.internals Subject: Re: puzzled Message-ID: <1990Nov28.170905.29475@npd.Novell.COM> Date: 28 Nov 90 17:09:05 GMT References: <1990Nov27.002845.3387@informix.com> Reply-To: bryan_cardoza@npd.novell.com (Bryan Cardoza) Followup-To: comp.unix.shell Distribution: usa Organization: Novell NPD, Provo, Utah Lines: 38 In article <1990Nov27.002845.3387@informix.com> housed@infmx.informix.com (Darryl House) writes: >The following is a Bourne shell script that illustrates >what I am trying to do: set a shell variable that >contains the contents of another one that is referred >to by concatenating two others. Sufficiently confusing? Pointer variables in Bourne shell? You mean like this? #! /bin/sh PREFIXES="alpha gamma" SUFFIXES="beta delta" alphabeta=1 alphadelta=2 gammabeta=3 gammadelta=4 for prefix in ${PREFIXES} do for suffix in ${SUFFIXES} do # Notice that the combination of "eval" and escaping # the first "$" does the magic you want. eval magic=\${${prefix}${suffix}} echo ${magic} done done Is this what you mean? (I've found this really usefull in calling shell procedures with different global shell variable names as arguments.) -- Bryan Cardoza Software Engineer Novell, Inc. Telephone: (801) 429-3149 Provo, UT Fax: (801) 429-3500