[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: redirection after braced block
From: |
clemens fischer |
Subject: |
Re: redirection after braced block |
Date: |
Mon, 05 Oct 2009 19:55:33 +0200 |
User-agent: |
tin/1.9.4-20090211 ("Rieclachan") (UNIX) (Linux/2.6.31.1-spott (i686)) |
Andreas Schwab wrote:
> clemens fischer writes:
>
>> I have the following construct in a script:
>>
>> ... a number of commands
>> {
>> ... a number of commands
>> } 2>&1 | ${prog_log} "${logfile}"
>>
>> It seems anything inside the braces is not seen by bash, and it
>> doesn't show up in a "sh -x ..." trace, but ${prog_log} does. I had
>> debug echo's at the start of the block, they aren't triggered.
>
> The trace goes to stderr, but you've just redirected it.
yeah ok, but the commands really are not executed. I have an option
dry-run in the script, which sets "prog_log=true". Then there are
a bunch of verbose commands in the block, none of get touched.
The fact that I can see the trace on the terminal instead of the logfile
should prove that it shows what bash is actually doing.
In the meantime I upgraded to "version 4.0.33(1)-release
(i686-pc-linux-gnu)", which didn't change anything.
Nonetheless you seem to implicitly confirm what I had originally
planned: the block should execute and both its stdout and stderr should
get piped into the logger.
clemens
Re: redirection after braced block, Chet Ramey, 2009/10/05