bug-bash
[Top][All Lists]
Advanced

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

Re: bash drops errexit option in sourced file


From: Robert Schiele
Subject: Re: bash drops errexit option in sourced file
Date: Mon, 3 Dec 2012 16:50:45 +0100

On Mon, Dec 3, 2012 at 4:25 PM, Chet Ramey <address@hidden> wrote:
> Since the `source' command is called in a context where all commands within
> it should have the `errexit' flag disabled, bash chooses to satisfy this
> requirement by turning off the flag that (internally) represents errexit.
> Under most circumstances, however, that state is externally visible as the
> value of the -e option.
>
> Note that the behavior of suppressing the effect of the errexit option is
> correct.  The value of the -e option in $- should be unaffected, though.

Ah, now I start to understand how this is supposed to work. I also
realized that it is not possible within the function to turn on the
flag again with another internal set -e. Is that also part of the
design, meaning there is no way to have an effective set -e within a
function in case it was called in that context?

Robert



reply via email to

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