• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Editing the bashrc file

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I somehow messed up my bashrc under /etc/bash.bashrc when I was trying to set Maven and Java home variables. Now when I open my terminal, it complains that it cannot find /usr/bin. I'm not able to remove the PATH variable that I have set when trying to set Java and Maven home. Now I'm even not able to execute the sudo command. Is there a way to edit this file and restore everything?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I gte the following message when I open my terminal



 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Login as root (which should have an OK environment) and edit it as root. Don't forget to fix the permissions after, if needed!
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have only one user created. How do I log in as root?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried giving root as username and root as password and was not able to log in... tried giving only the username as root with empty password, also not able to log in... Any ideas?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just managed to get rid of this by typing /usr/bin/sudo su and then was able to edit the bashrc file.
 
Saloon Keeper
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Incidentally, on a RedHat/Fedora system, the master bashrc comes from the RPM named "setup". You'd have to forcibly reinstall it or install to an alternate location and copy the /etc/bashrc original file from the alternate location.

Of course, all of the above requires that you be running as root.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most Unix systems allow you to boot into single user mode at the time you boot the computer. However without knowing anything at all about what flavor of Unix / Linux / ... it is difficult to advise on how to do this.
 
Tim Holloway
Saloon Keeper
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both Grub and LILO allow single-user boots as long as you haven't disabled the ability to edit the boot directives. Just add "single" to the list of options on the "kernel" directive.

My normal panic recovery is just to boot off a Fedora/RedHat/CentOS install cd/dvd and when the intial screen displays, type in "linux single" at the prompt. That way I can modify files that would be difficult to maintain if I was actually running under them.

Incidentally, the original messages indicated that the variable name wasn't provided on an export command. That is, instead of


it was coded incorrectly as


Actually, I suspect that there was a directory named "Apache Foundation", and it's possible that the actual offending statement was more like


which I think would be interpreted as 2 separate exports separated by the blank in the directory name "Apache Foundation"

This is why "user friendly" names with embedded spaces in them are bad.

If you absolutely positively insist on spaces in pathnames, code the directive like one of the following:


The one with quotes around it is somewhat safer for most of us.


 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic