Re:Shell Script Best Practices, from a decade of scripting t...
by chasil on Thursday October 27, 2022 @08:47AM
(#33356687)
The shell is an ambiguous language that cannot be directly implemented with an LR parser.
Perhaps some of the power emerges from that ambiguity, but it is quite difficult to implement.
This presentation sums up the woes of an implementor:
https://archive.fosdem.org/2018/schedule/event/code_parsing_...
I would argue that once you pull in jq, you're no longer writing in "shell", you're writing in jq, which is a separate and different language. But that's precisely the point! Look at how effortless it is to (literally) shell out to a slew of other languages from shell.
The power of shell isn't in the scripting language itself, it's in how fluidly it lets you embed snippets of tr, sed, awk, jq, and whatever else you need.
And, critically, these languages callable from shell were not all there when shell was designed. The extension interface of spawning processes and communicating with arguments and pipes is just that powerful. That's where shell shines.