Re:What I Learned from porting my projects to FreeBSD
by sebcat on Sunday October 28, 2018 @05:46AM
(#18319888)
ag Needle < haystack
No need for cat
Re:What I Learned from porting my projects to FreeBSD
by torstenvl on Sunday October 28, 2018 @07:31AM
(#18320190)
Your version requires fewer keystrokes. It's also mental model-breaking and un-Unixy. Pipes, my good man! Pipe everything to everything!
Re:What I Learned from porting my projects to FreeBSD
by muxator on Sunday October 28, 2018 @08:09AM
(#18320287)
How 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/Redirecti...
Re:What I Learned from porting my projects to FreeBSD
by twic on Sunday October 28, 2018 @09:28AM
(#18320496)
No. Useless Use of Cat is sufficiently unidiomatic that there is an award for it:
Re:What I Learned from porting my projects to FreeBSD
by torstenvl on Sunday October 28, 2018 @12:06PM
(#18321237)
No. 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.
Re:What I Learned from porting my projects to FreeBSD
by xorcist on Sunday October 28, 2018 @03:03PM
(#18322297)
If the most logical syntax is
grep needle haystack
Surely grep needle < haystack
is much closer to that form than cat haystack | grep needle
Re:What I Learned from porting my projects to FreeBSD
by rleigh on Sunday October 28, 2018 @09:37AM
(#18320520)
Mm, input redirection with the shell is the very epitomy of basic Unix functionality.
Re:What I Learned from porting my projects to FreeBSD
by BenjiWiebe on Sunday October 28, 2018 @01:21PM
(#18321676)
< haystack ag Needle
Will work too, and now it's in the logical order.
But that should go away by streaming the file. e.g.