PDA

View Full Version : Accidently changed my shell



j103c
03-27-2004, 02:07 PM
Somehow I accidently changed my shell through SSH. I can now see either:

sh-2.05a$
or
bash-2.05a$

The more important problem is, I can't type "cpan" and have it be recognized anymore. Any idea how to get back the to the shell that shows "[domain] [~}$"?

More importantly, hopefull reverting will bring cpan back..

FZ
03-27-2004, 02:14 PM
Were you trying to (specifically) install a different shell? Or did you just accidentally change some settings?

The first thing you should check is if your .bashrc (located in / - i.e. the root folder) still exists and isn't empty. If it is, then let me know and I'll provide you with the default code that goes in it. If you haven't tried replacing your shell, this is most likely the cause of your problems (because "cpan" is an alias for the command "perl -MCPAN -e shell", and aliases are defined in this file). Also, check .bashrc's permissions (via SSH) and make sure they match: -rwxr-xr-x

j103c
03-27-2004, 02:17 PM
FZ- I think in following different directions I accidently changed some settings. I check and the .bashrc file in root is empty, so I guess I need the default settings..

Thanks!!

FZ
03-27-2004, 02:23 PM
Hmm, if only I was always this good at troubleshooting ;)

Here's what the default file (usually) contains:


export PAGER="less"
export EDITOR="pico"
export VISUAL="pico"
export PS1="[\u][\w]$ "
export HOME=/home/${USER}
export PATH="$PATH:/usr/local/apache/bin"

if [ -d "/usr/local/ImageMagick" ]; then
export LD_LIBRARY_PATH=/usr/local/ImageMagick/lib
export PATH="$PATH:/usr/local/ImageMagick/bin"
fi

alias e="vi"
alias grep="grep -i"
alias du="du -h"
alias df="df -h"
alias mv="mv -i"
alias cp="cp -i"
alias rm="rm -i"
alias l="ls -Al --color"
alias dir="ls -l"
alias lsd="ls -F"
alias more="less"
alias psx="ps aux"
alias psg="ps auxwww | grep -v grep | grep -i"
alias cpan="perl -MCPAN -e shell"
alias untar="tar -xpvf"
alias untarzip="tar -zxpvf"
alias cls="clear"
alias copy=cp
alias move=mv
alias deltree="rm -r"
alias xcopy="cp -a"
alias del=rm
alias restart='/etc/rc.d/rc stop; /etc/rc.d/rc start'


Also, if you want to restore the functionality of delete, home and end keys when you are in an SSH session, add this code to the bottom of your .bashrc:


# Bind Delete, Home and End keys
bind \"\\e[1~\":beginning-of-line
bind \"\\e[3~\":delete-char
bind \"\\e[4~\":end-of-line


Let me know if that fixes things for you. NOTE: you will need to quit your SSH session (if you are in one when you restore your .bashrc) before the settings take affect.

UPDATE: I made a small change to the above code (added a space after the $). Also, I just noticed one or two other (small) things that seem to be my personalization of the default settings, so you might notice slightly different behavior. If it bothers you, just ask WestHost to restore your .bashrc for you.

WestHost - MMellor
03-27-2004, 02:25 PM
-j103c

If you add this line to your .bashrc then I believe it will fix your problem:
alias cpan="perl -MCPAN -e shell"

Try this out and keep us posted on your progress.

j103c
03-27-2004, 02:33 PM
Ahh - you all rock. Worked - thank you!

I'm assuming moderators here get paid for their help, but how do we nominate forum members for free extra hosting addons and such? :)

FZ
03-27-2004, 02:35 PM
Hehe, I'm glad it worked ;)

WestHost - MMellor
03-27-2004, 02:37 PM
Glad to see that you got that working. Let us know if there is anything else we can help you with.

sokat
08-05-2004, 08:49 AM
how can i restore functionality of the INS key as well?
thanks for those hints FZ

FZ
08-05-2004, 11:10 AM
No idea - have you tried searching Google?

I didn't actually "discover" the home/end/delete code, someone suggested it on the forum a while back...

sokat
08-05-2004, 01:39 PM
no need to be so mean, don't have an answer? don't answer.
I happened to read that thing that answered some of my questions by chance in your post that was dealing with other issues, just thought you'd know more. don't? why be mean then? did I offend you?

FZ
08-05-2004, 02:01 PM
Was I being mean?! I simply suggested that you should try Google, because I don't have an answer. I guess I should make sure to not omit the word "sorry" from posts like those in the future ("sorry, I don't know everything" ;)). Not answering is what would have been mean...

Why would you have offended me?!

jalal
08-05-2004, 02:28 PM
Fayez has never been mean.
You be nice to him... when you're stuck, he's the guy to get you out of the shit....

:)

wildjokerdesign
08-05-2004, 02:30 PM
Dito... I agree! Without Fayez many of us would get stuck. Him and Jalal that is. :P