LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't seem to change to C-shell (https://www.linuxquestions.org/questions/linux-newbie-8/cant-seem-to-change-to-c-shell-725649/)

Azazwa 05-13-2009 05:00 AM

Can't seem to change to C-shell
 
Hi!

I know that if one uses the "/bin/csh" then you're supposed to go to the C-Shell. If I do that, and then say "echo $SHELL" I get "/bin/bash". Also, the default prompt for csh is "%" and "$" for bash, am I right? But I never see "%" when I use a normal user, and with root it always seems to be "#". With the normal user, it sometimes says, "permission denied" but I've put this in the code segment below.

For the normal user:

Code:

[compchem@gnlserv01 ~]$ /bin/csh
/root/bin/Segmentation: Permission denied.
[compchem@gnlserv01 ~]$ su -
Password:
[root@gnlserv01 ~]# su - compchem
[compchem@gnlserv01 ~]$ /bin/csh
[compchem@gnlserv01 ~]$ echo $SHELL
/bin/bash

For root:
Code:

[root@gnlserv01 ~]# /bin/csh
[root@gnlserv01 ~]# echo $SHELL
/bin/bash

I really need the C-Shell, because I don't know how to 'translate' everything for the bash.

How do I cure this?

linuxlover.chaitanya 05-13-2009 05:06 AM

Can you try and change your default shell to c shell in /etc/passwd and see if it is available?

kpraveen455 05-13-2009 05:11 AM

Hi Brother,

It is simple... change your default shell using the command "chsh", as shown below:

$ chsh -s /bin/csh
<it may ask user login password>

$ echo $SHELL
/bin/bash

Here you will observe the "SHELL" variable to be still "/bin/bash". I think this "SHELL" env variable will be initialized at the time when user logs in. Please logout and login again.

After re-login:

$ echo $SHELL
/bin/csh

colucix 05-13-2009 05:12 AM

You can use the chsh command to change your login shell. Use
Code:

chsh -l
to see if /bin/csh is available as login shell. Then just do
Code:

chsh -s /bin/csh
to change it. You will be prompted for password. Then logout and login to make all the changes to take effect. Anyway, take in mind that you don't need to use /bin/csh as interactive shell if you have only some C-shell scripts to run. Putting the correct sha-bang at the beginning of the script should be enough:
Code:

#!/bin/csh

Azazwa 05-18-2009 06:06 AM

[Solved]
 
Thanks! Your advice worked!


All times are GMT -5. The time now is 04:44 PM.