Preface: I am a complete bash noob.
I want to write a simple script to toggle AppleShowAllFiles on my mac.
I am thinking something like this:
#!/bin/bash
#toggle AppleShowAllFiles
if defaults read com.apple.finder AppleShowAllFiles == TRUE
then
defaults write com.apple.finder AppleShowAllFiles FALSE
else
defaults write com.apple.finder AppleShowAllFiles TRUE
fi
killall Finder
That doesn’t seem to be working, but I am sure one of you could bash it out in 1 second flat; please commence bashing and help a lost soul!
thanks.
Here is a fixed version of your script:
The
ifsyntax of your script was a bit…well, iffy. That’s all that needed to be changed.