Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bad math expression: illegal character: "



On 6/18/20, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Jun 5, 2020 at 2:02 PM Lawrence Velázquez <vq@xxxxxxxxx> wrote:
>>
>> > On Jun 5, 2020, at 2:18 PM, Artur Renault <Artur.Renault@xxxxxxxxxxxxx>
>> >
>> > while (( "$#" )); do
>> >
>> > repro.sh:1: bad math expression: illegal character: "
>>
>> For what it's worth, dash also rejects this. I assume that it and
>> zsh are just more strict about what constitutes a math expression.
>
> Does anybody know if this is something we should change for sh
> emulation, or is it merely another unspecified POSIX corner-case?

If this is a POSIX requirement, it must have been very specific about
when quotes should be allowed (bash):

$ (( "0" )); echo $?
1
$ echo $(( "0" ))
bash: "0" : syntax error: operand expected (error token is ""0" ")


-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author