3 ms·
My disclaimer is that I love bash. I write way too many things in bash. But eventually I go back and refactor the scripts into Python (or lately, Go) because I
by cfors 7y ago
My disclaimer is that I love bash. I write way too many things in bash. But eventually I go back and refactor the scripts into Python (or lately, Go) because I am so sick of people refusing to touch my bash scripts.
String munging in Python is so much objectively easier to read than bash. I would say that it's because it is similar to a lot of the more popular languages than the sort of cryptic parameter substitution bash provides. And if that makes it easier to maintain some automation, then its worth the effort just to use Python IMO.
- fsaintjacques 7y agoPython is a portability minefield. I'll spend more time trying to get the script/package run than reading the bash script.
- cfors 7y agoCouldn't agree more, but honestly I think that is a completely overplayed issue. Just be explicit (This requires Python3.7) and have a requirements.txt file, maybe bundle with a `make install` command and move on. If people can't figure that out... I don't know how you're going to expect them to read a cryptic bash script. Don't get me wrong there is totally some good use cases for bash. Init-scripts come to mind when you don't want to lug around a Python VM in a lightweight container, for example.
- tynorf 7y ago> Just be explicit (This requires Python3.7) Or just use a `#!/usr/bin/env python3.7` shebang.