Re: Command substition failure?

2011-04-02 Thread Chet Ramey
On 4/2/11 3:59 PM, Michael Witten wrote: > Thus, bash has a bug. > > My guess is the nature of the problem is that the combination > of the outer-most quotes (which would render most characters > as literal) and the command substitution (which in some sense > is probably parsed in a `top-level' c

bash trap techniques for group-command in a pipeline

2011-04-02 Thread john.ruckstuhl
Summary: I don't see the best way to (in bash) trap/handle an ERR inside a group-command "{}" that is in a pipeline. I have a way that seems to work, see "(F)", but little confidence that it's the best way, and some suspicion that the overall effort is misguided. Detail: I'd like to trap and hand

Re: Command substition failure?

2011-04-02 Thread Michael Witten
On Sat, 02 Apr 2011 15:20:23 +0200, Andreas Schwab wrote: >> Could somebody please tell me what's going on here? > > Brace expansion. > > $ set -x > $ echo "$(echo '"' | awk '{sub(/a/,$0)}')" > ++ echo '"' > ++ awk 'sub(/a/' > awk: cmd. line:1: sub(/a/ > awk: cmd. line:1:^ unexpected newli

Re: Command substition failure?

2011-04-02 Thread Michael Witten
On Sat, Apr 2, 2011 at 08:20, Andreas Schwab wrote: > Brace expansion. HAH! :-D Damn :-/

Re: Command substition failure?

2011-04-02 Thread Andreas Schwab
Michael Witten writes: > Could somebody please tell me what's going on here? Brace expansion. $ set -x $ echo "$(echo '"' | awk '{sub(/a/,$0)}')" ++ echo '"' ++ awk 'sub(/a/' awk: cmd. line:1: sub(/a/ awk: cmd. line:1:^ unexpected newline or end of string ++ echo '"' ++ awk '$0)' awk: $

Command substition failure?

2011-04-02 Thread Michael Witten
Could somebody please tell me what's going on here? First, here is a minimal example: LINE| | $ echo "$(echo '"' | awk '{sub(/a/,$0)}')" 0001| awk: cmd. line:1: sub(/a/ 0002| awk: cmd. line:1:^ unexpected newline or end of string 0003| awk: $0) 0004| awk: ^ syntax error