I'm doing programming language research and it's just infuriating how retrograde shell is. Its design is a fossil of history, and boy did our understanding of what makes a good language evolve. As a proof of this look at the jq tool. It is so powerful and clean. The implementation is simple and reasonably fast. It has been designed by a researcher from functional languages (an ocaml guy). This is a way to build a language around pipelining. At a lesser level, look at how moving from vimscript to lua in neovim has brought so many high-quality new plugins, look at how many people now tinker with low-level stuff and write high-perf libraries now that C/C++ is not the only choice. Surface language and having very little very orthogonal concepts is important.
Some core implementation patterns for PL are very old, but there have been lots of simplifications and rationalizations in surface language. Error handling, values hygiene, scoping, simple datastructures. Posix shell might have been a prowess in the 70s, now it is mostly a hack and this is a fact. Let's be a bit less superficial when honoring the unix mantras and dream about something better (making a better shell for its core ideas(!), that is, handling processes and fds).
As it passes objects the filtering, sorting, joining is generic across files or any other data type.
I really cannot fathom how this could be, as Microsoft bundles curl, which has nearly 100 exit codes on various types of failure.
Whoever made this language decision needs to explain themselves.
Use $LASTEXITCODE for native executables, and $? for PowerShell cmdlets.
https://learn.microsoft.com/en-us/powershell/module/microsof...
Many tasks are more concisely expressed and readable in shell than in any other language.