mainThe GNU Bourne-Again SHell - Support: sr #110302, Feature request: Implement the...


sr #110302: Feature request: Implement the ERR_RETURN option from zsh (see SR #110223)

Submitter:  Timothy Barbour <trb>
Submitted:  Thu 03 Sep 2020 06:30:18 AM UTC
Category:  None Priority:  5 - Normal
Severity:  4 - Important Status:  Postponed
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 03 Sep 2020 06:30:18 AM UTC, original submission:  

If bash had the ERR_RETURN option, it would overcome the fundamental problem described in SR #110223 (, without breaking POSIX compliance (assuming the new option is off by default).

I am raising this as level "4-Important' rather than "1-Wish, because SR #110223 is level 4.

From 'info zsh':


If a command has a non-zero exit status, return immediately from the enclosing function.  The logic is similar to that for ERR_EXIT, except that an implicit return statement is executed instead of an exit.  This will trigger an exit at the outermost level of a non-interactive script.

Normally this option inherits the behaviour of ERR_EXIT that code followed by `&&' `||' does not trigger a return. Hence in the following:

   summit || true

no return is forced as the combined effect always has a zero return status.

Note, however, that if summit in the above example is itself a function, code inside it is considered separately: it may force a return from summit (assuming the option remains set within summit), but not from the enclosing context.  This behaviour is different from ERR_EXIT which is unaffected by function scope.

Timothy Barbour <trb>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by trb (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-17 chet StatusNone Postponed

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code