bug-bash
[Top][All Lists]
Advanced

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

Re: Problem with how to assign an array


From: Steven W. Orr
Subject: Re: Problem with how to assign an array
Date: Fri, 25 Feb 2011 13:25:53 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 2/25/2011 4:22 AM, Andreas Schwab wrote:
"Steven W. Orr"<steveo@syslang.net>  writes:

517>  r=($(eval echo "\${${a_all[1]}[@]}"))

If you use $(eval echo ...) you are almost always doing it wrong.

eval "r=(\"\${${a_all[1]}[@]}\")"

Andreas.


Thanks. I changed things of the form

r=($(eval "echo "\${${a_all[1]}[@]}\""))
to
eval "r=(\"\${${a_all[1]}[@]}\")"

One place where I can't see how to eliminate the construct is where I pass in the name of an array and parse it using set

set -- $(eval echo \"\${$name[@]}\")

would I be better off with something like

eval "set -- \"\${$name[@]}\""

?

TIA

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

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