Nas condições if , você deve usar o comando defaults read , e não write . Caso contrário, o resultado é sempre verdadeiro e, claro, o elif nunca é executado.
Além disso, essa não é a sintaxe das condições if . Você deve usar:
if [ $(command) == "TRUE" ]; then
Mas, neste caso, talvez algo assim seja menos detalhado:
STATUS=$(defaults read com.apple.finder AppleShowAllFiles)
case "$STATUS" in
"TRUE") OPTION="FALSE" ;;
"FALSE") OPTION="TRUE" ;;
esac
defaults write com.apple.finder AppleShowAllFiles $OPTION
killall Finder