Skip to content

Instantly share code, notes, and snippets.

@liufsd
Created October 5, 2016 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liufsd/b22ebc3b53fd3156595bd41ddf51b2eb to your computer and use it in GitHub Desktop.
Save liufsd/b22ebc3b53fd3156595bd41ddf51b2eb to your computer and use it in GitHub Desktop.
STATUS=`defaults read com.apple.finder AppleShowAllFiles 2>/dev/null`
if [ "$STATUS" == TRUE ]; then
STATUS=`osascript -e 'tell app "Finder" to display alert "Finder is showing hidden files." buttons {"Cancel", "Hide"}'`
else
STATUS=`osascript -e 'tell app "Finder" to display alert "Finder is not showing hidden files." buttons {"Cancel", "Show"}'`
fi
if [ "$STATUS" == "button returned:Show" ]; then
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
elif [ "$STATUS" == "button returned:Hide" ]; then
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment