restoring bashrc
i messed up my etc/bashrc file (red hat 9) and im not sure what to do.
It was an accident - i was just adding a single line - and when i removed it the file still messed things up. I was wondereing if there was anyway to restore it to the way it was before ... fix the problem ... or get a new file. here is the code and the error: Code:
# /etc/bashrc Last Login: bla bla bla : command not found : command not found : command not found : command not found : command not found 'bash: etc/bashrc: line 28: syntax error near unexpected token 'in 'bash: etc/bashrc: line 28: ' case $TERM in after that the command line starts with: "-bash-2.05b#" (no quotes), and nothing works |
The original is in
/etc/bashrc cp /etc/bashrc ~/.bashrc First backup cp ~/.bashrc ~/.bak.bashrc |
alright that helps me out a bit - but i really needed to repair my already damaged bashrc file. It has a syntax error on line 28
|
It seems like a syntax error, though I don't see one....unless "xterm*" might end up being "xterm -flag something" with spaces in it. In this case you might want to use quotes in
case "$TERM" in As a simple recommendation, try not to edit system-wide files that can be modified via a user-specific file. In this case, ~/.bashrc could be played with all you want, and if something gets messed up you can always cp -f /etc/bashrc ~/.bashrc |
i coult not find ~/.bashrc on the SSH FTP. Do i need to make it or is it just hidden from site?
EDIT: the thing i found weird is that i did not edit line 28 in any way. I simply added a new line at the top of the file, and then removed it when i saw the error. |
~/.bashrc is probably not going to be created automatically. What I'd do in the future if you dont already have a .bashrc backup is to copy the /etc/bashrc (or similarly named file) to ~/.bashrc and edit that instead of editing the system-wide rc file. Another thing you could do is modify the /etc/skel/.bashrc file. This is the one that is added to all new users' home directory.
As for the weird thing, did you log out after making the changes? .bashrc is only referenced when you open a new shell. If you're still in the same shell, even if you modified the file, it'll use the old settings. |
yes i know ive learend my lesson ... but i didnt really modify the file thats why it seems like i should be able to get it back ...
i just need to restore my etc/bashrc file to something that will work without a syntax error and i will be all set. |
Here's mine from Red Hat 9
Code:
# /etc/bashrc |
yes thats exactly what i have but i still have a syntax error on the that one line.
this is getting very frustrating :cry: |
I just copied-n-pasted your script from your first post, and ran it. No problem whatsoever. What happens if you do the same?
|
same problem ...
think its something out side the file effecting it? |
Maybe... I just read your post a bit more carefully, and saw that you wrote that you added a line at the top of the script, and then removed it. Isn't the first line in a script supposed to begin with #!/bin/bash, or whatever shell it's written in? Try adding that to the top of the script; it might even work with #!/bin/sh.
(If your own shell is set to bash, then it might be that the script is supposed to work anyway, so this idea might not work out.) |
All times are GMT -5. The time now is 12:43 PM. |