2 ms·
Thanks for the comment. Yeah, in this case I decided to keep the "superflous" cat because it offers more flexibility/readability -- i.e., what if you want anoth
by kalid 16y ago
Thanks for the comment. Yeah, in this case I decided to keep the "superflous" cat because it offers more flexibility/readability -- i.e., what if you want another command before the first sort? With the 2nd version you have to remove foo.txt and type your command, instead of just inserting "mycommand |" where needed (and what if mycommand doesn't accept a file, just stdin, then you need the cat anyway).
But it's a good point, and there's a balance between the absolute minimum and flexibility. At one extreme you have code golf, at the other you have an abstract FactoryFactory.