Solved

/root/.bashrc error

Posted on 2006-06-22
8
1,079 Views
Last Modified: 2011-08-18
Hi, I thought I made a very serious mistake.

I modified /root/.bashrc using vi and adding some path in it like:
export JAVA_HOME=/opt/jdk1.5.0_07
export PATH=/opt/jdk1.5.0_07/bin
Now, I am not able to use vi, chmod, cp, mv, cd /root...etc

Does there have anyway I can recover the file?

I use fedora core5.
0
Comment
Question by:ddlam
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 14

Expert Comment

by:DonConsolio
ID: 16962562
try:

/bin/mv .bashrc .bashrc.old
0
 
LVL 5

Assisted Solution

by:csgeekpyro
csgeekpyro earned 50 total points
ID: 16962577
change the PATH line to read and everything should be fine:

export PATH=$PATH:/opt/jdk1.5.0_07/bin

Then just run:

source ~/.bashrc

0
 
LVL 14

Assisted Solution

by:DonConsolio
DonConsolio earned 50 total points
ID: 16962593
the correct setting would be:

>export JAVA_HOME=/opt/jdk1.5.0_07
ok
>export PATH=/opt/jdk1.5.0_07/bin
PATH="$PATH:/opt/jdk1.5.0_07/bin"
0
 
LVL 11

Accepted Solution

by:
kblack05 earned 350 total points
ID: 16962741
You need to add the server environment to the path. In your path statement of the .bashrc make sure you include not only the paths you need but the server path also:

PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:/opt/jdk1.5.0_07/bin

Regards,

~K Black
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 5

Expert Comment

by:csgeekpyro
ID: 16963184
In an FC5 system, those paths are already in the $PATH var when .bashrc is sourced.  Most likely, he was editing the script and forgot to replace the $PATH token in the export statement.  I've made that mistake myself.
0
 
LVL 5

Assisted Solution

by:arvind
arvind earned 50 total points
ID: 16967110
type following on root prompt

export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/jdk1.5.0_07/bin


0
 
LVL 9

Author Comment

by:ddlam
ID: 16970744
Thanks all nice guys very much. I am ready to reinstall whole system but your answers sloves my big troubles.

I set the path
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:/opt/jdk1.5.0_07/bin

then correct ~/.bashrc

It works fine now.
0
 
LVL 11

Expert Comment

by:kblack05
ID: 16970795
I'm not sure why you would want to re-install the system...

Another handy trick here is to use the 'env' command piped to less

env | less

or even to grep

env | grep -i PATH

You would have seen that the path looked very short before.

Thanks and good luck!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now