3 ms·
>But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift. Using `<` doesn't change that model. You c
by Arnavion 4y ago
>But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift.
Using `<` doesn't change that model. You can write `< somefile.txt whatever`. I always write my commandlines as `<in_file cmd1 | cmd2 | cmd3 >out_file`
(Though annoyingly this doesn't work for feeding input to while loops. `< <(echo a; echo b; echo c;) while read -r foo; do echo "$foo"; done` is invalid syntax; it needs to be `while read -r foo; do echo "$foo"; done < <(echo a; echo b; echo c;)`)
- cerved 4y agodoesn't it work if you put it after the while but before the read?
- Arnavion 4y agoNo. That will execute `< <(...) read` anew for every loop iteration, which in this case will cause it to print an endless stream of `a`s.
- ilyt 4y ago> Using `<` doesn't change that model. You can write `< somefile.txt whatever`. If you showed that without context it would look like some prefix/lispy notation so no, you are just showing how bad it is
- Arnavion 4y ago"This thing I don't understand reminds me of another thing I don't understand, so it's bad I decided."
- ilyt 4y ago[flagged]
- mtlmtlmtlmtl 4y agoI thought it was an informative response. I certainly learned some stuff about shell I didn't know before. I'm still gonna use cat because it's simpler to me. I think your snark is unfounded here.