bug-bash
[Top][All Lists]
Advanced

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

Re: set -n ruins shell


From: Paul Jarc
Subject: Re: set -n ruins shell
Date: Wed, 19 Sep 2001 17:37:41 -0400
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7

George Herson <gherson@snet.net> wrote:
> Chet Ramey wrote:
>>>How can i use set -n to check scripts?  It fails with a script argument.
>>>
>> `bash -n scriptname'
>
> Has the same problem as when I run w/o an argument, as i've said
> twice before.

What problem is that?

> [root@geodollar /root]# cat > /tmp/tmpscript
> echo "hello"
> echobad
> [root@geodollar /root]# bash -c "set -n /tmp/tmpscript"  # line 2

This sets the -n flag, and then sets $1 to "/tmp/tmpscript".  If you
want to set the -n flag, and then source the script, do this:
bash -c 'set -n; . /tmp/tmpscript'

> tmpscript has a syntax error so why didn't I get any output from line 2?

It's not a syntax error, it's just a nonexistent command.  But you
didn't get an error message because you didn't tell bash to run the
script.


paul



reply via email to

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