▲ | mdaniel 3 days ago | |
This trope comes up every time bash is mentioned, without fail. Unless your team enjoys reading this, then no, a general purpose programming language is not a good replacement for what is effectively a "subprocess orchestration language":
The line noise is outrageous as compared to a language built for changing directories and running commandsThat's not even getting into the pty portion, where the progress of the output isn't visible until the end of it, which is terrible DX | ||
▲ | Too 2 days ago | parent | next [-] | |
Nice rube goldberg machine. Apart from imports, that is equivalent to
Converting exceptions to exits is an anti-pattern that hides the source of the error, f-strings has been a thing for 10 years and argument quoting happens automatically. Progress of output isn't visible in bash either when you capture output with $(), unless you "tee", which opens up another can of "pipefail"-worms. | ||
▲ | aborsy 2 days ago | parent | prev | next [-] | |
This falls under the case “unless the bash script is simple “. If you consider more complex tasks, bash quickly gets unwieldy, and the situation is reversed. Pythons has a lot of advantages, including full flexibility, error handling etc. | ||
▲ | BeetleB 2 days ago | parent | prev [-] | |
In xonsh[0], that would be:
(Not sure about the equivalent of shlex.quote, but in the worst case, you can just use "from shlex import quote as q" or something).So yes, there are good alternatives to bash - even Python based. [0] https://xon.sh/ |