[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use of pipe in $(< filename | program) returns null
From: |
pk |
Subject: |
Re: Use of pipe in $(< filename | program) returns null |
Date: |
Sun, 29 Nov 2009 00:22:44 +0000 |
Chet Ramey wrote:
> 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.
Yeah, and then based on that he probably thought that
$(cat file | grep sys)
could be replaced by
$(< file | grep sys)
which is not the case.