On 1/5/19 2:16 PM, Robert Hailey wrote:
> 
> To the most excellent bash maintainers:
> 
> I have found, what I consider to be a bug, in the following version of
> bash:
> * bash-4.4.23-1.fc28.x86_64
> 
> It is related to this error message:
> * "return: can only `return' from a function or sourced script"

It's not a bug. Bash (and POSIX) make `return' valid only when the shell
is executing a function or sourcing a script.

Bash, in its default mode, considers errors from builtins non-fatal. When
you run this in posix mode, which makes a distinction between "special" and
"regular" builtins, it should be a fatal error because POSIX says a non
interactive shell needs to exit if a special builtin fails. It's a bug in
bash if it doesn't do that in posix mode.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to