Can anyone tell me the difference? for example:
if I have a file a.txt with the following content:
a
b
c
what would be the difference between cat a.txt | cat and cat < a.txt
It seems to me that they all simulate STDIN, is that correct, or are there differences? Thanks a lot.
Piping works from one process to another (the
cats in the first example), and hence requires two processes cooperating. Redirection is handled by the shell itself. This can matter when doing things in the shell such as working with variables.