#!/bin/bash # BASH doesn't actually understand booleans. # What you can do however is to trick it by using the fact that the true and false commands return 0 and 1, # so it can stand in for boolean algebra if used correctly. BOOLEAN1=false if $BOOLEAN1; then echo "We won't get here because BOOLEAN1 is false." fi if ! $BOOLEAN1; then echo "But we DO get here." fi BOOLEAN1=true if $BOOLEAN1; then echo "Now we do get in this as it's been set to true." fi if ! $BOOLEAN1; then echo "And now we DON'T get here." fi