4 ms·
IO redirection doesn't construct a pipe, but piping does. # Open foo.txt and use it as fd 0 in jq <foo.txt jq '[1,2,3]' # Create a pipe(). Use the
by MathMonkeyMan 2y ago
IO redirection doesn't construct a pipe, but piping does.
# Open foo.txt and use it as fd 0 in jq
<foo.txt jq '[1,2,3]'
# Create a pipe(). Use the write end as cat's fd 1 and the read end as jq's fd 0
cat foo.txt | jq '[1,2,3]'
Best thing would be a directed graph where each node is a process or a file. A process has at most one edge going into it (stdin) and at most two coming out (stdout and stderr). A file has exactly one edge touching it.
Hard to do in text, though. Would look like lisp.