View Full Version : .bashrc
starrin
Jan 8, 2005, 08:53 PM
I am trying to add certain extra directories to my path when I open a Terminal window -- my understanding is that I would put this in my .bashrc file. The problem is that I do not see this file in my home directory---should I?
If I had to create one -- is there an example someone can point me to in order to make it right?
Thanks in advance.
You need to create one; here (http://www.savagetranscendental.com/tip3.html) is a dated but still relevant example.
Good luck, and report back if you have any problems!
Also useful if you want to alter your default shell to something other than bash:
http://www.chemistry.ucsc.edu/~wgscott/xtal/shells.html
starrin
Jan 8, 2005, 09:37 PM
Hi and thank you for your help --
I created a .bashrc file and placed it in my home directory and my settings are not coming through -- here are my settings - again thanks for any input:
# Set JAVA_HOME
export JAVA_HOME=/Library/Java/Home
# Set Classpath
export CLASSPATH=/Users/jason
# Entries for ANT
export ANT_HOME=/Users/jason/Development/SoftwareDownloads/apache-ant-1.6.2
export PATH=$PATH:$ANT_HOME/bin
export CLASSPATH=$CLASSPATH:$ANT_HOME
# Entries for Maven
export PATH=$PATH:/Users/jason/Development/SoftwareDownloads/maven-1.0.2/bin
export MAVEN_HOME=/Users/jason/Development/SoftwareDownloads/maven-1.0.2
Westside guy
Jan 8, 2005, 09:52 PM
If you've got an existing .bash_profile file, you should add the following to it:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
starrin
Jan 8, 2005, 09:59 PM
Hi -- searching other posts I came across that -- but I have no .bash_profile file
I have a .profile file....
Thanks for the help
starrin
Jan 8, 2005, 10:20 PM
Okay -- I changed the name of my .bashrc file to .bash_profile (and added quotes to my exports) -- it all works
So -- should I keep my .bashrc file and make a .bash_profile file call it with the code above? What does that do for me?
Thanks in advance.
Dunno. :confused:
I thought that the profile always called the resource file during login (see here (http://www.cs.williams.edu/help/locals/node3.html)) but I'm not even vaguely a guru in this area.
Westside guy
Jan 9, 2005, 04:43 PM
So -- should I keep my .bashrc file and make a .bash_profile file call it with the code above? What does that do for me?
Short answer is: yes, do it. :D
.bash_profile gets called when your shell is a login shell (which, if you're using Terminal, it generally is). However it won't get invoked by non-login shells; but .bashrc will.
This probably won't matter to you in the least. :D But it is more flexible, if sometime in the future you get bored and start playing with bash.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.