[Top][All Lists]

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

Re: Command substitution and errexit

From: Greg Wooledge
Subject: Re: Command substitution and errexit
Date: Tue, 16 Oct 2012 08:16:39 -0400
User-agent: Mutt/

On Mon, Oct 15, 2012 at 08:08:10PM -0400, DJ Mills wrote:
> done < <(set -o)

Huh... that's interesting.  I wouldn't have expected it, but it turns
out you don't "lose" the value of errexit in a process substitution the
way you do in a command substitution.

imadev:~$ bash -c 'set -e; x=$(set +o); grep errexit <<<"$x"'
set +o errexit
imadev:~$ bash -c 'set -e; grep errexit <(set +o)'
set -o errexit

So, assuming Nikolai still wants to go with his current design, I guess
he could use code like this:

read -rd '' settings < <(set +o)
eval "$settings"

reply via email to

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