Changing from one shell to another

Hi all,I installed cent OS in my machine. Now when i open the terminal and start writing some commands, then by default with which shell i am working with?

Will i be able to change the shell and then run a few commands? if possible then how to change the shell?

Please reply

Thank you

By typing the corresponding command for Shell,
for ex: for bash it is
#bash and yr shell will be changed.

So you want to say that #csh will change the current shell to c shell,correct?

What is the system command to check in which shell i am working at present?

echo $SHELL
will print current shell.

ok First i did this:

#ksh

then i did this:

echo $SHELL

The output i get is this:

/bin/bash

why not the output is /bin/ksh then?

---------- Post updated at 04:05 AM ---------- Previous update was at 03:57 AM ----------

every time i write this:

echo $SHELL

the output is /bin/bash

after #ksh, if i do this: echo $SHELL

then also the output is /bin/bash

So?????getting confused

if you want to change your shell just edit bash to ksh in the /etc/passwd file end of the your username file.for example your username is oracle

 
vi /etc/passwd
oracle:x:250:302:Oracle User:/export/home/oracle:/bin/bash

change bash with ksh and save the file

1) Don't edit /etc/passwd directly unless you really know what you are doing. If you do have to do it in an emergency, use "vipw" and definitely not "vi".

To change a default shell for a user just use the "usermod" command.

2) If you log in with one shell and want to change to another shell which is installed on your computer, just type the path to that shell:
e.g.
/usr/bin/ksh

(i.e. Don't type a # character).

If the shell does not change it can be because some Linux machines link all likely shell names to "bash".

You can also use "ps -p$$" to view the name and the current PID associated with your shell.

In some Linux systems you can use "chsh" to change your default login shell.

The reason is that the variable "SHELL" is set only in the first shell which is started, not in any shells strated subsequently. I ran across this phenomenon when i tried to create a shell-independent script and wanted the script to be aware under which shell it is being run.

If your standard shell in /etc/passwd is "ksh" then "echo $SHELL" will say "ksh", even if you have started a bash instance in the meantime. If your standard shell is "bash" it will read "bash" even if you started a ksh.

What you can do is expand the variable "${.sh.version}", which is specific for the ksh and only set if the current shell is running. On the other hand you can expand the variable "$BASH_VERSION" only if a bash is running:

# echo $SHELL
/bin/ksh
# echo ${.sh.version}
Version JM 93t+ 2010-06-21
# bash
# echo $SHELL
/bin/ksh
# echo ${.sh.version}
bash: ${.sh.version}: bad substitution
# echo $BASH_VERSION
4.1.2(1)-release
# exit
# echo ${.sh.version}
Version JM 93t+ 2010-06-21
# echo $BASH_VERSION

I hope this helps.

bakunin