bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set -n ruins shell


From: George Herson
Subject: Re: set -n ruins shell
Date: Thu, 20 Sep 2001 09:38:59 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010701

Paul Jarc wrote:

George Herson <gherson@snet.net> wrote:

$ bash -c 'set -n; . /tmp/tmpscript2'
$ bash -n /tmp/tmpscript2
/tmp/tmpscript2: line 1: syntax error near unexpected token `(hello'
/tmp/tmpscript2: line 1: `echo (hello'


Thanks.  The first form didn't have output but the second did.


Oops, right.  The command to source the script doesn't get executed,
because set -n is in effect.


paul



Ok, makes sense.

I expected set -n to not be particular about what errors it disclosed. Many syntax errors appear to interpreters as bad commands, after all. Why wouldn't set -n be coded to disclose all the errors that bash finds in a script? Does set -n have other uses?

george




reply via email to

[Prev in Thread] Current Thread [Next in Thread]