4 ms·
Yay, useless use of cat. I think you mean jq . < json | less Sorry for being pedantic. Moving on.
by salmo 6y ago
Yay, useless use of cat. I think you mean
jq . < json | less
Sorry for being pedantic. Moving on.
- mason55 6y agoYes, you can re-write it without using cat, but many people (including me) think it's clearer to read from left-to-right. Plus the mixing of sending the file through stdin and then using a pipe always makes my brain pause. I just personally find that using cat as the first part of the pipeline makes everything easier. Plus, if you're going to argue against useless use of cat, there's also no reason to send the file in through stdin. jq can read the file directly.
- hombre_fatal 6y agoAgreed. Keeping the source on the far left (whether cat or curl) just makes things easiest to follow.
- amake 6y agoYou can put `<json` on the left no problem. (But it makes the pipeline harder to edit so actually I have no problem with `cat JSON`)
- vially 6y agoThe input redirection pipe is not necessary either: jq . json | less
- nicwolff 6y agoI think you mean < json jq . | less
- mthoms 6y agoIt's not useless if it makes it much more readable :)
- tlrobinson 6y agoCongrats on saving two characters?