[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Option execfail does not work in subshells
From: |
doark |
Subject: |
Re: [Help-bash] Option execfail does not work in subshells |
Date: |
Wed, 9 Aug 2017 13:50:26 -0400 |
On Tue, 8 Aug 2017 17:04:12 +0200
"R. Diez" <address@hidden> wrote:
>
> > `execfail' only works when the shell is interactive. Subshells are
> > not considered interactive shells.
>
> But that is not what the documentation says:
>
> -----8<-----8<-----8<-----
> execfail
>
> If this is set, a non-interactive shell will not exit if it cannot
> execute the file specified as an argument to the exec builtin command.
> An interactive shell does not exit if exec fails.
> -----8<-----8<-----8<-----
<snip>
Notice that the two statements above are similar but not the *same*.
> If this is set, a non-interactive shell will not exit if it cannot
> execute the file specified as an argument to the exec builtin command.
See the word "file", it's not equivalent to the word "function"[1].
Notice also that exec could fail for other reasons which are not listed
above but also not covered.
> An interactive shell does not exit if exec fails.
OTOH, an interactive shell would not exit if, for *any* reason exec fails.
What confuses me is why the word "builtin" is used in terms of exec in
the non-interactive case, whereas it is not used in the interactive case.
Perhaps bash needs some form of control over the function that could not
be achieved using a file.
Sincerely,
David
[1] Technically, calling a file and a function in sh should be identical,
but this is probably a side case.