Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Billicus

macrumors 6502a
Original poster
Apr 3, 2002
981
2
Charles City, Iowa
I've tried to alias bash commands by putting something similar to the in the .bashrc in my home directory:

alias new 'old command'

That doesn't seem to be working however. I remember there was an article about it in a recent issue of Macworld and/or MacAddict. Any ideas? :confused:
 
Billicus said:
I've tried to alias bash commands by putting something similar to the in the .bashrc in my home directory:
alias new 'old command'

That doesn't seem to be working however. I remember there was an article about it in a recent issure of Macworld and/or MacAddict. Any ideas? :confused:

There's two things that are of importance when doing this:


1. Bash reads two init files: .bash_profile and .bashrc. It is a peeve of mine to have two init files, so you can do:

ln -s .bashrc .bash_profile

from your home directory.

2. You've got the syntax almost right. Try something like:

# Old habits with old programs die hard. One day I'll switch to dig.
alias nsl='nslookup'
alias mxl='nslookup -q=mx'
alias vi='vim'



To get these files read immediately, type, for example ``source .bashrc''

To verify that the alias did in fact get set either use it or type 'alias' to see all the currently set aliases.


I hope this helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.