The C-shell has some predefined variables. We've already met argv. The most useful other ones are listed below.
| Shell variable | Meaning |
| cwd | Current working directory |
| home | Home directory |
| path | List of directories in which to search for commands |
| status | The status returned by the last command, where 0 means a successful completion, and a positive integer indicates an error, the higher the value, the higher the severity. |
| user | Username |
So if you wanted to include details of the user and directory at the head of some data-processing log you might write this in your script.
% echo "Processed by: $user" > logfile
% echo "Directory processed: $path" >> logfile
This writes a heading into file logfile saying who ran the
script, and then appends details of the directory in which processing
occurred. Note the different metacharacters,
namely > redirects the output to a file, and » appends to
an existing file.
C-shell Cookbook