Hacker News new | ask | show | jobs
by jeremy_wiebe 1194 days ago
I’ve run across comments regarding useless use of cat twice today. However, after reading the linked Wikipedia entry, it feels more like a way to give someone an ego trip than a truly more useful alternative.

The Wikipedia article even concedes that cat might be better:

> A cat written with UUOC might still be preferred for readability reasons, as reading a piped stream left-to-right might be easier to conceptualize.[10] Also, one wrong use of the redirection symbol ">" instead of "<" (often adjacent on keyboards) may permanently delete the content of a file, in other words clobbering, and one way to avoid this is to use cat with pipes.

I‘ll happily continue to “abuse cat” going forward and sleep perfectly well.

2 comments

Yeah, I read the wiki article to learn a new trick and when reading that paragraph, I've gained more confidence in continuing to use cat :)
I often write cat as a first element of a pipeline, then replace it with head/tail, or grep when I need to narrow it down.

"oh but you can save one character" (one coz <> requires shift) yeah fuck that, if I was bothered with it I'd alias cat to c

Or pv