It appears that indirection can only be used as an rvalue. Is there any way to use indirection as an lvalue?
This is a trivial example, but gives you the idea.
for x in 'VAR_A' 'VAR_B' 'VAR_C'; do
# What I'd like to say is
!x="hello"
done
resulting in 3 variables getting assigned a value, the equivalent of:
VAR_A="hello"
VAR_B="hello"
VAR_C="hello"
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
After the loop finishes, I want to use ${TEMPLOG}, ${TEMPFILELEFT} and
${TEMPFILERIGHT} throughout the script.
BTW - I ran thru the archives via a search for 'indirection' and for the
longest time was confused by references to addr...@hidden scattered
throughout the code examples. Here's an example:
http://lists.gnu.org/archive/html/bug-bash/2002-11/msg00085.html
I did a man bash looking for addr...@hidden thinking its some new
facility I was unaware of. Made me feel pretty silly afterwards 8-)
What is that supposed to be? The references presented by the search were
largely unusable because of it.
--
Bill Gradwohl
signature.asc
Description: This is a digitally signed message part
