Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11405
| From | Linda Walsh <bash@tlinx.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: -e does not take effects in subshell |
| Date | 2015-08-20 17:38 -0700 |
| Message-ID | <mailman.32.1440117504.31004.bug-bash@gnu.org> (permalink) |
| References | (5 earlier) <87mvxo5mme.fsf@igel.home> <55D3B22E.9040507@tlinx.org> <20150819124214.GL4309@eeg.ccf.org> <55D4FBEA.10602@tlinx.org> <55D6693F.5070003@case.edu> |
Chet Ramey wrote: >> The earlier spec had -e only exit a script if a *simple* (external) >> command failed. It didn't include builtins nor functions. > > This is not; builtins and functions are simple commands. --- The builtins are _complex_ binary blobs that replace external commands. Functions are a collection of many commands. They are not a single, simple statement. I remember using their return value in some cases. With the change, I couldn't run a func and have it return the value in $? (1 byte, I know) -- but about 128x as flexible as "ok"/"die" (i.e. any non-zero value triggers the behavior now, but before, it didn't). My simplistic view was that -e was there to auto-exit if an external command failed because they are "out of your control". But if I write a function -- I design the behavior. Even if I designed in a bug -- it's still "my code" that has the problem not some -_e_xternal command ---- cf. perl's option "autodie" -- you can say you want the "open builtin" to just die on errors, then for simple scripts you don't have to put extra code to handle each problem. I.e. -- it's not really something you want in production code, but I write far more throw away quick and dirty scripts than production ones. I tried to write a more complex bash script one time -- that met my expectations. W/o error testing the code was about 150 lines. With error testing and _helpful_ error messages it was over 1000. But that's the difference between quick&dirty vs. production. -e was useful for Q&D, IMO....
Back to gnu.bash.bug | Previous | Next | Find similar
Re: -e does not take effects in subshell Linda Walsh <bash@tlinx.org> - 2015-08-20 17:38 -0700
csiph-web