From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17278 invoked from network); 5 Jun 2020 21:02:21 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 5 Jun 2020 21:02:21 -0000 Received: (qmail 11724 invoked by alias); 5 Jun 2020 21:02:15 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45990 Received: (qmail 13796 invoked by uid 1010); 5 Jun 2020 21:02:14 -0000 X-Qmail-Scanner-Diagnostics: from out5-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(66.111.4.29):SA:0(-2.7/5.0):. Processed in 4.078232 secs); 05 Jun 2020 21:02:14 -0000 X-Envelope-From: vq@larryv.me X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.29 as permitted sender) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudegfedgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefnrgif rhgvnhgtvggpgggvlhojiihquhgviicuoehvqheslhgrrhhrhihvrdhmvgeqnecuggftrf grthhtvghrnhepudekjedtleehvdduhfevleegteffteekhedvheejteelffdvgedtjedv ueeugeeinecukfhppedutddtrdduvddrudekgedrvdegieenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg X-ME-Proxy: Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: bad math expression: illegal character: " From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= In-Reply-To: Date: Fri, 5 Jun 2020 17:01:28 -0400 Cc: zsh-workers@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: <17B9983F-268E-469C-9506-D5333528A805@larryv.me> References: To: Artur Renault X-Mailer: Apple Mail (2.3445.104.14) Hi Artur, > On Jun 5, 2020, at 2:18 PM, Artur Renault = > wrote: >=20 > Hello zsh maintainers, >=20 > I ran into an issue with running a sourced script on zsh. >=20 > It=E2=80=99s a simple repro. Take the script repro.sh: >=20 > while (( "$#" )); do > echo $1 > shift > done >=20 > Running this with source gives me the following error: > [~] source repro.sh = 18:15:53 > repro.sh:1: bad math expression: illegal character: " >=20 > The same script works fine on bash: > [~] bash -c "source repro.sh hello" = 18:17:23 > hello >=20 > 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=