bug-bash
[Top][All Lists]
Advanced

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

Re: Command substitution and errexit


From: Nikolai Kondrashov
Subject: Re: Command substitution and errexit
Date: Tue, 16 Oct 2012 15:28:37 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7

On 10/16/2012 03:16 PM, Greg Wooledge wrote:
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"

That would do nicely, thanks Greg!

However, is this as supposed to be? Because, if it's not, or there is no
certainty, I'd rather not use it.

Thanks.

Sincerely,
Nick



reply via email to

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