Link to home
Start Free TrialLog in
Avatar of southray
southray

asked on

How Do I Add a PATH environment variable to the .bashrc File

Newbie Ubuntu question.  I am trying to learn both Ubuntu and Ruby on Rails.  One of the suggestions is to add the following to the .bashrc file:

export PATH=/var/lib/gems/1.8/bin:$PATH

I have copied this at the end of the bash file under the last fi at the bottom.  Is this OK?  What is the function of the fi statement in the bash file?

Looks like I am going to be giving away of mountain of newbie points in he next few weeks.

TIA
Avatar of mhamel06
mhamel06
Flag of United States of America image

Sounds OK; you can test things out by typting:
  source ~/.bashrc
which will run your .bashrc file and then you can see if it worked by typing:
 echo $PATH
to see if your ruby path is there at the beginning of the path setting

If that doesn't work, what does your .bashrc file look like?
Avatar of southray
southray

ASKER

jesii,  

When I run your commands, nothing happens.  It just starts a new prompt.

My bash file is unmodified except for the last line I added.  Here is the end of the bash file (I dont know how to copy the entire contents)



# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi



# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi
export PATH=/var/lib/gems/1.8/bin:$PATH


ASKER CERTIFIED SOLUTION
Avatar of JESii
JESii
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Jesii.  Keep looking for me ... my newb questions will make you a rich in experts exchange points!
You got it, @southray - thanks! Glad I could help!