Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-13-2009, 05:00 AM   #1
Registered: Mar 2009
Distribution: Fedora 8, Ubuntu 9.10, SuSE 10, Fedora 14
Posts: 98

Rep: Reputation: 15
Can't seem to change to C-shell


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:

[compchem@gnlserv01 ~]$ /bin/csh
/root/bin/Segmentation: Permission denied.
[compchem@gnlserv01 ~]$ su -
[root@gnlserv01 ~]# su - compchem
[compchem@gnlserv01 ~]$ /bin/csh
[compchem@gnlserv01 ~]$ echo $SHELL
For root:
[root@gnlserv01 ~]# /bin/csh
[root@gnlserv01 ~]# echo $SHELL
I really need the C-Shell, because I don't know how to 'translate' everything for the bash.

How do I cure this?
Old 05-13-2009, 05:06 AM   #2
Senior Member
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Can you try and change your default shell to c shell in /etc/passwd and see if it is available?
Old 05-13-2009, 05:11 AM   #3
Registered: Feb 2009
Location: Hyderabad
Distribution: fedora
Posts: 33

Rep: Reputation: 17
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

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
Old 05-13-2009, 05:12 AM   #4
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
You can use the chsh command to change your login shell. Use
chsh -l
to see if /bin/csh is available as login shell. Then just do
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:
Old 05-18-2009, 06:06 AM   #5
Registered: Mar 2009
Distribution: Fedora 8, Ubuntu 9.10, SuSE 10, Fedora 14
Posts: 98

Original Poster
Rep: Reputation: 15

Thanks! Your advice worked!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't change shell in plink shell script? lhouk Programming 2 08-02-2007 02:47 PM
Shell won't change! jaykup Linux - Newbie 2 05-11-2007 07:20 AM
change the shell prompt ust Linux - Distributions 5 04-28-2005 03:26 PM
shell script + change shell && continue darkRoom Programming 6 02-25-2005 02:50 AM
Change shell language linmix Linux - Software 9 07-26-2004 12:45 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration