This ain’t a tutorial on how to use LLMs for porting code, I just provide my thoughts and reasons on why I’m preferring Python over Bash for writing automation scripts as well as providing three helpful tips to get started writing Python scripts to replace Bash
I’ve recently decided to stop writing bash scripts for daily devop tasks and instead use Python. The reasons for this might be obvious to many, but just to quickly summarize, here are my reasons:
Python code is moreclearly understood than Bash code. Bash code is cryptic, whether you are writing a for loop, checking a file exists, everything looks cryptic.
Python code is morepowerful than bash. It allows you to easily create a thread pool to parallelize tasks, run complex arithmetic operations and apply imperative or functional styles to your code.
Python code is moreversatile considering the number of libraries its support and the ease of using those libraries.
Three Useful Tips when migrating Bash Code to Python