Bash is a terrible as a programming language, but what's the alternative ?

Jean-Michel 🕵🏻‍♂️ Fayard - Feb 16 - - Dev Community

I believe in self-compassion so I have a personal rule

Never write a shell script that is more than 5 lines long.

Let's bash Bash

I am on the record to saying that there is no programming language that is never worth learning

Bash is the exception. It's programming stuck in the stone age. No real functions. No argument names. No types. No data structure. No unit tests. No dependencies management. I need to google every time I want to do something basic like a for loop.

I like it when Homebrew or Gradle or whatever allow me to bootstrap their thing with a complex shell script. Because they went through the pain of writing and maintaining their shell script.

But otherwise, my advice is to give up.

But what's the alternative ?

If things are terrible, and they are, what are we stuck with Bash ?

First, because like with every addiction, Bash's appeal is that it's easy to get started.

  1. Just take whatever you have typed in the terminal and put that in a run.sh file.
  2. Upload that to a gist and you have spread the virus.

Second because it's not clear what's a good alternative that has the same initial appeal as Bash without its many pitfalls.

That's where you come in.

What has been your experience with scripting in $favoriteLanguage ?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .