bash Startup Scripts

I've long been customizing my shell environment, and had gotten pretty used to tcshrc. With Panther, Apple has switched to bash as the default shell, used by the majority of *nix OS's.

Well, it seemed at first that none of my changes to the .bashrc file were being saved. Then I found out you need to create a .bash_profile file to actually read your .bashrc. MacOSXHints has a post that has a bunch of stuff explaining what you might put in the file, but all you really need is this:

# source .bashrc if it's there
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

Also, I liked this line at the end:

export CLICOLOR=1

The previous solution seemed to be to download a "colour" version of ls...that line just does it automatically.

And now on to tonight's episode of what's in my .bashrc file. That way, when I switch machines or upgrade, I can just copy it from this webpage...

# -l = list view
# -a = all views, even hidden
# -h = human-readable sizes, e.g. 900B, 15K, 1.2MB
alias ll="/bin/ls -lah"

# keeps pico from line wrapping
alias pico="/usr/bin/pico -w"

Yes, this is a work in progress...still migrating over.

Comments

Thanks

I normally wouldn't comment, however I have to say that you gave the perfect amount of information needed.  You gave the simpiliest and safest contents for a .bash_profile file to make the usual .bashrc file run for a user.  Also like you mentioned (and the article you linked to mentioned) the CLICOLOR environmental variable is a great feature.

 Thanks for getting me up to speed!

 

How to run a command whenever a shell starts up?

plz do help me