There are no Booleans in Bash Commands

The last time I had to read a bash shell script was back in 2016 when I first started school and taking a unix course. I wasn’t great at bash shell scripting, but I would say I was proficient enough to get by. Five years later, I’m sitting in front of my computer. This time, I’m trying to get something done for the company I work for, which I’m being paid to do. I find myself dumbfounded as if I’ve encountered these commands for the first time. While I’m better equipped this time around having retained some basic concepts, it really shows how a lack of practice can make you rusty.

So here I am, relearning BASH again; But you didn’t come here to hear me talk about this.

As I revisit writing conditional statements for the bash script I’m developing, I was hoping to find some way to represent true and false as I use it regularly in software development.

It turns out, there are no boolean values in BASH, which is why it is often represented using 1 and 0 instead. I guess that makes BASH a lot easier to reason able by having just strings and numbers as data types.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s