Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Issue trying to save and restore options
- X-seq: zsh-workers 42814
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Alexandre Rames <alexandre.rames@xxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Issue trying to save and restore options
- Date: Wed, 23 May 2018 18:31:13 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Yco5/C YX0TBpBZAbUiegrq7sXxxrNBNouoRMzuREQnM=; b=UkPU9apY8IarDPojbFc99i LYoerKrwPpCN9Px1MvCA2xNpgIlMxuZlg9YJtgIGJMZyQM8+RO9N3XyWJCgmLC7M Etl00Of38fBFbHmL+d5WIZmeKqeLFE7K2DIlgcQFVn5oU2x4SNd0pKEWMPlkG+SC yDs/NH+VWO0ioHFWPvwxvPgaaqjgfL2KJqyawvJqmt1Ejv4M1KcoT+ZYhQZwPNGo V86K8JeNUCtx/ej79mHMVvMxAI8WryNYp9N0rL4AGQnCW84ACjQJqKbPUgJcMDcf BWalXmGRDmd24jR1F8nRzXGCBMaT6pphW12qse+Fds5yPxCxhq3IN79C16PIMBnQ ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Yco5/C YX0TBpBZAbUiegrq7sXxxrNBNouoRMzuREQnM=; b=ASbWX1yHTides+eW86coV5 Pahjs53PB284NdNgChk4rurm5dZIxCrpZhcHGDoME/pY2CUVhkI1kMLokA91dnM2 M2uALSggw7ryINuh6Prz9wmL4pGds3/dJO84h4p9maFR0jmOEgjQtM7E4M/iek4l PNit/+i4p/GIof68iGteYa5RiikzXjf0XPY7cMUK1FEJty9OYWWdp+HwTnn2KXw9 ere4QTldcWNCg5LNmzwQvzQx5AFDmNJ51tQsbK0etdOg1ozDOolZK89BkJK2E9OT Qxx88AgltUVCGOQhc3qCzm7adP2S6yxbV17AM/jnN2T9pR2iEXXfKJVt5P8ZJA6g ==
- In-reply-to: <CALN_81bMvoBiGLikyZDrjVbO0Hxr43-WxtLr7=e7tpJ6z2n4cA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CALN_81bMvoBiGLikyZDrjVbO0Hxr43-WxtLr7=e7tpJ6z2n4cA@mail.gmail.com>
Alexandre Rames wrote on Wed, 23 May 2018 08:54 -0700:
> username% OPTS=$(set +o)
The 'set' runs inside a subshell so it sees different options:
[[[
% set +o >1
% printf '%s' "$(set +o)" >2
% diff 1 2
116c116
< set -o monitor
---
> set +o monitor
177c177
< set -o zle
---
> set +o zle
]]]
(The 'zle' option controls whether the line editor is enabled.)
So, you could try capturing the output of 'set +o' using redirections
rather than command substitutions; that should work and remain shell-
agnostic. (If you want a shell-specific solutions there are other ways,
e.g., check $ZSH_VERSION and then use ${(kv)options} to save the
values.)
As to whether the behaviour of +o in a subshell should be changed, I'll
leave that for others.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author