The C shell (csh) is a Unix shell developed by Bill Joy for the BSD Unix system. It was originally derived from the 6th Edition Unix /bin/sh (which was the Thompson shell), the predecessor of the Bourne shell. Its syntax is modeled after the C programming language. The C shell added many feature improvements over the Bourne shell, such as aliases and command history. Today, the original C shell is not in wide use on Unix; it has been superseded by other shells such as the Tenex C shell (tcsh) based on the original C shell code, but adding filename completion and command line editing, the Korn shell (ksh), and the GNU Bourne-Again shell (bash). An independently-developed and modernized C shell, created by Nicole Hamilton, also survives on Windows in the form of Hamilton C shell.
!-substitution feature allowed previous commands to be re-executed or edited in a variety of ways.
~ expansion :Home directory by username lookup, using ~ was popular enough that most modern, Unix-based Web servers now support it, in addition to most shells.
Variable assignment was also performed slightly differently with "set a = b" rather than Bourne shell's "a=b".
An example of possibly unwelcome behaviour of csh scripts is the following: if ( ! -e foo ) echo bar > foo It would appear to say "if file 'foo' does not exist, create it with contents 'bar'". But it will in fact create an empty file, as the line is parsed such that the output redirect is set up before the file existence is tested. (These and other criticisms do not, however, apply to the more-modern Hamilton C shell variant of the csh language.)
If scripts are written in csh, it is often useful to run the script with the -f flag, (e.g. by starting with the line #!/bin/csh -f) in order to avoid running the user's setup file as this may affect the script's behaviour.
Other known problem of csh is its message "0 event not found", which yields no information about what the problem was. If this happens, try to add the -f flag to the first line of the script. Also lines with exclamation symbols can give this problem (try the instruction echo "hello!!" and you will get the previous error)
Curly bracket programming languages | Domain-specific programming languages | Text-oriented programming languages | Scripting languages | Unix shells | Unix software