Traditional shell scripting languages are great at exactly two things: running other programs, and sourcing other shell scripts. They are also is distinct in that they are "stringly-typed" (i.e. everything is a string), and moreover that syntactically bare symbols are also strings.
"Running other programs" includes invoking them (literally 0 extra syntax), piping them (one letter: |), and redirecting the standard input and output streams to files (>, <, <<, etc.). This is one of the great innovations of Unix and nothing holds a candle to its elegance and convenience, even if sometimes we get frustrated that pipes are "dumb" streams of bytes and not something more structured.
"Sourcing other shell scripts" practically isn't much different from "running another shell process", except that source'd shell scripts can set shell parameters and environment variables, which is an important part of e.g. the X11 startup system: the global /etc/X11/Xsession script sources the user's ~/.xsession script, so any environment variables set in the latter are propagated to the former, and thereby are inherited by the X11 window manager when it eventually starts. If you wrote the /etc/X11/Xsession script in any other programming language, you'd have to inspect the environment variables of the ~/.xsession process and "merge" those values back into the current process' environment.
On being stringly-typed, I think it's mostly good in the context of the "two things that it's good at" described above. It cuts down on syntactical noise (otherwise "everything" "would" "always" "be" "quoted" "everywhere") and makes string interpolation painless. Make and Tcl are the only other popular languages in this category. Perl and Ruby allow it in specially-delineated areas of code. Moreover, Bash, Ksh, and Zsh all have arrays, which helps fix some of the biggest problems of everything being a string.
In short, if your program can make good use of the above features, then a traditional shell is a great choice. If you program does not need those features, do not write your program using a shell script, because shell languages are awkward at best in pretty much all areas.
And if you are considering an "alt" or "neo" shell language, in my opinion it must excel in the above two categories. Being stringly-typed is a matter of taste, but the language should also probably support bare-symbols-as-strings and string interpolation.
Please add another standard output stream.
stdout is for output
stderr is for error messages
stdlog for status/tracking, verbose output, event streams. Too often this gets shunted to stderr, and I don't want to logfile hunt. Other examples: download status from curl, verbose output flags in things like ssh and other comm programs that need configuration debugging on the regular, and others.
Nushell seems to also focus on json output for commands. I think this should be a requirement pushed into all unix commands that do output (LS! please please please a json output flag for simple ls which CANNOT BE PARSED RELIABLY).
http://www.oilshell.org/release/latest/doc/idioms.html
It removes the need to quote every variable, and this is fantastic
Or is it like Neovim vs. Emacs at that point, where neither one is "better" and it's just a matter of taste and/or whichever one you happened to try first?
Oh.. I just tested here. It works!
$ mkdir -p /q/a\ b/x
$ a="a b"
$ ls /q/$a
x
And in bash: $ a="a b"
$ ls /q/$a
ls: cannot access '/q/a': No such file or directory
ls: cannot access 'b': No such file or directory
The weird thing is, my shell is zsh but my shell scrip ts are all either #!/bin/bash or straight #!/bin/sh, so I never took advantage of thisAnyway, I want to link also to
http://www.oilshell.org/release/latest/doc/upgrade-breakage....
http://www.oilshell.org/release/latest/doc/warts.html
http://www.oilshell.org/release/latest/doc/known-differences... <- here it talks about zsh a bit
show_nargs() { print $# }
q=
show_nargs $q # 0
show_nargs "$q" # 1
So it doesn't completely solve the need for defensive quoting, but at least it mitigates the need for the most part. $ echo 'aaa' > a.txt
$ echo 'bbb' > b.txt
$ TMP="" # Mistake! Missing arg, failed search, typo'd name, etc.
$ cp a.txt b.txt $TMP
$ cat b.txt
aaa
$ # The contents of b.txt are lost.Actually there's a wave of unixy tools being written in Go and Rust and I think there might be a suitable cp replacement already, but it's up to distros to package it.
PERL. Sh, awk, sed and mini-C all at once.
Yes Ruby has ruined me.
`template${Math.random() > 0.5 ? 'strings' : 'literals'} have beern part of the language since 2015!`
If you want a traditional Unix-like shell that is mostly sensible in the places where Bash is not, check out Zsh. It has a ton of complicated features, but most Bash scripts can be ported easily (if not outright copied and pasted). Zsh has fewer footguns by default than Bash, and it has more "safety" settings that you can enable.
There is also the Oil shell, whose creator often posts on HN, and which I think is meant to be a superset of Bash, but I have not used it myself and can't vouch for it.
As for the alt shells, I've was specifically interested in Elvish, but I dropped it as soon as I saw that they don't support parameter interpolation in string literals, like `"${HOME}/.local"`. This is such a common operation in shell scripts that I have no interest in a shell that doesn't support it, and I can't imagine why Elvish doesn't.