Skip to content

bash/zsh-syntax

Checks the syntax of Zsh scripts with zsh -n.

Part of the bash configuration, at the recommended level. It runs at the commit stage, per file. It runs zsh.

Zsh syntax differs from Bash, so a Bash parser rejects valid Zsh programs.

Fix the syntax at the line Zsh reports. Install zsh when the system lacks it.

In a Zsh script, if then has no condition. Write a real test, such as if [[ -f "$file" ]]; then print -r -- "$file"; fi.

Turn it off for some files, or one of its lint rules, with a reason:

gspot ignore bash/zsh-syntax --paths "<glob>" --reason "<why>"
gspot ignore bash/zsh-syntax --rule <rule> --reason "<why>"