Yes, when working with sub-processes you need to account for platform differences...which is also true when Python.
A Bash script "just works", while I have to direct customers to install the appropriate version of Python (or whatever else).
Yes, when working with sub-processes you need to account for platform differences...which is also true when Python.
A Bash script "just works", while I have to direct customers to install the appropriate version of Python (or whatever else).
The cases in which you even need to use subprocesses is much smaller with Python, because the stdlib replaces a huge amount of external programs typically used with Bash (cat, grep, awk, sed, cut, paste, wc, ls, find, etc.). And so if you stick with stdlib without subprocesses, you don't need to account for platform differences. Python has already done that work for you.
In simple cases, or cases where portability doesn't really matter, then I agree with you. But once you start caring about portability, you have to be careful to consider the compatibility differences of external programs across distributions and OSs on which Bash runs, which vary dramatically among even the simplest or most common of programs such as "ls" or "grep".
Example:
# ubuntu 20.04
echo fooboo | grep -Eo '.+?oo'
> fooboo
# macos big sur
echo fooboo | grep -Eo '.+?oo'
> foo
> boo
Bash scripts being portable has little to do with Bash itself, it's either deliberate by the programmer, or a happy coincidence. IME it's almost always the latter, if it's portable at all (which isn't uncommon in my work).(Also wanted to add that this isn't a unique property to Python either. Any "real" language typically has these same properties.)
Thankfully, with the official deprecation of Python 2.7 and the slow march of progress I hope to be able to better standardize on Python 3 + stdlib (or similar).