|
From: | Dan Douglas |
Subject: | Re: [Help-bash] array indirection |
Date: | Fri, 04 May 2012 19:39:43 -0500 |
User-agent: | KMail/4.8.3 (Linux/3.3.4-pf+; KDE/4.8.3; x86_64; ; ) |
On Friday, May 04, 2012 06:20:46 PM Bill Gradwohl wrote: Can anyone explain why one pass of this loop works and then fails. Don't loop over arrays that way. Either use a `for in' loop to iterate elements, or iterate keys. Also, indirection can't be done that way. There is no such expansion as "${!arrname[x]}" where x is anything other than @ or *. I wrote an example of how this can be done here:
http://wiki.bash-hackers.org/syntax/arrays#indirection
Which demonstrates Bash's indirection operator and obtaining keys if necessary. -- Dan Douglas |
signature.asc
Description: This is a digitally signed message part.
[Prev in Thread] | Current Thread | [Next in Thread] |