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