mac terminal if statement code example
Example: if else in mac terminal
#!/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