Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have been using tcsh for a long time now. But whenever I am searching for something, I often find that the methods specified are bash specific. Even the syntax for the shell scripts is different for the two.

From what I have experienced searching and learning on the internet, bash seems to be the more common shell used. Even the number of questions on this site tagged bash are way more (five times more currently) than the number of questions tagged tcsh.

So, I am wondering whether I should switch to bash. What do you think?

Why should I stick to tcsh OR why should I move over to bash?

share|improve this question
3  
I don't think I've ever heard of someone switching to bash; normally people use bash because it's the default and then switch to something better :) –  Michael Mrozek Aug 21 '10 at 18:50
6  
@Michael: Well, OS X switched from tcsh to bash in version 10.3, so that's one case of people switching to bash. –  sepp2k Aug 21 '10 at 18:54
4  
you should use zsh (which OS X should have switched to) –  xenoterracide Aug 21 '10 at 19:01
4  
but write your scripts for dash those should work on just about anything. –  xenoterracide Aug 21 '10 at 19:25
2  
@ShmuelBrin This is tagged [linux] and [fedora] –  Michael Mrozek Feb 7 '13 at 6:04

7 Answers 7

up vote 9 down vote accepted

After learning bash I find that tcsh is a bit of a step backwards. For instance what I could easily do in bash I'm finding it difficult to do in tcsh. My question on tcsh. The Internet support and documentation is also much better for bash and very limited for tcsh. The number of O'Reilly books on bash are great but I have found nothing similar for tcsh.

share|improve this answer

For some kinds of reasons, I used to tcsh, as I used it than 20 years ago. As I know bash is originated from sh but of course with lots of csh stuff but tcsh is originated from csh. I really like the command completion in the early days but it is available in most shells now. For scripting, shall we stick to /bin/sh?

share|improve this answer
    
This doesn't really attempt to answer the question. It's more a comment. –  slm Dec 10 '13 at 21:05

Which shell? Go for the one with the best "ease-of-use" vs "hassles" ratio...

If you can't find enough general examples and explanatons for your "Maserati" shell, then it's extra performance may be more of a problem than a bonus...

I found this article/site interesting; it may be worth a read:
UNIX shell differences and how to change your shell

share|improve this answer
    
Though dated, that's a nice link. –  Tshepang Jan 15 '11 at 14:46

You should switch to a POSIX compliant shell http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html , like one of bash, ksh, dash, but not zsh and certainly not tcsh. It has been a long time since csh was declared a poor choice for scripting: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ , tcsh isn't that much different in that area.

When writing scripts, make sure to use POSIX only constructions (i.e. avoid bashisms and the likes) if you don't want to be locked again in something non portable.

share|improve this answer

zsh probably has a few more similarities to tcsh than bash does.

See: http://zsh.sourceforge.net/FAQ/zshfaq02.html#l13

People often claim that zsh can do things bash can't, but I have not found that to be the case. What I have seen is that for zsh it is easier, built in or turned on by default, while in bash it is an addon script, has to be turned on, or is more difficult.

(disclaimer: I am a bash user that has sometimes considered switching to zsh)

share|improve this answer

The compatibility obsessed are missing the point, I think. If you try to make everything compatible by putting #!/bin/sh at the top and using .sh extensions, but never test on anything but bash, you haven't guaranteed a compatible script! Better to just use #!/bin/bash and .bash so that users actually know the real requirement.

If you know zsh, tcsh, or something else better than bash, and have a good reference manual for it, don't hold back. Just like people expect to install perl or python to be able to run some scripts, they can handle installing your obscure shell, too! :D

share|improve this answer
    
Actually isn't /bin/sh guaranteed to point to korn-compatible shell while tcsh is csh-derived shell. It is likely that /bin/sh already points to bash or other compatible shell and it is nearly certain it won't be affected by changing of user shell. csh and sh are completly uncompatible. –  Maciej Piechotka Dec 27 '10 at 18:49
    
I'm not sure what is guaranteed. I know there are lots of people writing scripts for "/bin/sh" that are littered with Bash-isms which Bash-as-/bin/sh tolerates, but which confuse dash (Debian's ash and Bourne compatible shell). –  Kevin Cantu Dec 29 '10 at 2:30
    
Another point: #!/bin/bash will not constrain which version of Bash you were using and there are some incompatibilities from one version to another, although the worst were introduced a long time ago with v2. I don't know of any incompatibilities between versions in POSIX compatibility mode. –  Charles Stewart May 16 '11 at 9:36
    
Anyone should feel free to write for whatever shell they want, and you make a valid point in regards to #!/bin/sh alone -ne POSIX. However, being concerned about POSIX compatibility should not be the type of consideration labeled 'obsessed'. Invoking sh defaults dash with debian/ubuntu, and has for a while now. I know that would not qualify as 'guaranteed', but rarely would I consider anything portability 'guaranteed'. I would be even more reserved with a 'shell script'. –  TechZilla Jan 9 '12 at 7:06

Actually, you should move over to zsh! It's essentially backward-compatible and it's got all the utility of bash with a big huge helping of awesomeness. There's even a book (although I haven't gotten around to reading it).

I will admit to one reason to not use zsh over bash but unless you're constantly working at multiple new installations it doesn't really apply. Especially if you know about the most significant differences. This however is really akin to the differences between vim and vi; you don't want to be naive but practically it's no big deal. Even hardcore vim users can find their way around emacs and vice-versa.

share|improve this answer

protected by Michael Mrozek Dec 11 '13 at 3:31

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.