Jump to content

Changes to bashrc file


Guest elr008
 Share

Recommended Posts

Guest elr008

Basically, I modified my bashrc file without backing it up first, and, after I modified it, none of my commands like ls will do anything.

 

I added the following code to the startup file (~/.bashrc):

 

PATH=/usr/local/jdk1.6.0/bin:

export PATH

 

I just typed in this code at the end of the file, saved it, and logged out and back in. When I logged back in, no commands like ls or man will work anymore.. Does anyone know a solution to this?

 

Thanks

Link to comment
Share on other sites

You have reducedthe path (list of places BASH looks for the program you want to start) to the Java DK only. The default PATH is /bin:/usr/bin:/usr/local/bin:/usr/games: (the ':' is used as separator). Mandriva sets defaults like this via a whole bunch of files. Following should in your .bashrc to get htis fixed (but I am not 100% that this actually covers the PATH variable):

 

if [ -f /etc/bashrc ]; then
       . /etc/bashrc
fi

 

Other files that are relevant are /etc/bashrc obviously and /etc/profile

Link to comment
Share on other sites

  • 1 month later...

This may be a solution (it will erase any line in your file with the “PATH†sentence in it):

/bin/sed -i /PATH/d ~/.bashrc

 

Or you may try and cure the problem instead, by adding the “normal†path after your own:

/bin/sed -ri 's#^PATH=(.*[^[:blank:]]):*[[:blank:]]*$#PATH=\1:$PATH#' ~/.bashrc

 

Yves.

Edited by theYinYeti
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...