Great video on stdin vs stdout: https://www.youtube.com/watch?v=OsErpB0-mWY
As a standard your input usually comes from the keyboard. Ex cat file.txt
. <- here you're passing file.txt
as a parameter.
However you can do cat < $file_name
i.e. make the input to the cat
command a variable.
Both cat file.txt
& cat < file.txt
achieve the same, but through different mechanics. <
is passing something as an input.
I suppose it's because the cat
command has abilities to handle file names as arguments and through stdin