[Help-bash] How not to wait for the input finishes if a program does not
From:
ehsan ramezani
Subject:
[Help-bash] How not to wait for the input finishes if a program does not need to see all the input?
Date:
Fri, 25 Mar 2016 16:44:24 -0500
Hi,
If one runs the following examples, both head and awk will wait until `sleep`
is finished.
(echo 1; sleep 10; seq 10) | head -n 1
(echo 1; sleep 10; seq 10) | awk -e 'NR==1{print $1;exit}'
However, they only need the output from the first echo command. It is
unnecessary that they wait until `sleep` is finished. I am wondering if this
problem is related with the shell or the programs head/awk.
How one might let head and awk finish as soon as they see the first line?
Thanks in advance.
Best regards,
Ehsan
[Prev in Thread]
Current Thread
[Next in Thread]
[Help-bash] How not to wait for the input finishes if a program does not need to see all the input?,
ehsan ramezani<=