# Why C-shell derivatives?



## fnoyanisi (Jul 28, 2015)

Hi there,

Historically (I mean in the very old days even before FreeBSD), BSD UNIX used to ship with csh(1), is this the reason behind FreeBSD's choice of tcsh(1),which is a C-shell compatible shell rather than being sh-compatible, as the default login shell?

Using /bin/sh as the scripting shell and having another default login shell looks a bit odd to me, why not learn only one and tweak it for daily use as well?

PS: This is off-topic, so not seeking for "you can use chsh(1)" to change your shell kind of answers.


----------



## jmccue (Jul 28, 2015)

FreeBSD use to have the "real csh()" but some were around 4.x it was changed to tcsh().  I believe that was done because tcsh()  is a bit more robust and I think bugs were corrected/removed.


----------



## Beastie7 (Jul 28, 2015)

fnoyanisi said:


> Historically



There's your answer.


----------



## fnoyanisi (Jul 28, 2015)

Beastie7 said:


> There's your answer.



Yes, maybe....

Well, there are dozens of stuff in the Internet that suggest avoiding csh(1)/tcsh(1). Of course it is a matter of taste, like enjoying the car you are driving, but it makes one to wonder why FreeBSD sticks with those shells as the default login shell (Is it because bash(1) GPL'ed?)


----------



## Beastie7 (Jul 28, 2015)

Because there's no objective reason to change the default interactive shell in base, for FreeBSD. The shell is supposed to be lightweight, stable, and simple; tcsh is exactly that. Time and history has kept it that way.



fnoyanisi said:


> Yes, maybe....
> 
> Well, there are dozens of stuff in the Internet that suggest avoiding csh(1)/tcsh(1).



There's a lot of stuff on the internet suggesting to avoid a lot of stuff, it doesn't mean people should follow through.


----------



## scottro (Jul 28, 2015)

The simple answer is because, as has been said, it was historical.  By the way, never change root's shell.  I have an old posting on this on daemonforums.org. 

http://daemonforums.org/showthread.php?t=666

As you can see from that, you can always use the toor account if you want a Bourne shell.  

I'm far from an expert at shell scripts, and when I do write them, I use sh or other Bourne style shells.  I've heard it said that such shells are better for scripting, which may be what you're referring to when you say you've seen things saying to avoid it.    I suspect changing this would be more effort than it's worth, especially as it is easy for anyone, including root, to use another shell language to write scripts.   Just don't go changing root's shell because if you do have to boot into single user mode, you may find yourself without a shell.


----------



## wblock@ (Jul 28, 2015)

fnoyanisi said:


> Well, there are dozens of stuff in the Internet that suggest avoiding csh(1)/tcsh(1).


That's not quite accurate.  The recommendation is to avoid writing scripts in csh(1), which makes sense.  However, csh(1) is a nice interactive shell, and using it that way along with writing scripts in sh(1) works well.


----------



## Cthulhux (Jul 28, 2015)

Why would the `csh` actually be a better interactive shell than, for example, `ksh`?


----------



## freethread (Jul 28, 2015)

I use it in Windows too, version 6.19.00 compiled with VS 2013 both x32 and x64. Changed the icon, not so important and modified the code to save history in $home/.history. It works (and compile) better than the previous version.


----------



## wblock@ (Jul 28, 2015)

Cthulhux said:


> Why would the  csh actually be a better interactive shell than, for example,  ksh?


It is in the base. 

There are other shells with more features.  shells/zsh is probably the one I'd look at if csh(1) was not enough.


----------



## fnoyanisi (Jul 28, 2015)

wblock@ said:


> It is in the base.
> 
> There are other shells with more features.  shells/zsh is probably the one I'd look at if csh(1) was not enough.



Agree, zsh +1


----------

