Bash: Changing the shell to Bash

Problem

Many Linux/Unix servers are installed so that Tcsh command shell is offered to the users, even if users would prefer Bash.

The regular solution

On Hippus, there is a command chsh -s which lets you change the default command line shell. (Use the full pathname of Chsh if the previous did not work: /usr/alt/uadm2/bin/chsh -s .) Chsh asks your password and then offers a list of allowed shells and prompts you to enter a new shell. Type in /bin/bash and the system will make Bash your default shell which you get in future logins (but you have to wait an hour or so).

If the above procedure does not work, you should contact the administrator ling št csc.fi.

Ways to go around

In case normal measures do not help, one may simply start Bash by the command bash. This is a bit inconvenient as you have to repeat it at every login and you have to logout both from Bash and Tcsh.

Wizards may modify the initialization files (at one's own risk) as follows. If the machine starts Tcsh, then that shell executes some initialization files, especially ~/.tcshrc. One may insert a command at the end of it which initializes Bash:

~/.tcshrc:

exec bash --init-file .bash_init

In order to initialize the newly started Bash, one can use files ~/.bashrc and ~/.bash_profile for initializing the Bash. There are two such files because one is used at so called logins and others at other connections. For many purposes the files can be identical. In order avoid editing two files in parallel, one can use a separate file ~/.bash_init which is then included in both. (Alternatively, e.g. ~/.bash_init might source ~/.bashrc as such.)

~/.basrc and ~/.bash_profile:

# ~/.bashrc and ~/.bash_profile
# The following is intended to succeed only on Angarak, not on Ruuvi:
if [ -f /ling/loginrc/Bashrc ]; then source /ling/loginrc/Bashrc; fi
# Personal additions after this line:
if [ -f ~/.bash_init ]; then  source $HOME/.bash_init; fi
# End of personal additions
...


-- KimmoKoskenniemi - 25 Apr 2007

Topic revision: r3 - 2012-03-16 - KimmoKoskenniemi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback