Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thoroc/a0b01517e1b156421403369543ba8690 to your computer and use it in GitHub Desktop.
Save thoroc/a0b01517e1b156421403369543ba8690 to your computer and use it in GitHub Desktop.
Command for creating new aliases from the previous command
## source: https://medium.com/the-lazy-developer/an-alias-for-new-aliases-c6500ae0f73e#.76kiw5euv
new-alias() {
local last_command=$(echo `history |tail -n2 |head -n1` | sed 's/[0-9]* //')
echo alias $1="'""$last_command""'" >> ~/.bash_profile
. ~/.bash_profile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment