Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Last active January 31, 2018 15:39
Show Gist options
  • Save GeneralD/92df664394212345b3354da052103641 to your computer and use it in GitHub Desktop.
Save GeneralD/92df664394212345b3354da052103641 to your computer and use it in GitHub Desktop.
# Mac Applications in 'Applications' directories -> runnable from the terminal
() {
local app dir
for dir in $@; do
for app in $dir/*.app(N); do; alias ${app:t:r:gs/ //}="open -a ${app:gs/ /\\ /}"; done
for app in $dir/*/*.app(N); do; alias ${app:t:r:gs/ //}="open -a ${app:gs/ /\\ /}"; done
done
} /Applications ~/Applications
# Open the directory with Finder (Open current directory without argument)
alias Finder='() {open ${1:-.} -a Finder}'
alias f=Finder
# if ‘Xcode-beta’ is selected Xcode, aliased to ‘Xcode’
() {
local selected=${${$(xcode-select -p)%%.app/Contents*}##*/}
if [ $selected != "Xcode" ]; then
alias Xcode=$selected
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment