5 ms·
It is this kind of thing that makes me want to avoid Bash every time. Something that should be trivial has no general consensus about how it should be done and,
by racl101 5y ago
It is this kind of thing that makes me want to avoid Bash every time. Something that should be trivial has no general consensus about how it should be done and, not only that, many pitfalls.
- pizza234 5y agoBash is indeed very limited on some aspects (and confusing/quirky on others, etc.etc.). Regarding the multiple ways though, I think it's a matter of good judgment. Depending on the input, one may choose different tools - one should not forget that Bash is a glue language, intended to make tools work together.
- don-code 5y agoThis whole class of problems, where there's no general consensus about how to achieve something, makes it incredibly difficult to train juniors who still have a one-correct-answer mindset. It makes me wonder how any of us got past it in the Java world, where there were no fewer than three commonly-accepted ways just to represent time. Declarative languages, like SQL or (dare I say) Terraform, seem to be good teaching tools in that regard.
- racl101 5y agoI meant that trivial problems should have more consensus but even the smallest of them I find when you ask about them there's controversy.
- SavantIdiot 5y agoOr it is a sign that if something is this complex, perhaps you shouldn't be doing it in the language to begin with. AKA, a code smell. Bash is tiny, flexible, and highly effective at what it was designed to do: shell scripting, which is effectively user OS commandline automation. It would be akin to me complaining that my microwave doesn't actually prepare a dinner for me, it just heats things up.
- NackerHughes 5y ago> Something that should be trivial has no general consensus about how it should be done and, not only that, many pitfalls. Oh, boy. Let me tell you about CSS.
- racl101 5y agoOh yes, I know the classic center something issue before flexbox came along.