|
From: | arnold |
Subject: | Re: [bug-gawk] What is wrong with getline from both stdin and a file from ARGV? |
Date: | Thu, 29 Nov 2018 00:34:27 -0700 |
User-agent: | Heirloom mailx 12.4 7/29/08 |
Peng Yu <address@hidden> wrote: > Why the first getline in the following example read from /dev/fd/63? You have to understand that the <(...) notation is NOT reading from standard input. It's called a "process substitution". The shell sets up a separate pipline with the output on file descriptor 63; it then passes "/dev/fd/63" as a pathname to gawk. Gawk opens that file and gets connected to the pipeline's output. You can see this easily if you turn on execution tracing in the shell: $ set -x $ gawk '{ print FILENAME, $1 ; exit }' <(echo hi there) + gawk '{ print FILENAME, $1 ; exit }' /dev/fd/63 ++ echo hi there /dev/fd/63 hi Reread Andy's notes until you understand them. Arnold
[Prev in Thread] | Current Thread | [Next in Thread] |