2021-04-04Table of Contents
After having written a few bash scripts that are relatively complex, I have some thoughts that I want to get down. The first is that arrays are quite strange in bash, the syntax, the delimiting, the way to reference the entire array is all different from regular languages. The internal field seperator is also a weird concept that is quite cool. Setting the IFS allows strings to be processed differently and it is a surprisingly intuitive way of thinking about things.
The most painful thing about writing bash is functions. Bash has functions but passing arguments is messy and returning things is done through global variables. This means that functions are helpful but just barely.
The great thing about bash however is that once you learn the syntax it all makes sense. I really like the idea of gluing things together and bash has that in spades. I have a rough idea of what I am trying to do and I can quickly start putting together various unix utilities and have something functional. This feels alot more ergonomical than something like python or rust.
I've had quite a bit of fun writing bash scripts and getting something that works well gives me a sense of accomplishment that the other languages haven't. I've spent alot of time getting into rust and I like to believe that I'm at a point where I can quickly get something running in rust but it still feels very mechanical. Rust doesn't feel alive the same way bash does. Even compared to the other scripting languages, bash is something special with the way that you can invoke unix utilties. I would love for something to basically be bash but with proper functions, arrays and hashmaps. Allow for local variables by default and cut down the syntax for conditionals and loops would be a bonus. I think something like that would make a very fun language to program in.
For now however I'm going to continue using bash for anything I can think of, even if it might be a dumb as it makes me smile to know it's just a bunch of linux commands strung together to do something complex.