Jump to content

C Shell Scripting/Setup

From Wikibooks, open books for an open world

Setting up your Environment

[edit | edit source]

The C shell executable file is called csh. Most Unix systems have this shell installed except if the system just has the essentials installed. C shell is not a POSIX shell so if the system has only one shell is would most likely be a Bourne shell. Easiest way to check if you have C shell is to run the which command and see if it returns the path to the csh file.

$ which csh
/bin/csh


The result will most likely be /bin/csh which is the standard location. If the command doesn't print out a path the executable is not installed and you will have to download and installed the executable.

Figuring out the version of the C shell should also be done. If the output of this command indicates that your shell is an old version, upgrading to a newer version may save some headaches later.

Simply run the command with the --version option.

$ csh --version
tcsh 6.14.00 (Astron) 2005-03-25 (i386-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec


For example, Mac OS X 10.5.7 displays tcsh 6.14.00. It should not be surprising to find the tcsh executable masquerading as the older csh executable since its is backward compatible.

Linux

[edit | edit source]

Linux has many different methods to install applications. One way is the apt-get command.

$ sudo apt-get install csh

Mac OS X

[edit | edit source]

Mac OS X should always have csh installed. But you may want to get an editor such as TextMate to color the syntax.