[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 2.0.0.23 (Macintosh/20090812) |
root@saturn.syslang.net 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.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/