[Top][All Lists]

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

Re: Use of pipe in $(< filename | program) returns null

From: Chet Ramey
Subject: Re: Use of pipe in $(< filename | program) returns null
Date: Sat, 28 Nov 2009 11:58:30 -0500
User-agent: Thunderbird (Macintosh/20090812)

address@hidden wrote:

> Description:
>       use of $(< filename | program) does not work. It either should or it 
> should be properly documented.
>       The problem also happens on bash4.
> Repeat-By:
>       qq=$(< /etc/passwd | grep sys)
>       echo $qq
>       # result is null
> Fix:
>       Either fix the docs to tell people that a pipe is not allowed or fix 
> the code to allow it.

That construct is very limited.  As the bash man page says:

The command substitution $(cat file) can be replaced by the equivalent
but faster $(< file).

That seems pretty clear.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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