|
From: | Peng Yu |
Subject: | Re: access the stdin of the parent process in a pipeline |
Date: | Wed, 25 Mar 2020 07:45:26 -0500 |
> function g1 { > seq 3 | awk -e 'BEGIN { while(getline < "/dev/stdin") print } { > print }' /dev/fd/4 > } 4<&0 > > $ seq 4 | g1 > 1 > 2 > 3 > 1 > 2 > 3 > 4 I never knew that I could add redirection after the function declaration. This is neat. -- Regards, Peng
[Prev in Thread] | Current Thread | [Next in Thread] |