bug-bash
[Top][All Lists]
Advanced

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

Re: set -e (no || or &&)


From: Linda Walsh
Subject: Re: set -e (no || or &&)
Date: Tue, 16 Oct 2012 18:49:12 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666

Dan Douglas wrote:
On Sunday, October 14, 2012 05:21:05 PM Linda Walsh wrote:
Seriously -- why not just fix it?

If you think it is broken -- Fix it.

This should fix most scripts.

case $- in
    *e*) exec /bin/sh -c 'cat; rm -f "$1"; exit 1' -- "$BASH_SOURCE" <<-"EOF" 
>&2
    Error: Braindamage detected. Protecting your system.
EOF
esac
----
        So, since Steven wanted something to work for all scripts,
are you suggesting that line be added to an internal-to-bash script
that would be called for all scripts?

(Of course not ... the point for Steven was to have it 'fixed' in one
place...I would think so as well

However this is caca doo doo:
Greg Wooledge wrote:
On Sun, Oct 14, 2012 at 05:21:05PM -0700, Linda Walsh wrote:
Seriously -- why not just fix it?

Because POSIX has specified that it must be present, and that it must
work in certain ways.
---
That's "nice"... if the user runs with the --posix switch, then they can get
whatever behavior posix requires.  That doesn't mean the entire implementation
needs to be saddled with some mandated worthlessness.

I found it alot more useful before the changes in 4.x when the wording for
exits was "simple command"... (which didn't include builtins).  But if someone
else were to come up with a more useful solution that's fine too.  Maybe
have it call something akin to an error TRAP, where an error could be ignored
or cause script termination...

But there was no requirement to change the non-posix operational mode of
"-e".  So plueez, don't pull the posix line...




reply via email to

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