Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there some option I can give to just check the syntax of a [bash] shell script to check the syntax of it, but not actually execute anything nor cause any potential damage?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

From the bash(1) man page:

-n      Read commands but do not execute them. This may be used to check a
        shell script for syntax errors. This is ignored by interactive shells.
share|improve this answer
    
Obviously. I don’t know why I was so blind that I couldn’t see this when I was through the manual pages. –  Aeyoun May 25 '11 at 21:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.