Link to home
Start Free TrialLog in
Avatar of rsorrent
rsorrent

asked on

Switching to Korn shell

My user account is placed in the C-shell by default. I would like to have the Korn shell as my default shell. What file(s) need(s) to be modified and what commands are used?
ASKER CERTIFIED SOLUTION
Avatar of jpainter
jpainter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
a general purpose UNIX solution (in addition to jpainter's AIX suggestion);

edit /etc/passwd, in the line containing your user account at the beginning, change the path to the login shell (currently /bin/ksh or similar) to your desires. The login shell is the last field in the line (fileds are seperated by colons).

Avatar of ecw
ecw

Or on BSD derived systems though pretty much on every SYSV, use chsh(1)

 There is a way to do this by not asking the System Administrator. If your shell is C you can switch to bash, and ksh(Korn Shell) simply by making some scripts at your home directory and you will log in the shell you want. Please post you UNIX flavor and I will gladly make a script for you(I have done the similar thing with switching from C to bash in Solaris 2.5.1 by using a script in .login). By the way such script for such thing is not more than 12 lines and usually as I far as I imagine that it should work virtually in every Unix flavor.
 

 well, on Solaris to switch from CSH to KSH(Korn Shell) without letting the "root" do the following procedure. If your system is different from Solaris please post it to work out some details.

 Assumption: You have now an account(CSH -- C Shell)
 1) Make a hard link as follows:
 
 % ln -s /usr/bin/ksh ./-ksh
 (assumption: ksh is in /usr/bin/ksh -- find in your system)
 
 2) Add these lines in the top of the .cshrc file at home dir.

 setenv SHELL /usr/bin/ksh
 if ($?TERM) then
 cd
 exec -ksh
 else
 exec $SHELL
 endif
 echo "ERROR -- Unable to switch the shell to ksh"

 That is all. When you put those lines in  the top of your .cshrc you will be switched as in ksh in login despite the fact that you are assigned by system admin(root) to use csh.
 
 That is all. Good Luck.
 
The easiest way to change your login shell (especially if you don't have root) is the "chsh" utility.  As far as I know, this utility is available on most platforms.