Setting Up Unix Profiles In A Diverse Environment

I’ve recently made changes to my bash profile after getting sick and tired of managing multiple environments in one profile.

In a mac environment, I need to add a path for my Ports directories as well as other mac specific configurations. On Solaris machines, I have a different set of configurations.

Managing all of this was getting to be a chore.

So I came up with the idea to use a common profile for all environments with custom profiles for each unique environment.

I’ve been using a low footprint method to running my customized profile for a while now. Luckily, this method also lends itself to the task at hand.

You can than source each profile based on the environment you are in.

In your .profile, .bash_login, or whatever is appropriate, place the following code:

# CUSTOM SET-UP
test -e $HOME/.profile.common && . $HOME/.profile.common
test -e $HOME/.profile.mac && . $HOME/.profile.mac

.profile.common contains all my generic configurations.

.profile.mac contains all my mac customizations.

Volia! Instant environment specific customizations.


Leave a Reply

You must be logged in to post a comment.