[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
access the stdin of the parent process in a pipeline
From: |
Peng Yu |
Subject: |
access the stdin of the parent process in a pipeline |
Date: |
Fri, 20 Mar 2020 22:39:44 -0500 |
Hi,
The following code works.
$ seq 3 | awk -e 'BEGIN { while(getline < "/dev/stdin") print } {
print }' <(seq 4)
1
2
3
1
2
3
4
But the following won't take the data from the stdin of function f.
$ function f { seq 3 | awk -e 'BEGIN { while(getline < "/dev/stdin")
print } { print }' /dev/stdin; }
$ seq 4 | f
1
2
3
What is the correct way to access the parent process stdin in a
pipeline? Thanks.
--
Regards,
Peng
- access the stdin of the parent process in a pipeline,
Peng Yu <=