Several resources state the file descriptor 0
is connected to the keyboard.
I have learned that echo
does not receive input from stdin
(or 0
).
This feels contradictory to me. When I run echo foo
I'm using the keyboard as a way to pass input to the command. In what sense is stdin
connected to they keyboard that makes it so that there isn't a contradiction here?
echo ...
that isn't done byecho
itself, it's done by the shell, which in this case is getting input from the user's keyboard – Torin May 02 '19 at 12:12/dev/null
. The above descriptions only really come true if the process has a controlling tty and said tty is the stdin, stdout and stderr. – Torin May 02 '19 at 13:11