<p>Is it possible to check a bash script syntax without executing it?</p>

<p>Using Perl, I can run <code>perl -c 'script name'</code>. Is there any equivalent command for bash scripts?</p>

```
```
bash -n scriptname
```
```
Perhaps an obvious caveat: this validates syntax but won't check if your bash script tries to execute a command that isn't in your path, like
```
ech hello
```
instead of
```
echo hello
```
.