Syntax check on a valid script with zsh fails even though the script is correct
Issue
- Using
zshto check the script syntax fails as shown below:
$ cat test.sh
#!/bin/zsh
if [[ $# -eq 1 ]]
then
THE_USER=$1
else
THE_USER=$(whoami)
fi
$ zsh -n test.sh
$ echo $?
1
Environment
- Red Hat Enterprise Linux (RHEL) 6.3
- zsh-4.3.10-5.el6.x86_64
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
