
The parse_params() function supports them all. There are three main types of CLI parameters – flags, named parameters, and positional arguments. Also, even if something needs to be hardcoded, usually there is a better place for that on a higher level than the Bash script. It makes it easier to copy and reuse it, which often happens sooner than later. Even if the script is used only in a single place. If there is anything that makes sense to parametrized in the script, I usually do that. Script_dir=$(cd "$(dirname "$" ]] & die "Missing required parameter: param" And you probably should think twice and then once more before adding it to some prod server, Docker image, or CI environment. While it makes perfect sense to write bigger, more complicated scripts in other languages, you can’t expect to have Python, Ruby, fish, or whatever another interpreter you believe is the best, available everywhere. To glue few commands together, pass output from one to another, and just start some executable, Bash is the easiest and most native solution. So if you need to script the server application startup, a CI/CD step, or integration test run, Bash is there for you. And this is the environment in which most of the backend runs.

While we can hope that Bash won’t become the main language for literally everything, it’s always somewhere near.īash inherited the shell throne and can be found on almost every Linux, including Docker images. Just like JavaScript, it won’t go away easily. The opposite of "it's like riding a bike" is "it's like programming in bash".Ī phrase which means that no matter how many times you do something, you will have to re-learn it every single time.- Jake Wharton December 2, 2020īut Bash has something in common with another widely beloved language.
