3 ms·
I have a colleague that writes alot of shellscripts and there is an ongoing discussion if shellcripts or scripting languages like python is better.
by hapulala89 3y ago
I have a colleague that writes alot of shellscripts and there is an ongoing discussion if shellcripts or scripting languages like python is better.
- agumonkey 3y agoi remember trying to rewrite so fragile scraping bash script in python, and even with some effort to use nice libs and create some cool helpers it ended up as long and not much more solid bash is infectious in the bad sense :D
- pram 3y agoIt’s perfectly fine for glue type stuff in a CI pipeline imo. There’s frankly no easier way to work with files.
- sneed_chucker 3y agoPython's subprocess/shell-out story is just bad enough that I still find myself writing a lot of shell scripts if the task at hand warrants more than 2-3 subprocess calls. Realistically, Perl or Ruby would fill this role fine, but I hate adding another language to a project just for that purpose.
- pletnes 3y agoAgree, and also you have to write a few lines of shell to get your python going (and same for node or ruby or whatever).
- ovex 3y agoFrom a security point of view, Python is better because it is less of a footgun. So if you expose an interface to untrusted users, you should use Python because its behavior is more intuitive. An arithmetic expansion or missing quotes do not easily become a vulnerability in Python.
- Schnitz 3y agoWe ported all shell scripts to Python at a company that I’ve worked for. Scripts just kept getting longer and more complex. As a language Python is great, super fast and easy to code in, very little inherent complexity. The reason I wouldn’t choose Python again is distribution. It’s easy enough in Docker, you can just bite the bullet and vendor the same Python in all Docker containers. Mac was a pain though, pyenv etc all had their own issues and collisions with homebrew and dependency management with pip is a hassle as big as npm. A real bummer given how well Python works as a language for scripting.