X-Received: by 10.236.124.240 with SMTP id x76mr732677yhh.27.1402267857618; Sun, 08 Jun 2014 15:50:57 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hw13no5673486qab.0!news-out.google.com!a8ni470qaq.1!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.gcicommunications!news.posted.gcicommunications.POSTED!not-for-mail NNTP-Posting-Date: Sun, 08 Jun 2014 17:50:55 -0500 Newsgroups: comp.os.linux.misc Subject: Re: need bash indirect variable help References: From: floyd@apaflo.com (Floyd L. Davidson) Organization: __________ Date: Sun, 08 Jun 2014 14:50:50 -0800 Message-ID: <87mwdnm2wl.fld@barrow.com> User-Agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.19 Cancel-Lock: sha1:PcGKt1YG6TGnT9bz94ZQV6aRCBw= MIME-Version: 1.0 Lines: 29 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 24.237.125.254 X-Trace: sv3-Ji98rntiGWSN/NembbusNX3Gt2ApEIm2gcsUm+lTvYQpuer2LjQzojvddQr78UWMyAES0LciQTdlf/+!+5UQmp5kCF/9UxRmXPiBlyEOM0wpkXTnAlqg3ZnxSeIdgYezmueCZo6U7G0al7eIrCGFe8VM X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1898 Content-Type: text/plain; charset=us-ascii Xref: csiph.com comp.os.linux.misc:11227 Todd wrote: >On 06/08/2014 01:31 PM, Jerry Peters wrote: >> >> In bash: >> ~$ x=z >> ~$ a=x >> ~$ echo ${!a} >> z >> > >Hi Jerry, > >Thank you! > >What exactly does the "!" do? See the bash man page, under the heading of "Parameter Expansion", where the third paragraph down describes it. Indirection, or they suggest "indirect expansion", uses the contents of a variable as a the variable acted on. It is the equivalent of the also suggested eval command, which might be prefered just because it will be more obvious what the eval command is doing while the bang operator will be easily missed or confused. -- Floyd L. Davidson http://www.apaflo.com/ Ukpeagvik (Barrow, Alaska) floyd@apaflo.com