[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use of |&
From: |
alex xmb ratchev |
Subject: |
Re: Use of |& |
Date: |
Mon, 13 Feb 2023 16:42:54 +0100 |
root@localhost:~# gawk -f p.2
a
becc
root@localhost:~# cat p.2
#!/usr/bin/gawk -f
BEGIN {
cmd = "exec bash -c 'printf a\\\\n ; read -r a ; printf %s\\\\n \"$a\"'"
cmd |& getline
print
print "becc" |& cmd
cmd |& getline
print
}
On Mon, Feb 13, 2023, 4:32 PM alex xmb ratchev <fxmbsw7@gmail.com> wrote:
>
>
> On Mon, Feb 13, 2023, 4:22 PM goncholden via <help-bash@gnu.org> wrote:
>
>> Have been using awk in a bash script.
>>
>> Have seen the use of "|&" rather than the usual "|". What is the reason
>> for using
>>
>> "|&" exactly ?
>>
>
> | is like a one way pipe , |& makes a coproc ( two way pipe , in and out )
>
> command |& getline info
>>
>> command | getline info
>
>