Skip to content

Instantly share code, notes, and snippets.

@rafmagana
Created August 3, 2011 17:51
Show Gist options
  • Save rafmagana/1123288 to your computer and use it in GitHub Desktop.
Save rafmagana/1123288 to your computer and use it in GitHub Desktop.
aliaz function to avoid creating aliases with existing command or aliases names
function aliaz
{
if [ -n "$1" ]
then
read COMMAND ALIAS <<<$(IFS="="; echo $1)
if command -v $COMMAND > /dev/null 2>&1
then
echo "The command or alias '$COMMAND' already exists!"
else
alias $1
fi
else
alias
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment