From: "Lawrence Velázquez" <vq@larryv.me>
To: Artur Renault <Artur.Renault@microsoft.com>
Cc: zsh-workers@zsh.org
Subject: Re: bad math expression: illegal character: "
Date: Fri, 5 Jun 2020 17:01:28 -0400 [thread overview]
Message-ID: <17B9983F-268E-469C-9506-D5333528A805@larryv.me> (raw)
In-Reply-To: <DM6PR21MB1515B8DFCBCA1AB1038175EDFA860@DM6PR21MB1515.namprd21.prod.outlook.com>
Hi Artur,
> On Jun 5, 2020, at 2:18 PM, Artur Renault <Artur.Renault@microsoft.com>
> wrote:
>
> Hello zsh maintainers,
>
> I ran into an issue with running a sourced script on zsh.
>
> It’s a simple repro. Take the script repro.sh:
>
> while (( "$#" )); do
> echo $1
> shift
> done
>
> Running this with source gives me the following error:
> [~] source repro.sh 18:15:53
> repro.sh:1: bad math expression: illegal character: "
>
> The same script works fine on bash:
> [~] bash -c "source repro.sh hello" 18:17:23
> hello
>
> Anyone know what the issue could be here?
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.
I can't opine on which interpretation is "better", but you could
avoid the problem by removing the double quotes. Word splitting and
pathname generation are not performed inside ((...)) or $((...)).
vq
next prev parent reply other threads:[~2020-06-05 21:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 18:18 Artur Renault
2020-06-05 21:01 ` Lawrence Velázquez [this message]
2020-06-17 23:21 ` Bart Schaefer
2020-06-18 11:19 ` Mikael Magnusson
2020-06-19 6:38 ` Lawrence Velázquez
2020-06-19 15:35 ` Sebastian Gniazdowski
2020-06-19 15:55 ` Peter Stephenson
2020-06-22 11:11 ` Peter Stephenson
2020-06-23 23:51 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17B9983F-268E-469C-9506-D5333528A805@larryv.me \
--to=vq@larryv.me \
--cc=Artur.Renault@microsoft.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).