Have you looked at Plumbumm for Python? It handles everything you just mentioned:
https://plumbum.readthedocs.io/en/latest/
There's no reason not to use Python to achieve the same thing, and you get all the benefits of using Python instead of Bash.
I'm sure other languages have similar libraries.