Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14612
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Grisha Levit <grishalevit@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | assoc_expand_once issues |
| Date | Thu, 20 Sep 2018 18:37:57 -0400 |
| Lines | 56 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1043.1537483093.1284.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | usenet.stanford.edu 1537483094 10640 208.118.235.17 (20 Sep 2018 22:38:14 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash <bug-bash@gnu.org> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=9FhdWzZbVYZDiwjfaj1ogIRNeKusoAzY+B0J9HV/ufw=; b=YG7iSSKiP/ZcHDhG4u9ZcH9tOi97jmI9kRLETqcgHBHr8czuSewT+kC5MXwPw/KVkV IoWqxCJS9Owr4dDgceuSC88+sM9WYVIOjzi5qkPIuQ3s+8HXswUZvjJqA/AbW5Gzs6ch tgWmy3YpCKEevApCNf15RdWKIlJMpAj3AyyHB7PwHhEldKU45C/pPuI4rTIDWuFJWzjK xrSS8igYPbCNL2pqRa7paeU+ya3Os3eJuFh5T+ie9HGwMMEdEFcYaF+sw20cBq/uSBTc +2vt+BXaUNS19x6VmpdHvpN6TLaZgSJ5N0gdaBMCCrAd8V/lkR4UB/kazGkPn8AxFGm2 vPiw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=9FhdWzZbVYZDiwjfaj1ogIRNeKusoAzY+B0J9HV/ufw=; b=b/r6t4uPm5kZd+b8Sl+uAx67z+5wl5S5sU1ypZ8WswxQfvNgKV4Vdj4FkmvLS34Gad 4hz8qpnv1UFV/Ga4GOhL+CKaXiBz2MRDNgMSd0hFbAkwRPb4QLuO3jeG9Dzjx7ak4ceg /umE2IKzby5IWnb6nleOlBRB04rVYegrQxg72Z/OMRXrk4or5ydg5zHxTrEGHzshlOnw 5uGWQV+fqmWO8XKEcLc+gPfbKy99eYHoUnG/GeiqoObnb3oCOb+S6Ep1Tbb0DDR9wRJf aWDU4d60GycX0+WFclpUYXLzbnkfJaeYI7r4Me4P6s3PgJ7Tdx2y47U6xsHvMY5/onrT J/Vw== |
| X-Gm-Message-State | APzg51BJkpQcDTET32jPO3nFND0PJScHMChzPGwnjdUKructhQ9GbRvP nwSMonbb4ey/dgNCjKBVZsIyA20rv8AF3FBUHxH0TA== |
| X-Google-Smtp-Source | ANB0Vdbf/+06aSA2SjKD0vMGqJcvWKW/IDx/fao8KnTW+4Wy8zSeIm+gMGv0WNs1aSti4g/FQW6JMe6RzxygEr3amP8= |
| X-Received | by 2002:a2e:4242:: with SMTP id p63-v6mr26562942lja.83.1537483088351; Thu, 20 Sep 2018 15:38:08 -0700 (PDT) |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:4864:20::22a |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| 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:14612 |
Show key headers only | View raw
I was testing out this new feature and I can't figure out how to handle certain characters in subscripts when the option is on. Without the option, it is possible to escape the `$' in the subscript to achieve the desired result but obviously that does not work if the option *is* on -- is there a different workaround to use or is this a bug with assoc_expand_once? Specifically, the following characters prove to cause an issue: shopt -s assoc_expand_once declare -A A for k in $'\t' ' '; do (( A[$k]=2 )) declare -p A done # declare -A A=() # declare -A A=() for k in ']' '*' '@'; do (( A[$k]=2 )) done # -bash: ((: A[]]=2: syntax error: invalid arithmetic operator (error token is "]=2") # -bash: A[*]: bad array subscript # -bash: A[@]: bad array subscript for k in $'\t' ' ' ']' '*' '@'; do read "A[$k]" <<< X # or printf -v "A[$k]" X done # -bash: read: `A[ ]': not a valid identifier # -bash: read: `A[ ]': not a valid identifier # -bash: read: `A[]]': not a valid identifier # -bash: A[*]: bad array subscript # -bash: A[@]: bad array subscript for k in ']' '*' '@'; do declare A[$k]=X done # -bash: declare: `A[]]=X': not a valid identifier # -bash: A[*]: bad array subscript # -bash: A[@]: bad array subscript for k in $'\t' ' ' ']'; do unset "A[$k]" done # -bash: unset: `A[ ]': not a valid identifier # -bash: unset: `A[ ]': not a valid identifier # -bash: unset: `A[]]': not a valid identifier for k in '*' '@'; do declare -A A; unset "A[$k]"; declare -p A done # -bash: declare: A: not found # -bash: declare: A: not found
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
assoc_expand_once issues Grisha Levit <grishalevit@gmail.com> - 2018-09-20 18:37 -0400
csiph-web