On 8/29/18 2:18 AM, Allan McRae wrote:
On 29/08/18 15:20, Eli Schwartz wrote:
On 8/29/18 12:54 AM, Allan McRae wrote:
My understanding is this does not quite do the same thing... "local -" only save the single-letter shell options. There are set options that do not have a single letter variants (although they are unlikely to be used...).
The manpage does not indicate this; it just says:
the set of shell options is made local to the function in which local is invoked: shell options changed using the set builtin inside the function are restored to their original values when the function returns.
I was going off the bash-4.4 release notes.
Hmm, weird. :D
So...
$ testfunc() { shopt -p -o pipefail; local -; set -o pipefail; shopt -p -o pipefail; } $ testfunc; shopt -p -o pipefail set +o pipefail set -o pipefail set +o pipefail
Seems to work okay, fortunately.
Great. Patch is fine then. I'll adjust the comment to "localize set options" as "localize sets" is not clear.
No problem. -- Eli Schwartz Bug Wrangler and Trusted User