From: Filip Krska <fkrska@redhat.com>
To: zsh-workers@zsh.org
Subject: zsh syntax check fails on correct if [[ usage (rhbz 966911)
Date: Fri, 18 Oct 2013 16:02:42 +0200 [thread overview]
Message-ID: <52613F82.1000009@redhat.com> (raw)
Hello zsh team,
I'd like to report a bug originally filed in
https://bugzilla.redhat.com/show_bug.cgi?id=966911:
Description of problem:
zsh syntax check fails on simple script, which is syntactically OK, but zsh -n returns 1
Version-Release number of selected component (if applicable):
zsh-4.3.10-5.el6.x86_64
How reproducible:
always
Steps to Reproduce:
1. create a script
$ cat /tmp/test.zsh
#!/bin/zsh
if [[ $# -eq 1 ]]
then
THE_USER=$1
else
THE_USER=$(whoami)
fi
2. execute test
$ zsh -n /tmp/test.zsh
3. observe exit value
$ echo $?
1
Actual results:
1
Expected results:
0
Additional info:
Upstream zsh-5.0.0, zsh-5.0.2 behaves the same way.
The exitvalue is 0 if we provide exactly one argument:
$ zsh -n /tmp/test.zsh
$ echo $?
1
$ zsh -n /tmp/test.zsh aaa
$ echo $?
0
$ zsh -n /tmp/test.zsh aaa ddd
$ echo $?
1
The exitvalue is 0 if we add one line e.g.:
$ cat /tmp/test.zsh
#!/bin/zsh
if [[ $# -eq 1 ]]
then
:
THE_USER=$1
else
THE_USER=$(whoami)
fi
or if we don't use $(command) construct in `else` branch.
If '[' test instead of '[[' is used, the syntax check returns OK,
however '[[' syntax is recommended by manual, so the check should work
as expected for '[[' as well.
Thanks and Regards
Filip
--
Filip Krška
GSS-SEG EMEA engineer, #sbr-shells (pri), #sbr-anaconda (sec)
Red Hat Czech s.r.o.
Purkyňova 99/71
612 45, Brno, Czech Republic
email:fkrska@redhat.com
office phone:+420 5322 94499
♡ All Wrongs Reversed
http://copyheart.org
next reply other threads:[~2013-10-18 14:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-18 14:02 Filip Krska [this message]
2013-10-18 15:33 ` Peter Stephenson
2013-10-18 19:12 ` Peter Stephenson
2013-10-18 15:48 ` Bart Schaefer
2013-10-18 15:56 ` Peter Stephenson
2013-10-18 19:20 ` Bart Schaefer
2013-10-18 22:43 ` Peter Stephenson
2013-10-19 21:19 ` Bart Schaefer
2013-10-19 21:46 ` Bart Schaefer
2013-10-19 21:56 ` Peter Stephenson
2013-11-20 14:08 ` Filip Krska
2013-10-18 19:29 ` Peter Stephenson
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=52613F82.1000009@redhat.com \
--to=fkrska@redhat.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).