[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: when output of <( ... ) is stored in function argument, it can be us
From: |
Tapani Tarvainen |
Subject: |
Re: when output of <( ... ) is stored in function argument, it can be used only once - why? |
Date: |
Tue, 24 Jan 2023 10:33:47 +0200 |
On Tue, Jan 24, 2023 at 09:23:37AM +0100, Ante Bilandzic (abilandzic@gmail.com)
wrote:
> $ what(){ wc -l $1; wc -l $1; }; what <(ls)
> 18 /dev/fd/63
> 0 /dev/fd/63
>
> In my particular case, 18 is the correct number of lines in the output of
> <(ls). Why the 2nd and identical execution of 'wc -l' doesn't also get it
> right?
Think of it as a pipe: the $1 reads ls output, using it again
does not redo the command. After the first wc read all of
the ls output, there's nothing left for the second one.
--
Tapani Tarvainen