Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2017 10:06
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 anonymous/68485bd59947e30e3972fe0f8be6dcd6 to your computer and use it in GitHub Desktop.
Save anonymous/68485bd59947e30e3972fe0f8be6dcd6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
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