I've just asked this question "Why is bash a popul...
# thinking-together
p
I've just asked this question "Why is bash a popular scripting language" to the wider internet https://news.ycombinator.com/item?id=35744867 I'm interested what do we think a futuristic shell environment looks like. is it a notebook replacing a shell, a different language i.e. more functional? or does a simple text script always exist
p
Your first question is easier. Bash is a popular scripting language because it is a popular text mode interface. Any text mode interface that can be scripted will be scripted, and the more popular the interface, the more it will be scripted.
p
Can we then ask "why is bash a popular text mode interface"?
p
I'm less certain about that, but I speculate that it was the most advanced and stable free shell when Linux was young, so it became the default on Linux distributions. From there, people got used to it as Linux became popular and now it's the incumbent so anything else needs to be several times better and needs to fix something that most people dislike about bash in order to displace it.
I would say we're in a situation where it's good enough and all the power users know it. PowerShell had the advantage that cmd.exe was NOT good enough. Fish and zsh aren't so lucky.
g
1. Why is Bash so popular? Commands are fully decoupled and there is a VERY simple communication mechanism (lines of text with newlines acting as line separators - everything else is just bytes (it could be simpler :-)). 0D. True decoupling results in software components that you can plug together like using a patchboard synthesizer. 2. Future shell language? Draw.io, Excalidraw, etc. I toyed with this concept a zillion years ago. My experimental code is at https://github.com/guitarvydas/vsh (this experiment uses yEd and was done before I discovered drawio.io and Excalidraw)
a
Almost every "why" question about popularity/adoption bottoms out in some form of history/path dependence. What's already there only has to be good enough for the job at hand for someone to stop looking and just go with it. A bit more specifically, a lot of Unixisms are defined by being easy to implement in C on a PDP-11, the systems that (AFAIK anyway) happened to exist at a nexus where they could have a super spreader event. Famously: Worse Is Better. Cheerful for those of us trying to get actually-good things adopted, innit?
p
@Peter Saxton Are you asking why Bash is the most popular shell on Linux/Unix, or are you asking why Linux/Unix and the Unix shell paradigm in general are so popular?
m
https://www.nushell.sh/ is a modern take on a shell and a scripting language
g
I've long said that it's dumb in this date and time to use a shell with no runtime. We want structured data. It's not hard, we should have structured data. Powershell does it right and its great. emacs shell (eshell) has an interesting approach where it just flat out reimplements a bunch of common commands as lisp functions and that gives it some structures. I think something like what those two do (leaning more to powershell) is the right approach. Of course the real answer or "shell of the future" is "I tell my computer what I want and it does it because I've long ago decided that I am not touching bash anymore and will just ask chatgpt to do it if I need to and if I need a real programming language I'll use a programming language"
s
I will just drop unit here, cause I did built it to be an all in one shell + scripting + VPL: https://unit.md
A related quote from the docs for context: "unit is similar in concept to the Unix shell; for a seasoned programmer, unit should feel like the 2D evolution of the Command Line Interface (CLI) where units' (commands) inputs and outputs (stdin/stdout/stderr) can be piped together into a graph (script)"
j
At the risk of answering the wrong interpretation of this question: There were better shells for writing scripts before
bash
, but they were generally regarded as less pleasant to use interactively (completions, forward/backward search, &c). Because most people spend more time composing little one-liners at the command line than writing scripts — an activity that favors those interactive features —
bash
became increasingly popular. Once people were used to using bash syntax for one-liners, they preferred to just keep using it in small scripts, despite its many shortcomings as a programming language. Ubiquity was ultimately driven by Linux making it the default shell, which had to do with GNU/licensing preferences.
j
That seems right. I think shell is a fascinating design space. You have to have a tool that is good for interactive use, and supports `rm * # specifying commands using no extra syntax plus globbing
rm foo # arguments as unquoted strings
`command | grep foo # terse commands for pipes and also redirection``
Just in terms of syntax, it’s a tricky design space.