- The Minimalist Newsletter
- Posts
- So You Want to Get Awesome at Shell Scripting?
So You Want to Get Awesome at Shell Scripting?
Here are my experiences based on mastering the art of shell scripting

Shell scripts written by me glue together my whole system! Yes, I use Raw Debian (I used to use Arch btw, but had to shift to get stability, the topic for another article). And this has made me master shell scripts.
Shell scripts are awesome for automating tasking and customising your Linux and MacOS distribution. I use ZSH as my shell on both, macOS and Debian with hundreds of lines of shell scripts made to automate my distro, boosting my productivity as a software engineer.
And to attain this level of automation and custom-tailored scripts for my system, I have spent countless hours working on them. On this journey, I have learnt good ways from all those bad shell scripts I used to write. Failing and learning are important to master an art, and there is an art of shell scripting.
Shell scripting is a bit different from writing traditional scripting languages like Python. Rather than boldly mentioning it here, let me give you an example. 95% of the time you don’t need to use “if-statements“. Because shell scripts contain operators that are interpreted line by line by the shell, using if-else statements is kind of bloating your scripts. Nobody likes bloated software!
# Beginner (learned)
if ["$EDITOR" = ""]; then
EDITOR="nvim"
fi
# Intermediate (used to bash)
if [ -z "$EDITOR"]; then
EDITOR="nvim"
fi
# GigaChad (professional neckbeard Linux user)
[ -z "$EDITOR"] && EDITOR="nvim"
Here are three ways of writing code for setting the environmental variable EDITOR if it is not set on a system. This is a clear example of manipulating operators in Linux shells and using them to write optimised code. The 3rd snippet is way more readable and concise than the other 2 above.
Still confused? Check out my LinkedIn Post to explain this in detail, which you optimise the way you write Linux shell scripts.
Knowing things in this detail equips you with a better understanding of shells and writing scripts that are optimised and maintainable, an unmentioned skill in software development. I highly recommend you get to know the basics of shell scripting better before proceeding to these advanced concepts. I have written an article on “Linux Shell Scripting — A Suckless and Concise Guide to the Command-line of Linux“ that will build the entire base-level understanding of shell scripting.
Books are your best companions for learning shell scripting. I can’t estimate how much books have helped me, from embedded software development to writing code in high-level code in Rust. Linux in a Nutshell (Ellen Siever, Stephen Figgins, Robert Love and Arnold Robbins) is my recommended book which I always keep as my reference book for the Linux command line.
Want to learn more cool stuff about Linux? Visit The Minimalist Book for articles related to Linux Kernel and Low-Level software development.
Thanks for reading this newsletter and stay tuned for the next one right in your inbox.
Regards,
Aditya Patil