if else in mac terminal

Shell
#!/bin/bash

defaultsReturn=$(defaults read com.apple.finder AppleShowAllFiles)

if [ '1' = "$defaultsReturn" ]; then
    echo "AppleShowAllFiles is enabled"
elif [ '0' = "$defaultsReturn" ]; then
    echo "AppleShowAllFiles is not enabled"
else
    echo "defaults returned some other value: $defaultsReturn"
fi

Source

Also in Shell: