Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
Message-ID: <56D1A90B.9050006@inlv.org>
Date: Sat, 27 Feb 2016 14:47:55 +0100
From: Martijn Dekker <martijn@inlv.org>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] make 'set +o' useful and POSIX compatible
References: <56D113E0.4090609@inlv.org>
In-Reply-To: <56D113E0.4090609@inlv.org>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 38039

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.

