Forwarding Address: OS X

Monday, February 14, 2005

Bash aliases

I was a tcsh guy from way back but with the recent complete clean install of my system I figured it was time to move over to bash. Of course I didn't want to lose the aliases I'd created so I figured I'd move those over to, but where to put them?

After googling the interweb and finding no less than half a dozen different suggested files to stick them into, none of which worked, I finally found the answer and it is:
In OS X you define your bash aliases in .bash_profile in your home directory.

7 Comments:

  • Anyone around here using zsh?

    By Blogger Faisal, at 9:39 AM  

  • I think .profile is a good choice as well.

    By Anonymous Nathan Nutter, at 9:47 AM  

  • My .bash_profile looks like this:

    [ -r ~/.bashrc ] && source ~/.bashrc
    And then I have my aliases, etc. in .bashrc. I'm not sure why I do it this way; I think it was set up by default on either OS X or FreeBSD.

    man bash has an overwhelming amount of information, from which I gather that .bash_profile is read for login shells (only), whereas .bashrc is read for interactive non-login shells. The above method makes all interactive invocations of bash behave the same way.

    By Anonymous Nate Silva, at 4:09 PM  

  • Good stuff Nate, and thanks. I was wondering about that since I'd seen it elsewhere but never explored it.

    By Blogger Chris, at 7:50 PM  

  • so I am addin gmy first alias into bash. I want to simply something that I have been manually typing every day. So I am starting a Coldfusion server instance in Jrun. The basic steps are this:

    cd /Applications/JRun4/bin
    ./jrun -start myCFServer &

    So I added this to an alias. The first line runs fine, but on the next line I keep getting the error "-bash: ./jrun: No such file or directory". I am assuming there is some issue with the "./" part of "./jrun" but I am not sure what to do with it. I have tried to escape it with a \ character with no luck. Anybody have any idea?

    By Anonymous pmolaro@gmail.com, at 8:10 PM  

  • you might try:
    alias cf='(cd /Applications/JRun4/bin && ./jrun -start myCFServer ) &'

    By Anonymous Anonymous, at 6:59 AM  

  • ColdFusion Courses allows Automate processes and improves communications with ease.
    ColdFusion offers a Simplified database access, which really helps with workflow.

    By Blogger Alicia T, at 12:07 AM  

Post a Comment

<< Home