[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pipe or process substitution
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: pipe or process substitution |
Date: |
Fri, 12 Mar 2021 15:42:25 +0100 |
no idea i dont stack site sorry
if you wanna code further, like with 'read', you cannot pipe, excepts you
put all the bash inline code on the pipe
an example what i mean, made up, not so good, is:
# read v < <( gawk '{ print $2 }' <( printf '1 2 3' ) )
# echo $v
->> 2
# printf '1 2 3' | gawk '{ print $2 }' | read v
# echo $v
->> empty
cause the read on the pipe got spawned instead of not
pipe's fault
a work around is
# printf '1 2 3' | gawk '{ print $2 }' | { read v ; echo $v ; }
they are wild made up examples, actual real world code looks better, more
senseful
On Fri, Mar 12, 2021 at 3:32 PM Pascal <patatetom@gmail.com> wrote:
> I just found this https://unix.stackexchange.com/a/17117.
> according to the explanations given, pipe would be more effective if a
> process substitution is not necessary ?
>
> Le ven. 12 mars 2021 à 11:15, Pascal <patatetom@gmail.com> a écrit :
>
> > hi everybody,
> > which is the better of the two commands below ?
> > strings myfile | grep regexp
> > grep regexp <( strings myfile)
> > regards.
> >
>