Currently I am in /xhbin/tcsh. which command changes me to /bin/bash? Do I need to change the $SHELL variable or something like that?
3 Answers
To change shells temporarily, simply run the new shell. They're like any other program.
snow:~> bash
grawity@snow:~$
Use exit
or Ctrl-D to go back.
To change the shell permanently, use chsh
:
chsh -s /bin/bash
You must provide the full path to the new shell (use which bash
to find out). Also, chsh
may not work on centralized logon systems.
As @grawity mentions, chsh may not always work. I have a server for which my login shell is ksh and I like to use bash interactively. This is my ksh .profile
:
# my login shell is /bin/ksh
# this profile should spawn bash without re-invoking this profile
bash_opt='--noprofile'
[ -r .bash_profile ] && bash_opt='--login'
echo "spawning bash $bash_opt"
exec /usr/bin/bash $bash_opt