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

Issue trying to save and restore options



Hello,

As part of a script, I was trying to save and restore options in a shell-agnostic way. The goal is to write

```
# Save options.
set -x
# Modify other options.
# Do stuff.
# Restore options
```

Googling, I came across this stack overflow answer, suggesting the use of `set +o`.
However this gives me unexpected results

% zsh --no-globalrcs --no-rcs
username% zsh --version
zsh 5.5.1 (x86_64-apple-darwin17.5.0)
username% set +o
set +o noaliases
# More option lines. See full log attached.
set -o zle
username% OPTS=$(set +o)
# Hitting Ctrl-C works as expected
username%
username%
username% eval "$OPTS"
# Hitting Ctrl-C now does not behave as expected
username% ^C^C^C

The same thing works in `bash` though.
Does someone know if that is expected to work? Is that a known issue with zsh?

Alexandre

Attachment: log
Description: Binary data



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