Tested on Yosemite with bash 4.3.33 (which was installed via homebrew, (http://johndjameson.com/blog/updating-your-shell-with-homebrew/).
#!/usr/bin/env bash # A Bash 4.x Script to Show Hidden Files in OSX # function show_help() { >&2 echo "Please specify what I should do with hidden files:" >&2 echo -e "\tyes (show)" >&2 echo -e "\tno (don't show)" } if [[ $# < 1 ]] ; then show_help exit 1 fi yes_or_no="${1^^}" echo $yes_or_no if [[ "${yes_or_no}" != @(YES|NO) ]]; then >&2 echo "Invalid argument '$1'" show_help exit 2 fi defaults write com.apple.finder AppleShowAllFiles $yes_or_no killall Finder