On 9/16/24 4:55 PM, Dan Cross wrote:
I correctly
guessed that only one of thing or otherthing would be printed,
but I was not able to guess if the | or the < would take precedence.
Is there a simple reason why the < has priority over | for the stdin ?
I suppose this depends entirely on the shell; perhaps that is the
point.
POSIX actually speaks on this:
"The standard input, standard output, or both of a command shall be
considered to be assigned by the pipeline before any redirection specified
by redirection operators that are part of the command"
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#t…
In the general case, this is how things like
program 2>&1 | collect_stdout_and_stderr
can work (file descriptor 1 is associated with the pipe before fd 2 is
redirected to it).
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet(a)case.edu
http://tiswww.cwru.edu/~chet/