Re:Bash functions are better than I thought
by dotancohen on Monday November 01, 2021 @03:08AM
(#29063808)
> Getting anything out of a subshell that isn't from STDOUT is impossible.
Yes that is a known limitation that has horrible, horrible workarounds. Don't use them.
That said, for scripts whose main input _is_ from a file or STDIN, and also whose main output _is_ to a file or STDOUT, then bash is far more often the right tool for the job than it is given credit for. Of course, I'm talking about bash and a host of other utilities that are often packaged with it such as awk, grep, sed, cut, etc.
For processing text I find myself often choosing between bash and Python, and very often if I choose bash I'll feel that I've made the right choice.
That said, for scripts whose main input _is_ from a file or STDIN, and also whose main output _is_ to a file or STDOUT, then bash is far more often the right tool for the job than it is given credit for. Of course, I'm talking about bash and a host of other utilities that are often packaged with it such as awk, grep, sed, cut, etc.
For processing text I find myself often choosing between bash and Python, and very often if I choose bash I'll feel that I've made the right choice.