Re:Useless Use of Cat Award
by _delirium on Wednesday September 11, 2013 @11:22AM
(#6367736)
This form is also nicely modular, setting up a data source at the left of the pipe in a way that's easy to modify to swap in a different kind of data source:
There are many places I get data, and it sometimes changes (e.g. I decide to compress a file and read it back with xzcat instead of cat, leaving the rest of the script unchanged). Unless you give me an alternate syntax that can handle all of them, I'm not interested in the fact that a particular utility has chosen to provide its own idiosyncratic syntax to special-case only the 'cat' data source, with an -f parameter or whatever.
[ Parent
| on HN ]
> setting up a data source at the left of the pipe in a way that's easy to modify to swap in a different kind of data source:
Just replace
cat file |
with <file
It still keeps the data source on the left, and easily swapped out: <file grep xyz