From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Alexandre Rames <alexandre.rames@uop.re>, zsh-workers@zsh.org
Subject: Re: Issue trying to save and restore options
Date: Wed, 23 May 2018 18:31:13 +0000 [thread overview]
Message-ID: <1527100273.2173650.1382445048.53E74E5C@webmail.messagingengine.com> (raw)
In-Reply-To: <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.
next prev parent reply other threads:[~2018-05-23 18:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 15:54 Alexandre Rames
2018-05-23 18:31 ` Daniel Shahaf [this message]
2018-06-06 18:27 ` Alexandre Rames
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527100273.2173650.1382445048.53E74E5C@webmail.messagingengine.com \
--to=d.s@daniel.shahaf.name \
--cc=alexandre.rames@uop.re \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).