Welcome to the Dictionary of Programming Languages, a compendium
of computer coding methods assembled to provide information and
aid your appreciation for computer science history.
Browse the dictionary by clicking on a section:
A
B
C
D
E
F
G
H
I
JK
L
M
N
O
P
QR
S
T
UV
WXYZ+
Get a full dump of the dictionary:
List of Names
Short Form
Full Form
- csh
- Language type:
- Description:
Csh is an interpreted command and scripting
language designed and implemented as part of
the BSD Unix development effort.
It was primarily designed as an interactive
command language, but is also widely used
to automate system administration and
software development tasks in Unix
environments.
Csh supports only one
primitive data type:
strings. Csh has arithmetic operators
that can
treat strings as integers in some constructs.
Like other Unix shell language, csh
has two scopes for variables: local and
exported (environment).
All local variables in a csh program have the
same data type: a vector of strings.
All environment (exported) variables have
the same data type, string, as required
by Unix.
Statements in csh are normally delimited
by line boundaries, but semicolons may
also be used.
Control flow constructs supported by Csh
include if-then-else, two kinds of loops,
goto, a case statement, and a very
simple interrupt handling statement. All
of the flow control constructs, as well as
the expression syntax, are modeled
roughly
after those in the C programming language.
Unlike most other programming language,
csh has no explicit syntax for subroutines.
Instead, each separate csh source file can
be treated as a kind of subroutine.
Csh is available on essentially all Unix
and related operating systems.
Despite its wide use, good tutorials on
C shell programming are not widely
available on the web. Good books on
shell programming are available.
- See Also:
- Remarks:
An advanced variant of csh, called the
Twenex csh (tcsh) is also very popular.
Tcsh supports the same programming
features as its parent csh, but provides
special interactive use features.
Csh is one of the most contentious of the
differences between the two main camps of
the Unix world. The "System V" camp
espouses general use of the Bourne shell
(sh) and its derivatives such as the
Korn shell (ksh). The "Berkeley" camp
espouses general use of the C shell and
its derivatives. In the 1990s this debate
became largely moot because all the popular
shells became available on all Unix
platforms.
Csh and its cousin tcsh are primarily
interactive command interpreters; they
can and have been used for programming,
though, even when much faster and simpler
solutions existed (e.g. sh, awk, perl).
While csh provides a fair set of program
flow constructs, it does not provide very
good I/O facilities or controls. This
is perceived as a major failing by many
Unix cognescenti. For more information about
csh's shortcomings, check out the
famous 'csh programming considered harmful'
article (link below).
For serious Unix scripting, csh has been
superseded by Perl.
- Links:
-
- Date:
- Sample code:
#!/bin/csh
# A simple csh script to find a command on
# the directories listed in the environment
# variable PATH, and print out information
# about it.
set cmd=$1
if ("$cmd" == "") then
echo "Usage: findcmd commandname"
exit 1
endif
set cnt=0
foreach dir ($path)
set check="$dir/$cmd"
if (-x "$check" && ! (-d "$check")) then
file $check
ls -ldg $check
set cnt=$cnt 1
endif
end
if ($cnt == 0) then
echo "Sorry, command $cmd not found."
exit 1
else
exit 0
endif
Descriptions in this dictionary are ©1997-99 Neal Ziring. Some
examples copyright of their respective authors. Some
technologies and languages are trademarked. Permission to
copy descriptions is granted as long as authorship credit is preserved.
Comments on this dictionary, corrections and suggestions, are all welcome.
Please use email, the address is ziring@home.com
[Ziring MicroWeb Home]
[Dictionary Start]
[Sign Guestbook]
Dictionary and script maintained by Neal Ziring, last major modifications 3/18/98. Most recent
additions to dictionary and master list, 1/00.