4 ms·
Quite. I had occasion to share this[0] in another thread, and it's relevant here, too: > When I offer a pipeline as a solution I expect it to be reusable. It i
by scubbo 4y ago
Quite. I had occasion to share this[0] in another thread, and it's relevant here, too:
> When I offer a pipeline as a solution I expect it to be reusable. It is quite likely that a pipeline would be added at the end of or spliced into another pipeline. In that case having a file argument to grep screws up reusability, and quite possibly do so silently without an error message if the file argument exists. I. e. `grep foo xyz | grep bar xyz | wc` will give you how many lines in xyz contain bar while you are expecting the number of lines that contain both foo and bar. Having to change arguments to a command in a pipeline before using it is prone to errors. Add to it the possibility of silent failures and it becomes a particularly insidious practice.
[0] https://stackoverflow.com/a/16619430/1040915 https://stackoverflow.com/a/16619430/1040915