Created
October 19, 2015 22:36
-
-
Save romgrk/7b607f3d280b1d60ab00 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
export ALIASES="$HOME/.aliases' | |
# CMD and UNCMD are permanent alias | |
function cmd () { | |
if [[ $# == 1 ]]; then | |
print $(alias_value $1) | |
return 0 | |
fi | |
if [[ -w $ALIASES ]]; then | |
print 'alias '$1'="'${@:2}'"' >> $ALIASES | |
. $ALIASES | |
else | |
print "Cant write file $ALIASES" | |
return 1 | |
fi | |
} | |
function uncmd () { | |
content=$(sed "/^alias $1=/ d" <$ALIASES) | |
print $content >> $ALIASES | |
unalias $1 | |
print "deleted command $1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment