From owner-freebsd-questions@FreeBSD.ORG Sat Apr 29 00:46:47 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCAB816A406 for ; Sat, 29 Apr 2006 00:46:47 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from mail5.sea5.speakeasy.net (mail5.sea5.speakeasy.net [69.17.117.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 798CF43D48 for ; Sat, 29 Apr 2006 00:46:45 +0000 (GMT) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: (qmail 2842 invoked from network); 29 Apr 2006 00:46:45 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 29 Apr 2006 00:46:44 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id 2C47228425; Fri, 28 Apr 2006 20:46:44 -0400 (EDT) Sender: lowell@be-well.ilk.org To: Martin McCormick References: <200604281634.k3SGYNhn093282@dc.cis.okstate.edu> From: Lowell Gilbert Date: 28 Apr 2006 20:46:43 -0400 In-Reply-To: <200604281634.k3SGYNhn093282@dc.cis.okstate.edu> Message-ID: <44psj1dx8s.fsf@be-well.ilk.org> Lines: 19 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: Bourn Shell -n Flag Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2006 00:46:47 -0000 Martin McCormick 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.