Operating System - HP-UX
1834637 Members
2568 Online
110069 Solutions
New Discussion

Re: 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...