4 ms·
Whenever I start writing bash, if it goes beyond 50 lines I rewrite it in Python. I really prefer to write no bash at all its so confusing.
by andrewstuart 4y ago
Whenever I start writing bash, if it goes beyond 50 lines I rewrite it in Python.
I really prefer to write no bash at all its so confusing.
- pas 4y agoI always yearn for compile time checking when writing scripts, because my experience is that these scripts become unmaintainable in about 3 hours. Recently I started using TS for scripting. Not the best, but Ammonite (a Scala scripting env) is a bit too big of a lift.
- MobiusHorizons 4y agoIf you want to understand bash, it’s best to spend some time using basic posix sh (dash on some systems) it is a much less powerful shell, but that highlights the power of composition that it does have. Also use shellcheck its an amazing linter, it will teach you many things about the shell, and actually explains the why for each lint.
- aaaaaaaaaaab 4y agoWhenever I encounter a 100+ line Python script, I rewrite it into a ~10 line bash script.
- ilyash 4y agoWhenever I encounter 20 lines bash script, I rewrite it as 15 lines Next Generation Shell script. It is more correct because of better error handling, more concise because of stdlib, more readable because of saner syntax. Disclosure: I'm the author.
- wdroz 4y agoIn the Google style guide for Shell[1], they use 100 lines as the limit. [1] -- https://google.github.io/styleguide/shellguide.html#when-to-use-shell https://google.github.io/styleguide/shellguide.html#when-to-...