Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Created October 29, 2013 09:26
Show Gist options
  • Save GeneralD/7211462 to your computer and use it in GitHub Desktop.
Save GeneralD/7211462 to your computer and use it in GitHub Desktop.
Macアプリケーションをプロンプトから全てアプリ名だけで起動出来るzsh設定 ref: http://qiita.com/GeneralD@github/items/58588e22fe7bb3e10205
# aliases to Mac Applications
function app_alias() {
apps=$(find $1/*.app -maxdepth 0)
apps=(${(@f)"$(echo $apps)"})
for app in $apps
do
aliasname=$(echo $app | sed 's/.app//' | sed 's!^.*/!!')
aliasname=$(echo $aliasname | sed -e 's/ //g')
app=$(echo $app | sed -e 's/\ /\\ /g')
alias $aliasname=$app
done
}
# recursive once
function app_alias_also_subs() {
app_alias $1
subs=$(find $1/* \! -name '*.app' -maxdepth 0)
subs=(${(@f)"$(echo $subs)"})
for sub in $subs
do
app_alias $sub
done
}
app_alias_also_subs /Applications >&! /dev/null
app_alias_also_subs ~/Applications >&! /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment