[Top][All Lists]

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

redirection after braced block

From: clemens fischer
Subject: redirection after braced block
Date: Mon, 05 Oct 2009 18:11:07 +0200
User-agent: tin/1.9.4-20090211 ("Rieclachan") (UNIX) (Linux/ (i686))

'uname -rims'
Linux i686 AuthenticAMD

'bash --version'
GNU bash, version 4.0.24(1)-release (i686-pc-linux-gnu)

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 shell options right before entering the block are:

  cmdhist         on
  extglob         on
  extquote        on
  force_fignore   on
  hostcomplete    on
  interactive_comments    on
  progcomp        on
  promptvars      on
  sourcepath      on

Removing the redirection makes it work:

  ... a number of commands
      ... a number of commands
  } | ${prog_log} "${logfile}"

but it changes the semantics of my script and causes problems.  I could
not isolate the offender, the construct works from the command line:

  $ {
  echo mist; echo mast >&2
  } 2>&1 | cat -t

I do not even know how to debug or reproduce it in five lines ...


reply via email to

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