Alternative Shells
github.com
github.com
There are some downsides you need to overcome:
* Slower to start. Takes a second or two before I can start typing when I open a new tab.
* Less stable. Upgrading will occasionally break something, or spit out warnings you gotta find a way to silence.
* Lack of compatibility. Tools that change you shell profiles to shim some executables (like rvm or pyenv) will not work. I typically source some files manually, or resort to bash if I need to.
* Tab completion is not straightforward.
But IMO I get ample compensation:
* I can write much better and cleaner scripts using Python's syntax and standard lib. Being able to use `argparse` is a blessing, compared to how you read arguments and flags in bash.
* I'm actually able to remember the syntax for looping and conditional.
* I'm more self-sufficient in the terminal for small things like arithmetic operations, generating a UUID, testing regexes, etc.
* Having typed/structured data in the shell, vs everything being plain text is also quite useful when you don't want to turn some easy task into some complex text processing pipeline.
The idea of using structured data instead of raw bytes always seemed like a brilliant idea, so I commend Microsoft for pushing the concept with their PowerShell, but I'm a un*x user and all the operating system and tooling is built around dumb `char[]` pipes so unfortunately that's a lost cause as far as I'm concerned.
I suppose a big player like Red Hat or Ubuntu could push for a complete migration of the kernel + userland towards structured pipes, but I'm not sure why they would. From anecdotal evidence it seems to me that shell power-usage is not as popular now than it was in the past, most junior devs I encounter seem to barely use pipes at all, let alone write complex scripts. They rely on VSCode to launch the build commands and they do everything else through GUI. When they need to do something on the CLI they usually just copy/paste from stackoverflow. Why bother overhauling the shell if it's becoming a legacy tool?
It saddens me a bit but I also get it. It's not like shell scripts and Makefiles and autotools stuff are a pleasure to work with... Maybe it's for the best.
Is popularity among junior developers the right metric? Aren't most junior developers permanently junior? I see the movers and shakers of the industry writing shell scripts all the time, probably still too often relative to, e.g. Python scripts.
Execline has a very low memory footprint due to chaining - something that's probably important for embedded devices. And it theoretically has less vulnerabilities associated with shells. It is the primary scripting language of the S6 process supervision suite.
Things that didn't go well:
- Startup time is not great.
- Many, many things will assume that your login shell is either a superset of /bin/sh; or at least when given "foo", will search $PATH for /usr/bin/foo, etc.
- I ended up using Python features much less often than the regular shell commands.
That said, I would welcome a new "alternative" shell that can balance the expressiveness of Python with ordinary simplicity of plain old Bourne sh.
I mostly use python as well, and for some short commands I made pyxargs [1] which lets you run python code on stdin, or a walk of your current directory.
The dash shell is small and fast, and goes places that other shells simply cannot follow.