Re:Show HN: A pure bash web server. No netcat, socat, etc.
by arbitrage on Tuesday January 04, 2022 @01:36PM
(#29798255)
The difference is in the first code example, you're launching both cat and nc.
In the second block, you're just launching one program that reads input, not two. It's slightly more efficient.
I also tend to build large *NIX pipelines using `cat $foo | [...]`, but it's some times regarded as bad form. See: "useless use of cat" for more examples.
I always use the pipe, it is intuitive to me to think left-to-right, output of this becomes input of next. But I always see stackoverflow answers using the other approach.