[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Handy Bash alias script



a.list.address@gmail.com wrote:
I don't know why I didn't do this sooner.  Am I just late to the party?  =)

I couldn't figure out a way to do this without using a script.  I
wanted to just make a one-line alias to do this with existing shell
commands, but I couldn't figure it out.  Let me know if there's a way.
Anyway, this works quite well.  Time-saving, here I come!

Directions:

1.  Save to directory of your choice.
2.  Create a symlink in bin of your choice (I use ~/.bin), just make
sure it's in your PATH.  Don't forget to make the script executable.
3.  Add ". $HOME/.bash_custom_aliases" to your ~/.bashrc.
4.  Run $(newalias aliasname "alias commands").
5.  Try out your new alias.

Works great when you just scroll to a command in your history, go to
the beginning of the line, type newalias, and then put the command in
quotes.  Now you never have to type that long command or dig through
your history again!

Why not just

$ echo alias aliasname=\"alias commands\" >> ~/.bashrc

?

Cassiano Leal



Reply to: