bug-bash
[Top][All Lists]
Advanced

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

Re: Code Execution in Mathematical Context


From: David
Subject: Re: Code Execution in Mathematical Context
Date: Thu, 6 Jun 2019 11:33:56 +1000

On Thu, 6 Jun 2019 at 03:40, Ilkka Virta <itvirta@iki.fi> wrote:
> On 5.6. 17:05, Chet Ramey wrote:
> > On 6/4/19 3:26 PM, Ilkka Virta wrote:
>
> >>    $ echo "$(( 'a[2]' ))"
> >>    bash: 'a[2]' : syntax error: operand expected (error token is "'a[2]' ")
> >
> > The expression between the parens is treated as if it were within double
> > quotes, where single quotes are not special.
>
> I did put the double-quotes around the $((...))

Hi Ilkka Virta

In case of any confusion...

Please note no-one is talking about putting double quotes around $((...))
which would be "$((...))"

Regarding $((...)) when Chet refers above to "the expression between the parens"
he means whatever is between the parentheses, in this case the three dots.

If I understand correctly, Chet is saying there that $((...)) is
parsed as if it was written
$(("...")) and therefore any single quotes inside the parentheses are
not special.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]