News for hackers. Stuff that matters.
Re:PSA about abuse of cat(1) command. Don't abuse cats by hn_throwaway_99 on Friday July 17, 2026 @11:26PM (#48954921)
Yeah, I read TFA, and my eyes were rolling the whole time. Some people really have a bee in their bonnet that "cat" is named that way because it was originally for concatenating files. Nobody fucking cares. It's the standard way for writing a file to standard out, and the general pattern of "cat file.txt | somecommand | othercommand | anothercommand" is so useful because it follows the pipeline pattern so well - read from standard in, write to standard out - that is the cornerstone of Unix shell commands IMO.

"Oh no, it spawns another process!!" Again, nobody cares.

Re:PSA about abuse of cat(1) command. Don't abuse cats by adrian_b on Saturday July 18, 2026 @12:37AM (#48955266)
The simpler and better way to write your pipeline is:

"< file.txt somecommand | othercommand | anothercommand"

There is never any need for "cat".

When such a pipeline is used repeatedly in a script, the time for executing the redundant process "cat" can easily add up to a noticeable delay.

Re:PSA about abuse of cat(1) command. Don't abuse cats by mcphage on Saturday July 18, 2026 @09:25AM (#48957970)
That’s neither simpler, nor better.

> "cat" can easily add up to a noticeable delay.

If you have a slow script, you will have more useful places to optimize than removing calls to cat.