On Sun, Mar 06, 2016 at 10:56:45AM +0100, Martin Natano wrote:
> On Sun, Mar 06, 2016 at 05:32:16AM +0100, Martijn Dekker wrote:
> > The command 'set -o' shows the current shell options in an unspecified
> > format. Less well-known is the variant 'set +o', which should output the
> > current shell options "in a format that is suitable for reinput to the
> > shell as commands that achieve the same options settings".[*]
> > 
> > That means it should be possible to do something like
> > 
> >         save_options=$(set +o)
> > 
> > then change some options, then later restore the shell options with
> > 
> >         eval "$save_options"
> > 
> > On all pdksh variants (as well as zsh), 'set +o' is currently inadequate
> > for that purpose because it only outputs the currently active shell
> > options, and not the inactive ones.
> > 
> > Even the old ksh88, which pdksh is a clone of (and on which most of
> > POSIX is based), acts correctly in this regard.
> > 
> > This simple patch makes 'set +o' compatible with the POSIX spec.
> 
> Makes sense to me. However, I'm somewhat concerned this might break
> existing shell scripts. Anyone here have a script that would break with
> this change? Or a script that relies on POSIX behaviour and gets fixed
> with this diff?
> 
> natano

As far as I can tell, at least in our tree I found no scripts that use that
functionality.

Reply via email to