When it comes to writing shell scripts, Python has consistently been my language of choice. Its elegant, simple, and disciplined design is always a pleasure to revisit, read, and write.
Python prevails over many other languages in the way it keeps its core syntax and semantics to a minimum – there’s not much you need to keep in your head to know the language in its entirety. Instead of providing convenience through more language features, Python extends itself via a comprehensive standard library.
As I’ve written shell scripts in Python over the last eleven years, I’ve observed many recurring patterns in the way they utilize the standard library. Ever aspiring to uphold the hippocratic oath of programming – “Write once, reuse everywhere” – I’ve distilled these patterns into a pithy module, script.py.