Jump to content
Guest elr008

Changes to bashrc file

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

To add a directory to the path, try something like:

 

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

export PATH

 

Jim

Edited by jkerr82508

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...