4 ms·
apart from all the useless use of cat, great content!
by fs111 7y ago
apart from all the useless use of cat, great content!
- m4r35n357 7y agoI think that done deliberately to emphasise the pipelining aspect, redirection would visually obscure the main principle of the article.
- jdxcode 7y agonot only that but I do the same when I use the CLI because it makes sense to say "I have a file. Now I will pipe it to ___" rather than "Using ___ I will pipe a file in then ___". It just makes more sense to do things in order even if it's a couple extra characters.
- LeoPanthera 7y agoYou can keep the order but save a process by doing: <input_file command_line
- Karliss 7y agoI was going to suggest that shells should allow specifying the input redirect before the command, but it turned out that "<input command" in bash already works. Anyone knows about other shells?
- iokanuon 7y agoAll POSIX-compliant shells should support this.
- joppy 7y agoGod forbid that someone should ever write (- y + x) rather than (x - y), what a useless use of the plus sign! Why have a problem with this? Catting a single file is a well-known idiom for outputting its contents into a stream, plays well with positioning in pipelines, and has the nice property that you can erase as much of the pipeline as you want, to be able to peek inside it at any point.
- saber6 7y ago> Why have a problem with this? This is hacker news. People will debate the optimal angle of jacking off.
- cormacrelf 7y agoCompletely agree. Cut it if your file is 10GB of logs because it requires an extra stream copy, but otherwise, it is the best way to interactively drill down into data and write the pipeline as you go. It is almost never a valid criticism, and when it is, calling it Useless UOC (reads as an insult to the author!) was the worst way to communicate that to the masses.