Last active
August 29, 2015 13:56
-
-
Save connormckelvey/9275367 to your computer and use it in GitHub Desktop.
Bash Function for adding new aliases
This file contains hidden or 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
#add alias | |
function newalias() { | |
echo alias $1=\"$2\" >> ~/.aliases | |
source ~/.bash_profile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was sick of opening vim to add an alias, closing and then reloading .bash_profile so here is a nice function that does it for you.
If you don't store you aliases in a separate file (Which I recommend doing) then be sure to change .aliases to .bash_profile.
Function is called like so:
newalias 'test' 'echo test'