Re: positional argument bug

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

 



On 05/05/2011 09:47 AM, Oleg Verych wrote:
> 2011/5/5 Eric Blake <eblake@xxxxxxxxxx>:
>> [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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux