bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: indirection as an lvalue


From: Andreas Schwab
Subject: Re: indirection as an lvalue
Date: Fri, 24 Apr 2009 19:54:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Bill Gradwohl <bill@ycc.com> writes:

> My real world need is to assign temporary file names to named variables.
>
> makeTempFileName=''
> for x in 'TEMPLOG' 'TEMPFILELEFT' 'TEMPFILERIGHT'; do
>    makeTemp "${x}"   # function that does a lot of processing and
>                      # sets makeTempFileName equal
>                      # to /tmp/blahblah.??????
>    !x="${makeTempFileName}"
> done 

Use eval.

for x in 'TEMPLOG' 'TEMPFILELEFT' 'TEMPFILERIGHT'; do
   makeTemp "${x}"   # function that does a lot of processing and
                     # sets makeTempFileName equal
                     # to /tmp/blahblah.??????
   eval $x=\${makeTempFileName}
done 

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]