Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] make 'set +o' useful and POSIX compatible



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.



Messages sorted by: Reverse Date, Date, Thread, Author