Re:Avoiding Bash frustration – Use Python for shell scripts
by m463 on Monday November 09, 2020 @02:26AM
(#25032175)
That's exactly what I do.
And it turns out the standard library has a lot of depth to it, even on not-really-python-friendly platforms like macos.
I have a standard sort of "template" program that uses argparse and just fill it in.
It's nice to be able to iterate over a list of files without worrying about files with spaces in the name. I read and write json and csv files and use curses to colorize output.
You can do all these things in a shell script, but they tend to get messy.
And it turns out the standard library has a lot of depth to it, even on not-really-python-friendly platforms like macos.
I have a standard sort of "template" program that uses argparse and just fill it in.
It's nice to be able to iterate over a list of files without worrying about files with spaces in the name. I read and write json and csv files and use curses to colorize output.
You can do all these things in a shell script, but they tend to get messy.