There are alot of documents and discussion around the file descriptors of shells and how those file descriptors can be manipulated for redirection etc.
My question is, when a shell command is an external program, like
curl etc, do those commands have file descriptors in the same way the shell does?
To give a concrete example, if I run this command at a terminal prompt
% cat << EOF | php <?php echo "hello". PHP_EOL; echo "another line" . PHP_EOL; EOF
I'm assuming the contents of this heredoc are being fed to STDIN, but of which process? the shell, or does
cat have a file descriptor
0 and the contents of the heredoc are being fed to