Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11961
| Path | csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Chet Ramey <chet.ramey@case.edu> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: bug with getting an array index or ... |
| Date | Sun, 6 Dec 2015 13:50:06 -0500 |
| Organization | ITS, Case Western Reserve University |
| Lines | 23 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1521.1449427816.31583.bug-bash@gnu.org> (permalink) |
| References | <CAH_OBidDQj8G60kKiEVPo46o=s8-UC-pKT1a=qjEn7XVHxo7HA@mail.gmail.com> <CAJnmqwYxCYUzNSkQjDyShZe0GK9KRG9jR+5yXH9kFO0UxTQA2A@mail.gmail.com> |
| Reply-To | chet.ramey@case.edu |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1449427816 1009 208.118.235.17 (6 Dec 2015 18:50:16 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash <bug-bash@gnu.org>, chet.ramey@case.edu |
| To | konsolebox <konsolebox@gmail.com>, shawn wilson <ag4ve.us@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
| In-Reply-To | <CAJnmqwYxCYUzNSkQjDyShZe0GK9KRG9jR+5yXH9kFO0UxTQA2A@mail.gmail.com> |
| X-Mirapoint-Virus-RAPID-Raw | score=unknown(0), refid=str=0001.0A020202.5664835F.0139,ss=1,re=0.000,fgs=0, ip=40.133.163.73, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46 |
| X-Mirapoint-Loop-Id | 6bf1884d8abb8f8ad5bd829d5ff40cdb |
| X-Junkmail-Whitelist | YES (by domain whitelist at mpv4-2015.case.edu) |
| X-Mirapoint-Virus-RAPID-Raw | score=unknown(0), refid=str=0001.0A020201.5664835F.012D,ss=1,re=0.000,fgs=0, ip=40.133.163.73, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46 |
| X-Mirapoint-Loop-Id | 29d8f6d135860f8ec94b1192060ebe4d |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] |
| X-Received-From | 129.22.103.195 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:11961 |
Show key headers only | View raw
On 12/6/15 10:18 AM, konsolebox wrote:
> On Sun, Dec 6, 2015 at 9:38 PM, shawn wilson <ag4ve.us@gmail.com> wrote:
>> declare -a array=(aaaaaaaa bbbbbbbb cccccccc); echo "${!array[@]}";
>> echo "${!array[@]:-}"
>>
>> also, "${!array[@]:foo}" and :+foo and :-foo are all empty as well -
>> I'm pretty sure this is not intended?
>>
> ${!name[@]:-word}, ${!name[@]:+word}, and ${!name[@]:offset:length}
> are not explicitly documented as valid forms of parameter expansion,
> and never has been.
Yes. The only documented way to get that construct to produce the list of
indices is to use it like ${!array[@]}.
When you use it in a different expansion, you get standard variable
indirection: expand ${array[@]} and try to use it as a variable name.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: bug with getting an array index or ... Chet Ramey <chet.ramey@case.edu> - 2015-12-06 13:50 -0500
csiph-web