bug-bash
[Top][All Lists]
Advanced

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

Re: process redirection: syntax error after while loop


From: Chet Ramey
Subject: Re: process redirection: syntax error after while loop
Date: Fri, 23 Jun 2006 16:26:54 -0400
User-agent: Thunderbird 1.5.0.4 (Macintosh/20060530)

Marvin Greenberg wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: cygwin
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc'
> -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H
> -DRECYCLES_PIDS   -I.  -I/tmp/bash-3.1 -I/tmp/bash-3.1/include
> -I/tmp/bash-3.1/lib   -O2
> uname output: CYGWIN_NT-5.1 tom 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
> Machine Type: i686-pc-cygwin
> 
> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
> 
> Description:
>         All these work fine:
>         cat <~/.bash_history
>         cat <(cat ~/.bash_history)
>         while read f; do echo $f; done <~/.bash_history
> 
>     But, this fails:
>        while read f; do echo $f; done <(cat ~/.bash_history)
>        bash: syntax error near unexpected token `<(cat ~/.bash_history)

That's not a redirection; it's process substitution.  Process substitution
is a shell expansion that results in a filename.  Once you realize this,
you should understand why it fails and how you can make it work.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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