bugThe GNU Bourne-Again SHell - Bugs: bug #67406, Make set -e to exit on error...

 
 

bug #67406: Make set -e to exit on error default

Submitter:  None
Submitted:  Thu 07 Aug 2025 04:10:31 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Sun 10 Aug 2025 12:28:49 PM UTC, comment #3: 

I actually don't think -e is so bad (A certain poster on these lists calls it "crap", which is clearly OTT), but it should not be the first line of defense against errors.  I think of it as the last resort, after all of the usual error handling is done (most of most shell scripts that deal with user input {i.e., excluding init type scripts} ends up being error handling).

Also, I prefer the modern version (trap handler ERR) over set -e.

But the real point is that this thread shouldn't be about whether or not set -e is a good thing.  It should be about whether or not it should be on by default - to which the answer is a clearcut "no".  But I don't think it is a bad idea to start new code by writing "trap handler ERR".

Anonymous
Thu 07 Aug 2025 04:33:00 PM UTC, comment #2: 

No. The -e option is rarely, if ever, what you want. If you think you want it to apply to your script, execute the script with `bash -e'.

Chet Ramey <chet>
Group administrator
Thu 07 Aug 2025 04:17:04 PM UTC, comment #1: 

No.  That would be a backward-compatibility disaster.

(Plus, set -e has a lot of sharp edges: https://mywiki.wo ... e.org/BashFAQ/105)

Lawrence Velázquez <larryv>
Thu 07 Aug 2025 04:10:31 PM UTC, original submission:  

Shouldn't the set -e flag to enable exit on error be made default
so that it won't execute any further statements and will exit on error by default

Anonymous

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by larryv (Posted a comment)
  •  

    Votes

    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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-08-07 chet StatusNone Invalid

    Back to the top

    Powered by Savane 3.16-598c.
    Corresponding source code