Created
November 30, 2011 23:11
-
-
Save jwhitley/1411729 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alias a command only if the alias name isn't a command | |
weak_alias () { | |
if [[ -z "`whence ${1[(ws:=:)1]}`" ]]; then | |
alias $1 | |
fi | |
} | |
# alias a command only if the alias target exists | |
alias_if_exist () { | |
if [[ -n "`whence ${1[(ws:=:)2]}`" ]]; then | |
alias $1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment