[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash-4.0: parser complains on `|& {}' statement
From: |
Chet Ramey |
Subject: |
Re: bash-4.0: parser complains on `|& {}' statement |
Date: |
Wed, 25 Feb 2009 17:29:51 -0500 |
User-agent: |
Thunderbird 2.0.0.19 (Macintosh/20081209) |
Evgeniy Zhemchugov wrote:
> Configuration Information
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
> -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include
> -I./lib -march=nocona -O2 -pipe -mtune=generic
> uname output: Linux LFS 2.6.25.17 #7 SMP PREEMPT Tue Jan 20 22:40:20
> MSK 2009 x86_64 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz
> GenuineIntel GNU/Linux
> Machine Type: x86_64-unknown-linux-gnu
>
> Bash Version: 4.0
> Patch Level: 0
> Release Status: release
>
> Description:
> Look at the following bash session:
>
> $ { echo a; } |& { read a; echo "read: $a"; }
> bash: syntax error near unexpected token `}'
>
> Expected behavior:
>
> $ { echo a; } |& { read a; echo "read: $a"; }
> read: a
>
> It works correctly with `2>&1 |' instead of `|&' or when the
> right side does not contain braces. For example:
>
> $ f() { read a; echo "read: $a"; }
> $ { echo a; } |& f
> read: a
Try the attached patch; it works for me.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
--- parse.y 2009-02-25 17:25:56.000000000 -0500
***************
*** 4450,4453 ****
--- 4457,4461 ----
case AND_AND:
case BANG:
+ case BAR_AND:
case DO:
case DONE: