[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quote removal not performed in arithmetic expansion
From: |
Paul Jarc |
Subject: |
Re: quote removal not performed in arithmetic expansion |
Date: |
Fri, 06 Jun 2003 14:35:50 -0400 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
cpr@cwru.edu wrote:
>> echo $((1+'1'))
>> echo $((1+"1"))
>> echo $((1+\1))
>>
>> all result in syntax errors.
>
> As they all should.
Solaris ksh accepts them.
>> The expression shall be treated as if it were in
>> double-quotes, except that a double-quote inside the
>> expression is not treated specially. The shell shall expand
>> all tokens in the expression for parameter expansion, command
>> substitution, and quote removal.
This seems contradictory: the first sentence seems to imply that quote
removal should not happen, since it doesn't happen inside double
quotes. But the second sentence says that quote removal should
happen. So maybe the first sentence is intended to mean that some
other effect of double quotes should take effect here. It could
certainly be clearer.
> Quote removal removes *unquoted* instances of `/', `'', and `"'.
By your interpretation, all quote characters are (effectively) quoted
in arithmetic expressions, making quote removal a no-op. So why would
POSIX say that quote removal should be performed? I think the intent
is that these quotes should be removed.
paul