#1 thing in command line shell scripting should be: "Do not use it for advanced scripts. If you have multiple if statements and for loops, rewrite it in a higher level language."
This is also the advice given in the google shell guide.
I say this after years of being a DevOps and Platform engineer. Bash is trash. It is great for 10-20 line scripts. Beyond that, it is worthless.
I would not say it is trash, but I tend to agree with the general sentiment and personally don't write longer scripts.
> This is also the advice given in the google shell guide.
This advice is also given in this handbook :) But in reality you might come to a work repo that already has such scripts and it is good to understand it a little bit, I would think.
"I might come to work on..."
Friend, you have no idea LOL
My hatred is well earned!
Is there an explanation why? (Average line count in my scripts is 115).
Cryptic, overly complicated syntax. for loops, if statements, etc.. are all done better in other languages.
No package manager, build, or dependency features. This means it is ugly and gross to import functions from other programming languages.
Zero data structure support, so any data manipulation is horrible.
No test support, so you can't mock and test business logic.
No debugger support.
It's just a bad, cryptic, confusing language that is hard to maintain.
Remember: it's not that you CAN'T do these things, it's that they work better in other languages, like Node or Python. And shelling out in Python or node works great and is very easy. And Python comes built into most systems these days.
It is hard to justify writing shell scrips anymore. It's like writing perl or cobol. We have better tools now, the world has moved on.