bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errexit lost in command substitution


From: Stephane Chazelas
Subject: Re: errexit lost in command substitution
Date: Tue, 11 Jan 2005 15:43:49 +0000
User-agent: Mutt/1.5.6i

On Tue, Jan 11, 2005 at 10:05:01AM -0500, Chet Ramey wrote:
> > bash-3.00$ set -e
> > bash-3.00$ echo $-
> > ehimBH
> > bash-3.00$ echo $(echo $-)
> > himBH
> > 
> > (same for set +o)
> > 
> > Bug or feature?
> 
> Feature.  Command substitution has not inherited the -e option for a
> very long time (certainly since before bash-2.0 was released, around
> eight years ago).  In posix mode, the setting is inherited, since that's
> what I interpret POSIX to say.
[...]

Thanks for that.

Is it the only changing?

saved_options=$(
  set +o
  shopt -p
)
[[ -o errexit ]] && saved_options="
$saved_options
set -o errexit"

Can I assume that to correctly backup the current option
setting?

While I'm at it, it seems that the --wordexp option is not
documented.

-- 
Stéphane





reply via email to

[Prev in Thread] Current Thread [Next in Thread]