Subject: Re: [PATCH] make 'set +o' useful and POSIX compatible
From: Martijn Dekker <[email-masked]>
To: Zsh hackers list <[email-masked]>
Date: Sat, 27 Feb 2016 14:47:55 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Martijn Dekker schreef op 27-02-16 om 04:11:
> That means it should be possible to do
> 
>         save_options=$(set +o)
> 
> then change some options, then later restore the shell options with
> 
>         eval "$save_options"

Hmm. There is still a problem with this.

Two options are turned off in subshells, so the command substitution
subshell $(set +o) will not store the output you want.

$ set +o >1
$ (set +o) >2
$ diff 1 2
116c116
< set -o monitor
---
> set +o monitor
177c177
< set -o zle
---
> set +o zle

This only seems to be relevant on interactive shells though, as
'monitor' and 'zle' are turned off in scripts.

- M.