Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11575
| From | Christoph Gysin <christoph.gysin@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: command substitution is stripping set -e from options |
| Date | 2015-10-02 15:53 +0300 |
| Message-ID | <mailman.275.1443791904.16064.bug-bash@gnu.org> (permalink) |
| References | <CADex794C1jOf0wrB298_O4ohAqZghYUdd9DJcuaOvV1dCP5AOQ@mail.gmail.com> <560D83DA.9020405@redhat.com> <CADex795r=oqZ7iv4TxrjUn9coDUnu=PgPngkfRWA1f7EZyohfA@mail.gmail.com> <20151002122925.GK25574@eeg.ccf.org> |
> Since it's a function, I would recommend return instead of exit. Also, > you don't need the $? there. exit (or return) with no arguments will > retain the exit status of the previous command. Yes, $? is not needed. exit or return is equivalent in this case though because of set -e. > Putting "|| return" or "|| exit" after all critical commands in your > script is precisely what you should do. (Some people write a die() > function and then use "|| die 'my message'" instead.) I consider all commands critical, and if one is allowed to return unsuccessful, I'd rather explicitly allow it with something like: can_fail || : I'm still curious as to why set -e is stripped in the first place? Chris -- echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3
Back to gnu.bash.bug | Previous | Next | Find similar
Re: command substitution is stripping set -e from options Christoph Gysin <christoph.gysin@gmail.com> - 2015-10-02 15:53 +0300
csiph-web