# bash/zsh-syntax

> Checks the syntax of Zsh scripts with `zsh -n`.

Checks the syntax of Zsh scripts with `zsh -n`.

Part of the [`bash`](/reference/configurations/bash/) configuration, at the `recommended` [level](/start/concepts/#levels). It runs at the `commit` [stage](/start/concepts/#stage), per file. It runs zsh.

## Why

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

## What to do

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

## Example

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

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

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