Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
 
PREVIOUS NEXT
Tagged: #mac #terminal
ADD COMMENT
Topic
Name
4+9 =