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
What are the worst programming languages that nobody should learn?
Jean-Michel ๐ต๐ปโโ๏ธ Fayard ใป Jan 8 '20
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.
- Just take whatever you have typed in the terminal and put that in a
run.sh
file. - 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.