Skip site navigation (1)Skip section navigation (2)
Date:      28 Apr 2006 20:46:43 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        Martin McCormick <martin@dc.cis.okstate.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Bourn Shell -n Flag Questions
Message-ID:  <44psj1dx8s.fsf@be-well.ilk.org>
In-Reply-To: <200604281634.k3SGYNhn093282@dc.cis.okstate.edu>
References:  <200604281634.k3SGYNhn093282@dc.cis.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Martin McCormick <martin@dc.cis.okstate.edu> writes:

> 	I read about the noexecute flag or -n flag which is supposed
> to check the syntax of a Bourn Shell script to see what it would do if
> run, but not actually do anything.  This sounds like a wonderful
> thing, especially when one is going to run a dangerous script and you
> only get one chance to get it right.
> 
> 	I tried sh -n scriptname and it always silently succeeds even
> if I type sh -x -n somescript.  I even deliberately created a script
> with a syntax error in it and tried sh -x -n again.  It still did
> nothing but exit.  Does this just not work or am I misunderstanding
> the purpose of the flag?

I don't know where you checked the syntax of the Bourne Shell, but
FreeBSD's /bin/sh (which although not actually derived from Steve
Bourne's code does a pretty good job of covering the POSIX
requirements for sh, and a bunch of useful additions as well) is
specific to noninteractive use.  According to its manual, anyway.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44psj1dx8s.fsf>