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: Wed, 19 Sep 2001 22:48:29 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010701

Paul Jarc wrote:

George Herson <address@hidden> wrote:

Thanks, but why am i still getting zero output?

address@hidden /root]# bash -c 'set -n; . /tmp/tmpscript'
address@hidden /root]# chmod u+x /tmp/tmpscript
address@hidden /root]# bash -n /tmp/tmpscript
address@hidden /root]#


Because with -n, the commands aren't executed.  So bash doesn't notice
if a command doesn't exist.


Should i try a "real" syntax error?  like what?


That should produce an error message.  Try this:
echo (hello


paul



Paul Jarc <address@hidden>



$ 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.

george




reply via email to

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