Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
dangerous behavior of while in zsh 5.6 ?
- X-seq: zsh-users 23695
- From: Marc Chantreux <eiro@xxxxxxxxx>
- Subject: dangerous behavior of while in zsh 5.6 ?
- Date: Wed, 3 Oct 2018 16:38:00 +0200
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org DC60E10699
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1538577484; bh=kunRtwN2Vc0CzhSSNcbTzTLcd/yLqZfJCLX4Q6LVTpw=; h=Date:From:Cc:Subject:From; b=AnKOjsUcHtlrV2tmjuidlUF8boPdc5zO5PMQ+wfOkzCQqj0umZioAsjafenFG6JYc dpnlYytKMhndWeUmAclIZKuWhHk1ks+vHjEJch/1gDA2RRcJDqXxJyqOdzScA7e9pM vG0u89hDbvGUA8Sh7S93OvqUuUVBnAe4Z2qxldktkCSmfeOdTpR+hnUTHrwrLz7GoV IL9IJr3OqEdEM3dmt+icoy7pSTxFRT1aVFJhhnlc9Zhb74JfXvfcl2JPNPw71FlvJG 5qmn1dlgxxJVylPhL8DNiQ6RSbJk5GAUyMcsjDwQO8ADChLAlr0lzvJ2hNFz/YjQB8 N8tDiN+BzZQaw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
hello people,
i switched to 5.6.2 and was really happy to see the
improvement of the alternative syntax.
thank you so much zsh-workers! i mean it! zsh is just awesome.
but there is an inconsistency in the behaviour that
is very dangerous and hard to easily spot in a large script:
a end of line after a condition is interpreted as an empty
true block so:
while (( i-- ))
print $i
should mean:
while (( i-- )) {print $i}
actually mean:
while (( i-- )) {:}
print $i
so it doesn't behave like the other loops:
repeat 5 print $[i++]
while (( i-- )) print $i
works ...
repeat 5
print $[i++]
while (( i-- )) print $i
works ...
repeat 5
print $[i++]
while (( i-- ))
print $i
infinite loop. i think it's a bug. not sure :)
regards,
marc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author