Operating System - HP-UX
1825950 Members
2924 Online
109690 Solutions
New Discussion

Checking the shell script syntax without running it.

 
SOLVED
Go to solution
sav041329
Occasional Contributor

Checking the shell script syntax without running it.

I would like to know if it is possible to verify the shell script syntax without actually running it?
The man pages for ksh or sh-posix suggest an option "noexec" or "set -n" that can be used to do exactly the same. I tried this without success and it appears to me that noexec and interactive option do not go together
Thanks for your help in advance.
1 REPLY 1
James R. Ferguson
Acclaimed Contributor
Solution

Re: Checking the shell script syntax without running it.

Hi:

# sh -n your_script

...will report syntax errors (if any) but not execute the
Regards!

...JRF...