Previous Table of Contents Next


COMMAND EXECUTION

The prompt variable (default %hostname or #hostname for super-users) is displayed whenever the C shell is ready to read a command.

Command Execution Format

command1 ; command2 execute command1 followed by command2
command & execute command asynchronously in the background
command1 | command2 pass the standard output of command1 to standard input of command2
command1 |& command2 pass the standard output and standard error of command1 to standard input of command2
command1 && command2 execute command2 if command1 returns zero (successful) exit status
command1 || command2 execute command2 if command1 returns non-zero (unsuccessful) exit status
command \ continue command onto the next line
( command ) execute command in the current shell

REDIRECTING INPUT/OUTPUT

The C shell provides a number of operators that can be used to manipulate command input/output, and files. Command, filename, and variable expansion is performed on file.

I/O Redirection Operators

<file redirect standard input from file
>file redirect standard output to file. Create file if non-existent, else overwrite. If noclobber set, file must not exist, or an error will occur.
>!file same as > file, except do not check if file exists
>&file same as > file, except also redirect standard error
>&!file same as > file, except redirect standard error and do not check if file exists
>>file append standard output to file. Create file if non-existent, else overwrite. If noclobber set, file must not exist, or an error will occur.
>>!file same as >> file, except do not check if file exists
>>&file same as >> file, except also redirect standard error
>>&!file same as >> file, except redirect standard error and do not check if file exists
<<arg read from standard input until a line that is identical with arg or EOF is read

C SHELL OPTIONS

The C shell has a number of options that control execution. They can be enabled on the csh command line, or from within a script file (see MISCELLANEOUS section).

Enabling Options

csh –options invoke the C shell with options enabled

List of Options

–b do not interpret next command-line arguments as options (set-user-ID scripts not executed without –b)
–c file [args] read commands from file; put args in argv
–e exit if a command fails
–f enable fast start; do not read .cshrc or .login files
–i execute in interactive mode
–n read commands without executing them
–s read commands from standard input
–t exit after reading and executing one command
–v display input lines as they are read
–V same as –v, except enable before reading .cshrc file
–x display commands and arguments as executed
–X same as –x, except enable before reading .cshrc file

FILENAME COMPLETION

If enabled (by setting filec), partial file or user names can be completed by the C shell. If a partial file name is followed by the <Escape> character, the C shell attempts to complete the file name by matching it with a filename from the current directory. If a partial file name is followed by the CTRL-d character, the C shell lists all the file names that match. A prompt with the incomplete file name is redisplayed. If a partial file name begins with a ~ character, the C shell attempts completion with a user name instead of a file name. Multiple or no matches cause the terminal to beep, unless nobeep is set. Files with certain suffixes can be excluded on multiple matches by setting fignore.

ALIASES

Aliases are used as shorthand for other commands, especially frequently-used ones. The first word in each command is checked against the alias list. If there is a match, the word is replaced with the text associated with the alias. Any history substitution is then done on the alias text and arguments.

Alias Commands

alias display a list of alias names and their values
alias name display the alias value for name
alias name value create an alias name and set it to value (value may contain escaped history substitution syntax)


Previous Table of Contents Next
1