On 10/2/15 9:22 AM, Greg Wooledge wrote: > On Fri, Oct 02, 2015 at 03:53:42PM +0300, Christoph Gysin wrote: >> I'm still curious as to why set -e is stripped in the first place? > > Chet can give the definitive answer, but my take is that it's a huge > surprise to someone writing a function independent of the script, or > using a function that was written independently of the script.
It's been over 20 years, and we weren't as detailed with our change logs back then, but I imagine the rationale was similar to the above with the addition of something like the following: The parent shell (the one that enabled -e) should be the one to make the decision about whether or not the shell exits. The exit status of the command substitution doesn't make a difference except in one special case, so inheriting errexit and exiting (possibly prematurely) doesn't really help the parent decide whether or not to exit. Now, of course, it's been more than 20 years, and backwards compatiblity is a concern. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/