[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval
From: |
Eric Blake |
Subject: |
Re: eval |
Date: |
Thu, 05 May 2011 08:45:29 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
On 05/05/2011 08:43 AM, Chet Ramey wrote:
>> "The parameter name or symbol can be enclosed in braces, which are
>> optional except for positional parameters with more than one digit or
>> when parameter is followed by a character that could be interpreted as
>> part of the name."
>
> I agree with this interpretation, but the following sentence can be
> interpreted as placing the burden on the shell programmer:
>
> "When a positional parameter with more than one digit is specified, the
> application shall enclose the digits in braces (see Parameter Expansion)."
>
> Still, sh has required the braces since time immemorial. It makes no
> sense that ash would have done it differently
Additionally from POSIX:
"If the parameter name or symbol is not enclosed in braces, the
expansion shall use the longest valid name (see XBD Name)"
Then XBD Name:
"In the shell command language, a word consisting solely of underscores,
digits, and alphabetics from the portable character set. The first
character of a name is not a digit."
In "$10", 10 is not a name, so the longest name after $ is the empty
string, and in place of a name, we use the single-character symbol 1
instead, such that this MUST be parsed as ${1}0, not as ${10}.
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- eval, Rafael Fernandez, 2011/05/05
- Re: eval, Jonathan Nieder, 2011/05/03
- Re: eval, DJ Mills, 2011/05/03
- Re: eval, Rafael Fernandez, 2011/05/05
- Re: eval, Jonathan Nieder, 2011/05/04
- Re: eval, Andreas Schwab, 2011/05/04
- Re: eval, Rafael Fernandez, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval, Eric Blake, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval,
Eric Blake <=
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval, Sven Mascheck, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
Re: eval, Greg Wooledge, 2011/05/04