I'm still running El Capitan so I don't have that shortcut for show/hide hidden files. A while ago I've created automator service, which using the keyboard shortcut could show/hide hidden file depending on previous state. I've clean installed the os and decided to recreate what I did before, and I am stuck on getting if [ Commandresult = State ]; then
part to work.
#!/bin/sh
if [ defaults read com.apple.finder AppleShowAllFiles = "FALSE" ]
then
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
else
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
fi
I've seen Show/Hide hidden files without restarting finder?, but I know it could be shorter like this since I had it working with something like this before.
AppleShowAllFiles
key does not exist in thecom.apple.finder
plist file. You can quickly solve the issue by executing the following compound command in Terminal:defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder
Otherwise, you'll need to write theif
statement to handle the fact that thedefaults
command is not returning the expected boolean.defaults read com.apple.finder AppleShowAllFiles = "FALSE"
always return FALSE regardless of what AppleShowAllFiles boolean is. It is the same problem when I remove double quotation from FALSE in command.if [ defaults read com.apple.finder AppleShowAllFiles = "FALSE" ]
to:if [ "$(defaults read com.apple.finder AppleShowAllFiles)" = "FALSE" ]
Finder->Services->Toggle Hidden Files
from the menu bar.