A case in which cat(1) program is used, even when it isn't technically needed.

A classic case is filtering. Usually, filters made with Perl can take their stuff from stdin OR get the stuff from text file given as command-line parameter.

Also, < shell operator can be used to achieve the same effect without invoking cat. In general, shell piping / redirection can be used in almost all cases, and cat is needed in surprisingly few cases.


$ cat stuff.txt | filter > results.txt

can be avoided by using either:

$ filter stuff.txt > results.txt


$ filter < stuff.txt > results.txt

In some newsgroups (comp.unix.shell, I've heard) there's a tradition of handing out Useless Use of Cat Awards for worst abuses of redundant usage of cat and other shell idioms. This tradition was started by Perl guru Randal Schwartz.

Log in or register to write something here or to contact authors.