3 ms·
Lots of useful shell scripting tips or Useless Use of Cat Award
- telemachos 16y agoolefoo got this right the last time I saw this come up here: http://news.ycombinator.com/item?id=1117032 http://news.ycombinator.com/item?id=1117032 The whole 'useless use of cat' meme is basically designed to let Randal Schwartz make fun of people. At one point it may have made a difference, and certainly if you have a shell script that is getting called 10,000 times a day it might make sense to optimise it. But for doing stuff from the commandline; weird shell acrobatics is a premature optimisation. If you know that you can use a command directly on a filename or -, then great: skip cat. If you're not sure, and you use cat, great: get some work done. If you like to write < somefile command, great: I actually like how that looks. If you prefer the readability (real or alleged, I don't care) of cat file | command, fine: go nuts. Surely there have to be more important things to worry about. Since it got a lot of comments and votes, here's the entire previous thread I had in mind: http://news.ycombinator.com/item?id=1116085 http://news.ycombinator.com/item?id=1116085