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

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...
 Share

×
×
  • Create New...