4 ms·
So, the article describes reasons why bash is not good for shell scripts. Then describes some ways how to avoid them, using bash. Which kinda invalidates the id
by GekkePrutser 5y ago
So, the article describes reasons why bash is not good for shell scripts. Then describes some ways how to avoid them, using bash. Which kinda invalidates the idea that bash is a bad tool for scripting. You just have to know how to use it.
For me, I use both. For simple stuff I use bash. For more complex things I use a higher-level language. Like when I have really complex logic, structured data (I wish a new Linux shell would come up that can send objects through a pipe in a standard format like powershell can). Or when I need to do extensive chatting with a database or REST API or something.
Sometimes I use PHP (even locally), sometimes Python. On a Mac, PHP comes out of the box with some nice extensions that Python doesn/didn't offer out of the box on the same platform. So it was easy for me to do scripts talking to e.g. LDAP or some other things. Of course you can pull extensions in with pip but in my work we have a pain-in-the-ass MITM proxy that breaks most of that if it's not set up correctly. So I tend to rely on pushing scripts that need nothing additional to run but the script itself. Also, pulling stuff in from public repos is a bad idea for security.
But for more simple stuff especially stuff that just ends up running other programs anyway, really there's no point. Otherwise you'll just end up with a row of shell() (PHP) or os.system (python) commands.
- digisign 5y agoThe industry has been moving steadily for many decades from unsafe technology to safer variants to increase reliability of increasingly mission critical systems. Typescript anyone? This has been in response to the many high-profile failures that have been and are experienced routinely in the IT industry.
- hedora 5y agoStatically typed bash (whatever that means) would be awesome. Statically typed python would probably defeat the purpose of the language (just use java, etc.)
- digisign 5y agoIt's great when your prototype grew into a giant system with large teams of developers with mixed-experience. See pydantic etc.
- GekkePrutser 5y agoUgh no not java please. I'm so glad we're not having to deal with different components of major server systems requiring different JRE versions because backwards compatibility in Java is so absolutely horribly broken. And of course those different versions you installed in different places try to 'helpfully' find and upgrade each other causing the various components to break. Java was a nice idea with very poor execution. It's been surpassed by many other technologies now, even .NET does it better.
- cglong 5y agoJust in case you weren't aware, PowerShell runs on macOS and Linux now :)