DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Oleg Verych <olecom@gmail.com>
Cc: dash@vger.kernel.org
Subject: Re: positional argument bug
Date: Thu, 05 May 2011 09:53:19 -0600	[thread overview]
Message-ID: <4DC2C7EF.3050001@redhat.com> (raw)
In-Reply-To: <BANLkTikk977F6f_ZTjGFroVXyont_gCWOw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

On 05/05/2011 09:47 AM, Oleg Verych wrote:
> 2011/5/5 Eric Blake <eblake@redhat.com>:
>> [originally brought up on the bash list as a NetBSD bug, but dash is
>> also affected]
> 
> So what? I was happy (years back) to have ability to create adressable
> arrays using $####... or ${####} if it matters.

You can always create an addressable array with ${####} - the bug in
question is only about dash's treatment of $####.  POSIX already
requires that the user use braces for multi-digit positional parameters.

> 
>> Therefore, in "$10", 10 is not a name, so the longest name is the empty
>> string, and the single-character symbol is used instead, such that this
>> MUST be parsed as ${1}0, not as ${10}.
> 
> IMHO this would be step back.

No, making $10 different from ${10} would be making things
POSIX-compliant.  And I can envision using things like:

set a
eval echo \$$10

as a way to specifically echo the contents of $a0, but where that usage
only works if all shells follow the same rules.  But given the current
difference in behavior, I guess:

eval echo \$${1}0

is the best I can expect.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2011-05-05 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTi=cmXee5Ej2fmhX2dp4FG6U3_1JqQ@mail.gmail.com>
     [not found] ` <20110504024128.GB8187@elie>
     [not found]   ` <BANLkTimmAWkEne0SYFDpc4Kq-4ChBJ_dWg@mail.gmail.com>
     [not found]     ` <BANLkTimUJX-asm1rBoKHKMH6HU8asWdLPA@mail.gmail.com>
     [not found]       ` <20110504050223.GG8187@elie>
     [not found]         ` <m3oc3ic2sc.fsf@linux-m68k.org>
     [not found]           ` <BANLkTi=n37vhi63Rh1YRh8uqxZ6cyR65wQ@mail.gmail.com>
     [not found]             ` <4DC2A4E8.7020904@case.edu>
     [not found]               ` <4DC2AFF7.7070007@redhat.com>
2011-05-05 14:15                 ` positional argument bug Eric Blake
2011-05-05 15:47                   ` Oleg Verych
2011-05-05 15:53                     ` Eric Blake [this message]
2011-05-20 23:59                   ` Herbert Xu
2011-05-21  8:53                     ` Harald van Dijk
2011-06-03 21:38                       ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DC2C7EF.3050001@redhat.com \
    --to=eblake@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=olecom@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox