sethmason.com The internet resource for all things Seth Mason.

Posted:
Jun 10 2008 @ 11AM

Tagged:
,

Machine specific startup files in BASH

Here’s a helfpul tip if you use a couple of different machines and need specific things set up on a specific machine.

Just add the following to your .bashrc

## Read Generic RC                                                                            
for rcfile in "$HOME/.shell/"*.rc;
do                        
    if [ -r "$rcfile" ]; 
done                        

Thus, common things are stored in your .bashrc (like aliases, functions, etc.) and things you want on a specific machine are in their own directory.

Then, just put whatever machine specific files you want/need in ~/.shell and name them with .rc. For instance, I have ~/.shell/smurf.rc that sets up some smurf information.

export FAVORITE_SMURF="Poppa Smurf"
export SMURF_LOVER=$HOME/bin/blue_love  

That way, if I ever need something that’s specific to a machine, I just drop it in my .shell directory and away we go.

AddThis Social Bookmark Button

No comments yet.

I've left comments off for this article, but if you've got something add or say, feel free to send me an email.