thoughts on bash
i love bash.
i really, really, love bash. well, it and all the other posix shells. i personally use zsh in my terminal, with oh-my-zsh stacked on top. for the rest of this article, i will be using bash to refer generally to the bashlike shells(so no fish).
bash is so excellent at specific types of problems, and completely god awful at almost every other kind.
bash does not do math well. bash can do integer arithmetic pretty well, but the second you need to deal with decimals bash is your mortal enemy, forcing you to invoke bc
or some other scripting environment.
bash does not do parsing well! bash does simple parsing effortlessly assuming you're comfy with regexes, and most formats have some way to handle them from the command line (jq, yq, sqlite, etc.), but bash will be sure to make you unhappy the entire time for just about anything else and you will have to learn what the IFS
is.
what bash excels at, though, is anything you can do from the command line. bash has quite literally effortless process management, it's the main thing you do. bash has easy file and directory handling, and pattern matching tools to make simple file searches trivial. if you live in the command line, every utility you install is at bash's disposal. on top of the wealth of standard posix tools almost every command line utility is built to serve bash's whims.
the language of a terminal is one of text. when you type a command, whatever it outputs doesn't really feel like reading or writing bytes to you, the user. it's just text appearing. text moving. text changing color. part of the brilliance of bash's UI design is that capturing the output of a command--as text--is, like so much else, trivial. i do not need to think about the true abstractions of the operating system to understand that $(date +%B)-*
will, at time of writing, get me every file beginning with "February-". the brilliance of bash is that it lets the programmer think in terms of the established user interface, and not in terms of the underlying systems. the fundamental abstractions of bash bear no relation to posix or unix or linux, instead just to the posix command line.
bash is, for the experienced user, so effortless to write, because it's not really a deviation from the normal use of the command line, it's so intuitive because you are essentially just telling the computer to do what you would do. there is not, i don't think, any similar form of ui-language link for gui-based applications, nor for web-based applications. the blurred line between programming environment and interface, made possible by virtue of them both being text, gives bash a certain elegance that few other repls aspire to, much less manage.
this is, i think, the thing powershell fails at. in its attempt to be a safer, more structured bash, it loses much of the effortlessness that makes bash what it is. it is clunkier and slower, though technically more featureful. as a tool for remote windows administration, i think it succeeds fine, but i could not live in powershell the way i live in my terminal on linux. i do understand that that isn't the point, and even when windows was text-based, the scripting environment was still in desperate need of features, seen more as a tool than an interface, but i still figured it was worth mentioning.
these days, when scripting, i find myself bouncing between bash and python, depending on the task. they're both excellent at completing whatever i throw at them, and i'm happy to have such loyal and powerful tools as those, and such a wonderful interface for my day-to-day, as bash.
that's all.