next up previous contents
Next: Command Execution Up: The C Shell Previous: A Bit of History

Getting Started with the C Shell

As with the Bourne shell, a good place to start is by checking that the current shell is in fact the C Shell. The echo command can be used to see which shell is running:

echo $SHELL

which should give

/bin/csh

if the C shell is the current operating shell. If the C shell is not the current shell, it can be invoked by typing the following command:

chsh /bin/csh

will change the login shell (the shell that is started everytime you login). An interactive shell can be temporarily invoked, until the end of the session, for learning or using the C shell by typing csh. The default prompt in the C shell is the percent symbol (%) which will be used as the default prompt for the rest of this chapter. The following is the typical appearance and execution of a command line in the C shell:

% ls -F
Mail/     News/     bin/      message.txt        slide.ps
%

This is essentially the same as the output from the same command in the Bourne shell with the exception of the different prompt. All shells handle command lines in the same manner. They first accept the user input and then they break it down into individual components such as the command to be executed and any flags that go with it.

The C shell allows long command lines in the same manner that the Bourne shell did. If a command line is too long for the screen (usually 80 characters on most monitors), simply break the line with a backslash, or in other words, escape the return character. This backslash character tells the shell to ignore the enter-key when it is pressed. A use of this might be when copying a list of files into another directory:

% cp file1 file2 file3 file4 file5 file6 \
> file7 file8 file9 file10 file 11 file12 \
> ~jones\data\storage\old_files
%

which would allow all of the files to be moved in a single command. The > character signifies the continuation of a command line onto the next terminal line. The ~ character, or tilde (pronounced til-duh), is a special character in the C shell that is understood by the shell to mean the current user's home directory. This and other special characters will be examined in the section on filename substitution.


next up previous contents
Next: Command Execution Up: The C Shell Previous: A Bit of History

Douglas M Gingrich
Mon Apr 27 15:25:49 MDT 1998