Re:Survey of popular Node.js packages reveals credential leaks
by electroly on Monday December 07, 2015 @08:49AM
(#10689358)
This isn't "shell golf". This idea that we shouldn't use small focused tools in a chain, but rather we should find as many arcane arguments and switches as we can to shorten the chain, is contraindicated by the Unix philosophy. I don't know why this nitpick comes up so often. There are many "human factor" reasons why a longer chain with simpler commands is desirable.
[ Parent
| on HN ]
Re:Survey of popular Node.js packages reveals credential leaks
by brbsix on Monday December 07, 2015 @09:05AM
(#10689454)
Is it really so arcane to `grep PATTERN FILE` or `grep PATTERN` <kbd>Alt .</kbd> (if the previous command was `cat FILE`)? Is it also arcane to `pgrep PATTERN` instead of `ps aux | grep PATTERN`? Is it also arcane to `egrep 'PATTERN|PATTERN'` instead of `grep PATTERN | grep PATTERN`? Personally I prefer the "correctness" of this sort of approach, but the tools are just a means to an end and understandably people have varying preferences. Ironically "legitimate" was probably not an accurate choice of words.
Re:Survey of popular Node.js packages reveals credential leaks
by zwp on Monday December 07, 2015 @01:40PM
(#10691542)
> `egrep 'PATTERN|PATTERN'` instead of `grep PATTERN | grep PATTERN`
Oops? Ironically (assuming two distinct values of PATTERN) I think you just answered your own question. (They are different: first is disjunction of patterns, second is conjunction).
Your point has merit for scripts (performance) but for data exploration at the prompt it's almost always irrelevant: the simplicity of pipe composition outweighs anything else.
Re:Survey of popular Node.js packages reveals credential leaks
by brbsix on Monday December 07, 2015 @02:15PM
(#10691871)
Whoops you've got me there. Yes for that example, the grep alternative is not very elegant. Anyways I wasn't making an argument against composition, just particular types of composition (such as useless use of cat, parsing ls, grepping ps) for which there are side-effects or there is a simpler or more appropriate alternative.