How do I restore the default bashrc?

Move the damaged file out of the way, then reinstall the package that provides the damaged file.

mv /etc/bashrc /etc/bashrc.damaged
yum reinstall $(rpm -qf /etc/bashrc)

Did you overwrite the .bashrc in your user directory? Or the systemwide .bashrc stored in /etc/skel/? You can always copy the default.bashrcfrom/etc/skel/` like this:

cp /etc/skel/.bashrc ~/.bashrc

EDIT: In the comments below the original poster states:

I did echo export EDITOR=/usr/bin/nano > /etc/bashrc when I should have written >>.

Okay, that explains what went wrong. But in general, anyone who suggests Linux/Unix system files be adjusted by using >> concatenation should be publically shamed forever. The problem is exactly what you ran into. All that >> does is append the contents to the left of >> to the item top the right of >>. It seems slick and fast, but in my humble opinion you are much safer just opening the file in an editor and adding whatever you need to add to the end of the file. Just do this:

sudo nano /etc/bashrc

Add whatever you need to add to that file, save it and move on.

Tags:

Bash

Bashrc