Skip to content

Instantly share code, notes, and snippets.

@spudtrooper
Created February 27, 2011 17:45
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 spudtrooper/846362 to your computer and use it in GitHub Desktop.
Save spudtrooper/846362 to your computer and use it in GitHub Desktop.
Creates aliases for all your mac applications without name clashes. e.g. 'preview' would open '/Applications/Preview.app'. To use, add this to your .bashrc.
#
# Creates aliases for all your mac applications in $PATHS (defined
# below) without name clashes. e.g. 'preview' would open
# '/Applications/Preview.app'. To use, add this to your .bashrc.
#
# if [ -f ~/.applications.sh ]; then
# . ~/.applications.sh
# fi
#
PATHS="/Applications /Developer/Applications"
for p in $PATHS; do
for f in $p/*.app; do
a=`basename $f`
n=`echo $a | sed s/\.app// | tr '[A-Z]' '[a-z]' | tr '[. ]' '-'`
if [[ `which $n` == '' ]]; then
alias $n="open $f"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment