Biggest pain points in my opinion in pure bash is flow control, string manipulation, arrays, and looping.
Biggest pain points in my opinion in pure bash is flow control, string manipulation, arrays, and looping.
You'd be amazed at how readable and un-gnarly most shell script become if you break them into functions. Control flow and loops become quite easy.
String manipulation on the other hand, if awk and jq can handle it reasonably well I'll use that, but I also forgive people for using a better scripting language. I prefer Ruby but I think using the language of the project is a better choice.
I have written some really basic shell scripts, and I try to use common shell modules/commands whenever it makes sense. It's just so confusing sometimes.
The main challenges I faced in the beginning where caused by MacOS. MacOS comes with an older version of Bash, its default shell ZSH comes with its own slight variations on how it expects you to do things, and the utilities that come with MacOS aren't Gnu so the available options/arguments are not what you would find online.
Then there is so much conflicting information online! A lot of it is also ancient, as in newsgroup archives from the 90s.
String manipulation. When I look up how to do some specific replacement again, I come across all these massive inline awk scripts. But then I remember I could also just use sed and regex, or in some cases even just standard variable tricks, and achieve the desired result with 90% fewer code.
The bigger scripts I've written are a mess.. I think. I still haven't been able to figure out how to error exit out of the entire script from a function that was called within it... :)
ShellJS is meant to be used from CLI, as native shell commands; zx is meant to run shell commands from JavaScript. There might be some overlap in usage, but IMHO ShellJS is useless unless you use Windows, while zx is useless if you know how to write bash code.