true, though i think the code style focuses on readability
Re:Natural Language Processing in Bash
by massimo-nazaria on Sunday April 21, 2024 @10:51AM
(#40106185)
Exactly
Re:Natural Language Processing in Bash
by olejorgenb on Sunday April 21, 2024 @06:32AM
(#40104563)
I don't get the anticat crusaders. The overhead of a `cat` command surly is entirely negligible ?
cat moby-dick.txt | ./words.sh > words.txt
I much more readable to me than < moby-dick.txt ./words.sh > words.txt
In the `tr` case I kinda agree, but there is a niceness to the flow when all the transformation steps are aligned like that.> cat is for concatenating files
The real world disagrees.
It's nice to know that `< file` work though. If the input of an pipeline is what's varying writing it like `{ command1 | command 2 } < input.txt` make it slightly more convenient iterating on since changing the last word is more accessible after getting the command from history. (turning on noclobber to avoid accidentally typing `>` to be safe)
Re:Natural Language Processing in Bash
by massimo-nazaria on Sunday April 21, 2024 @10:50AM
(#40106173)
Great comment, strongly agree.
It's been wisely pointed out elsewhere that pre-pending an empty cat saves the need to futz with the first stage syntax when reusing the pipeline. It serves a syntactic function.
Re:Natural Language Processing in Bash
by massimo-nazaria on Sunday April 21, 2024 @10:51AM
(#40106182)
Strongly agree.
Similarly:
This could be: cat is for concatenating files