9 ms·
ag Needle < haystack No need for cat
by sebcat 8y ago
ag Needle < haystack
No need for cat
- torstenvl 8y agoYour version requires fewer keystrokes. It's also mental model-breaking and un-Unixy. Pipes, my good man! Pipe everything to everything!
- muxator 8y agoHow come knowing how to redirect stdin is un-Unixy? Pipes are a good tool, and so are many others. Having a good command of other basic mechanisms of the shell is going to hugely pay off, try to have a brief shot if you want [0]. [0] https://www.gnu.org/software/bash/manual/html_node/Redirections.html https://www.gnu.org/software/bash/manual/html_node/Redirecti...
- twic 8y agoNo. Useless Use of Cat is sufficiently unidiomatic that there is an award for it: http://porkmail.org/era/unix/award.html http://porkmail.org/era/unix/award.html
- torstenvl 8y agoNo. Being smug doesn't make someone right. Especially when the smug person is advocating a special case. Special cases are inherently wrong, even when they "save" a process.
- xorcist 8y agoIf the most logical syntax is grep needle haystack Surely grep needle < haystack is much closer to that form than cat haystack | grep needle
- rleigh 8y agoMm, input redirection with the shell is the very epitomy of basic Unix functionality.
- BenjiWiebe 8y ago< haystack ag Needle Will work too, and now it's in the logical order.