CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
NAME
csh - a shell (command interpreter) with C-like syntax
SYNOPSIS
csh [ -cefinstvVxX ] [ arg ... ]
DESCRIPTION
Csh is a first implementation of a command language
interpreter incorporating a history mechanism (see
history(1csh)) job control facilities (see jobs(1csh)),
interactive command and filename completion, and a C-like
syntax. So as to be able to use its job control facilities,
users of csh must (and automatically) use the new tty driver
fully described in tty(4). This new tty driver allows
generation of interrupt characters from the keyboard to tell
jobs to stop. See stty(1) for details on setting options in
the new tty driver.
An instance of csh begins by executing commands from the
file .cshrc in the home directory of the invoker. If this
is a login shell then it also executes commands from the
file .login there. It is typical for users on crts to put
the command stty crt in their .login file, and to also
invoke tset(1) there.
In the normal case, the shell will then begin reading
commands from the terminal, prompting with %. Processing of
arguments and the use of the shell to process files
containing command scripts will be described later.
The shell then repeatedly performs the following actions: a
line of command input is read and broken into words. This
sequence of words is placed on the command history list and
then parsed. Finally, each command in the current line is
executed.
When a login shell terminates, it executes commands from the
file .logout in the user's home directory.
Lexical Structure
The shell splits input lines into words at blanks and tabs
with the following exceptions. The characters &, |, ;, <,
>, (, and ) form separate words. If doubled, as in &&, |,
<<, or >> these pairs form single words. These parser
metacharacters may be made part of other words, or prevented
their special meaning, by preceding them with a backslash (
\ ). A newline preceded by a \ is equivalent to a blank.
In addition, strings enclosed in matched pairs of quotations
marks, form parts of a word; metacharacters in these
strings, including blanks and tabs, do not form separate
Printed 4/6/89 1
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
words. These quotations have semantics to be described
subsequently. Within pairs of ' or " characters, a newline
preceded by a \ gives a true newline character.
When the shell's input is not a terminal, the character #
introduces a comment which continues to the end of the input
line; it is prevented this special meaning when preceded by
\ and when appearing within quotations using `, ', and ".
Commands
A simple command is a sequence of words, the first of which
specifies the command to be executed. A simple command or a
sequence of simple commands separated by | (pipe)
characters forms a pipeline. The output of each command in
a pipeline is connected to the input of the next. Sequences
of pipelines may be separated by a semicolon ( ; ), and are
then executed sequentially. A sequence of pipelines may be
executed without immediately waiting for the sequence to
terminate by following it with an &.
Any of the above may be placed in parentheses ( ) to form a
simple command (which may be a component of a pipeline, and
so forth). It is also possible to separate pipelines with
|| or && indicating, as in the C language, that the
second is to be executed only if the first fails or
succeeds, respectively. (See Expressions.)
Status Reporting
This shell learns immediately whenever a process changes
state; it normally informs you whenever a job becomes
blocked so that no further progress is possible; however, it
only does so just before it prints a prompt. This is done
so that it does not otherwise disturb your work. If,
however, you set the shell variable notify, the shell will
notify you immediately of changes of status in background
jobs. There is also a shell command notify which marks a
single process so that its status changes will be
immediately reported. By default, notify marks the current
process; simply type notify after starting a background job
to mark it.
When you try to leave the shell while jobs are stopped, you
will be warned with the statement: You have stopped jobs.
You may use the jobs command to see what jobs are stopped.
If you use the jobs command or immediately try to exit
again, the shell will not warn you a second time, and the
suspended jobs will be terminated.
Substitutions
Printed 4/6/89 2
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
Described below are the various transformations the shell
performs on the input in the order in which they occur.
History Substitutions
See the manual page for history(1csh) for information on
history substitutions.
Quotations With ' and ''
The quotation of strings by single quotation marks ( ' ) and
double quotation marks ( " ) can be used to prevent all or
some of the remaining substitutions. Strings enclosed in
' are prevented any further interpretation. Strings
enclosed in " may be expanded as described below.
In both cases the resulting text becomes (all or part of) a
single word; only in one special case does a double quoted
string yield parts of more than one word (see Command
Substitution); single quoted strings never yield parts of
more than one word.
Alias Substitution
See the manual page for alias(1csh) for information on alias
substitutions.
Variable Substitution
The shell maintains a set of variables, each of which has as
value a list of zero or more words. Some of these variables
are set by the shell or referred to by it. For instance,
the argv variable is an image of the shell's argument list,
and words of this variable's value are referred to in
special ways.
The values of variables may be displayed and changed by
using the set and unset commands. Of the variables referred
to by the shell, a number are toggles; the shell does not
care what their value is, only whether they are set or not.
For instance, the verbose variable is a toggle which causes
command input to be echoed. The setting of this variable
results from the -v command line option.
Other operations treat variables numerically. The @ command
permits numeric calculations to be performed and the result
assigned to a variable. Variable values are, however,
always represented as (zero or more) strings. For the
purposes of numeric operations, the null string is
considered to be zero, and the second and subsequent words
of multiword values are ignored.
Printed 4/6/89 3
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
After the input line is aliased and parsed, and before each
command is executed, variable substitution is performed,
keyed by $ characters. This expansion can be prevented by
preceding the $ character with a backslash character ( \ )
except within double quotation marks ( " ), where it always
occurs, and within single quotation marks ( ' ), where it
never occurs. Strings quoted by open single quotes ( ` )
are interpreted later (see Command Substitution ), so $
substitution does not occur there until later, if at all. A
$ is passed unchanged if followed by a blank, tab, or
end-of-line.
Input/output redirections are recognized before variable
expansion, and are variable expanded separately. Otherwise,
the command name and entire argument list are expanded
together. It is thus possible for the first (command) word
to this point to generate more than one word, the first of
which becomes the command name, and the rest of which become
arguments.
Unless enclosed in quotes ( " ) or given the :q modifier,
the results of variable substitution may eventually be
command and filename substituted. Within double quotation
marks ( " ), a variable whose value consists of multiple
words expands to a (portion of) a single word, with the
words of the variables value separated by blanks. When the
:q modifier is applied to a substitution, the variable will
expand to multiple words with each word separated by a blank
and quoted to prevent later command or filename
substitution.
The following metasequences are provided for introducing
variable values into the shell input (except as noted, it is
an error to reference a variable which is not set):
$name
${name}
Are replaced by the words of the value of variable name,
each separated by a blank. Braces insulate name from
following characters which would otherwise be part of it.
Shell variables have names consisting of up to 20 letters
and digits starting with a letter. The underscore
character ( _ ) is considered a letter.
If name is not a shell variable, but is set in the
environment, then that value is returned, but a colon
( : ) modifier and the other forms of modifiers given are
not available in this case).
$name[selector]
${name[selector]}
Can be used to select only some of the words from the
Printed 4/6/89 4
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
value of name. The selector is subjected to $
substitution and can consist of a single number or two
numbers separated by a dash ( - ). The first word of a
variables value is numbered 1. If the first number of a
range is omitted it defaults to 1. If the last member of
a range is omitted it defaults to $#name. The selector
* selects all words. It is not an error for a range to
be empty if the second argument is omitted or in range.
$#name
${#name}
Gives the number of words in the variable. This is
useful for later use in a [selector].
$0 Substitutes the name of the file from which command input
is being read. An error occurs if the name is not known.
$number
${number}
Equivalent to $argv[number].
$* Equivalent to $argv[*].
The modifiers :h, :t, :r, :q, and :x can be applied to the
substitutions above, as can :gh, :gt, and :gr. If braces {
} appear in the command form then the modifiers must appear
within the braces.
The current implementation allows only one colon ( : )
modifier on each $ expansion.
The following substitutions may not be modified with colon
( : ) modifiers:
$?name
${?name}
Substitutes the string 1 if name is set, 0 if it is not.
$?0
Substitutes 1 if the current input filename is known, 0
if it is not.
$$ Substitute the (decimal) process number of the (parent)
shell.
$< Substitutes a line from the standard input, with no
further interpretation thereafter. It can be used to
read from the keyboard in a shell script.
Command and Filename Substitution
The remaining substitutions - command and filename
substitution - are applied selectively to the arguments of
Printed 4/6/89 5
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
builtin commands. This means that portions of expressions
which are not evaluated are not subjected to these
expansions. For commands which are not internal to the
shell, the command name is substituted separately from the
argument list. This occurs very late, after input-output
redirection is performed, and in a child of the main shell.
Command Substitution
Command substitution is indicated by a command enclosed in
open single quotation marks (`). The output from such a
command is normally broken into separate words at blanks,
tabs, and newlines, with null words being discarded, and
this text then replacing the original string. Within double
quotation marks ( " ), only newlines force new words; blanks
and tabs are preserved.
In any case, the single final newline does not force a new
word. Note that it is thus possible for a command
substitution to yield only part of a word, even if the
command outputs a complete line.
Filename Substitution
If a word contains any of the characters *, ?, [, or { or
begins with the tilde character ( ~ ), then that word is a
candidate for filename substitution, also known as globbing.
This word is then regarded as a pattern, and replaced with
an alphabetically sorted list of filenames which match the
pattern. In a list of words specifying filename
substitution it is an error for no pattern to match an
existing filename, but it is not required for each pattern
to match. Only the metacharacters *, ?, and [ imply pattern
matching, while the characters ~ and { are more akin to
abbreviations.
In matching filenames, the dot character ( . ) at the
beginning of a filename or immediately following a / as
well as the character / must be matched explicitly. The
character * matches any string of characters, including
the null string. The character ? matches any single
character. The sequence [...] matches any one of the
characters enclosed. Within [...], a pair of characters
separated by a dash ( - ) matches any character lexically
between, and including, the two characters. Note that if
the characters are reversed in the collating sequence (such
as the pattern ``[z-a]'' ), the dash is ignored.
The tilde character ( ~ ) at the beginning of a filename is
used to refer to home directories. Standing alone, it
expands to the invoker's home directory as reflected in the
value of the variable home. When followed by a name
Printed 4/6/89 6
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
consisting of letters, digits and dash ( - ) characters, the
shell searches for a user with that name and substitutes
their home directory; thus ~ken might expand to /usr/ken
and ~ken/chmach to /usr/ken/chmach. If the tilde character
( ~ ) is followed by a character other than a letter or /
or appears anywhere but at the beginning of a word, it is
left undisturbed.
The metanotation a{b,c,d}e is a shorthand for abe ace ade.
Left to right order is preserved, with results of matches
being sorted separately at a low level to preserve this
order. This construct may be nested. Thus
~source/s1/{oldls,ls}.c expands to /usr/source/s1/oldls.c
/usr/source/s1/ls.c whether or not these files exist without
any chance of error if the home directory for source if
/usr/source. Similarly, ../{memo,*box} might expand to
../memo ../box ../mbox. (Note that memo was not sorted with
the results of matching *box.) As a special case {, }, and
{ } are passed undisturbed.
Input/Output
The standard input and standard output of a command can be
redirected with the following syntax:
< filename
Open filename (which is first variable, command and
filename expanded) as the standard input.
<< word
Read the shell input up to a line which is identical to
word. Word is not subjected to variable, filename or
command substitution, and each input line is compared to
word before any substitutions are done on this input
line. Unless a quoting \, ", ', or ` appears in word,
variable and command substitution is performed on the
intervening lines, allowing \ to quote $, , and `.
Commands which are substituted have all blanks, tabs, and
newlines preserved, except for the final newline which is
dropped. The resultant text is placed in an anonymous
temporary file which is given to the command as standard
input.
> filename
>! filename
>& filename
>&! filename
The filename is used as standard output. If the file
does not exist, it is created; if the file exists, it is
truncated, with its previous contents being lost.
If the variable noclobber is set, then the file must not
Printed 4/6/89 7
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
exist or be a character special file (for example, a
terminal or /dev/null) or an error results. This helps
prevent accidental destruction of files. In this case
the ! forms can be used and suppress this check.
The forms involving & route the diagnostic output into
the specified file as well as the standard output.
Filename is expanded in the same way as < input
filenames are.
>> filename
>>& filename
>>! filename
>>&! filename
Uses filename as standard output like > but places
output at the end of the file. If the variable noclobber
is set, then it is an error for the file not to exist
unless one of the ! forms is given. Otherwise similar
to >.
A command receives the environment in which the shell was
invoked as modified by the input/output parameters and the
presence of the command in a pipeline. Thus, unlike some
previous shells, commands run from a file of shell commands
have no access to the text of the commands by default;
rather they receive the original standard input of the
shell. The << mechanism should be used to present in-line
data. This permits shell command scripts to function as
components of pipelines and allows the shell to block-read
its input. Note that the default standard input for a
command run detached is not modified to be the empty file
/dev/null; rather the standard input remains as the original
standard input of the shell. If this is a terminal and if
the process attempts to read from the terminal, then the
process will block and the user will be notified (see the
section discussing Jobs ).
Diagnostic output may be directed through a pipe with the
standard output. Simply use the form |& rather than just a
pipe ( | ).
Expressions
A number of the builtin commands (to be described
subsequently) take expressions, in which the operators are
similar to those of C, with the same precedence. These
expressions appear in the @, exit, if, and while commands.
The following operators are available:
|| && | ↑ & == != =~ !~ <= >= < > << >>
+ - * / % ! ~ ( )
Printed 4/6/89 8
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
Here the precedence increases to the right, == != =~ and
!~, <= >= < and >, << and >>, + and -, * / and %
being, in groups, at the same level. The == != =~ and
!~ operators compare their arguments as strings; all
others operate on numbers. The operators =~ and !~ are
like != and == except that the right hand side is a
pattern (containing, for example, *s, ?s and instances of
[...] ) against which the left hand operand is matched.
This reduces the need for use of the switch statement in
shell scripts when all that is really needed is pattern
matching.
Strings which begin with a zero (0) are considered octal
numbers. Null or missing arguments are considered zero.
The result of all expressions are strings, which represent
decimal numbers. It is important to note that no two
components of an expression can appear in the same word;
except when adjacent to components of expressions (which are
syntactically significant to the parser &, |, <, >, (, ))
they should be surrounded by spaces.
Also available in expressions as primitive operands are
command executions enclosed in braces { and } and file
enquiries of the form -l filename where l is one of:
r read access w write access
x execute access e existence
o ownership z zero size
f plain file d directory
The specified name is command and filename expanded and then
tested to see if it has the specified relationship to the
real user. If the file does not exist or is inaccessible
then all enquiries return false; i.e., 0. Command
executions succeed, returning true (i.e., 1) if the command
exits with status 0; otherwise they fail, returning false
(i.e., 0). If more detailed status information is required
then the command should be executed outside of an expression
and the variable status examined.
Command/Filename Completion and File Listing
In interactive shells, commands and filenames may be
completed for you by using the character escape ( ^[ ), and
listed by using the character ^D (Ctrl D).
Command completion is turned on by setting the shell
variable ``complete''. When this variable is set, typing
the escape character completes the command or filename up to
the point where more than one name could match, or only one
name matches. For example, if the current directory
contains the files ``hellothere'' and ``hellofolks'', typing
Printed 4/6/89 9
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
a command name followed by the letter `h' followed by an
escape will change the command line to ``command hello'' and
the terminal bell will ring. By typing the letter `t'
followed by an escape, the command line becomes ``command
hellothere''. This works with command names as well (note:
with the exception of the commands in the current directory,
execute permission is not checked for).
The bell printed during ambiguities or unmatchable strings
can be changed by setting the shell variable ``vbell''. If
this is set to nothing, the visible bell sequence from the
terminal capability entry (see termcap(5t)) is used. If the
variable is set to anything else, that string will be
printed.
File listing is turned on by setting the shell variable
``list''. When this variable is set, typing ^D (Ctrl D)
lists all commands or files that match the current string
being typed. Assume the same two files listed earlier. If
the command line ``command hello'' is typed followed by a
^D, the shell will list the two filenames that begin with
`hello' in the current directory.
If the ``list'' variable is set to a string that begins with
the letter `f', the files are marked with a character that
denotes the type of file, as with the command ls -F . If the
``list'' variable is set to a string that begins with the
letter `l', all symbolic links are listed with a trailing
`@'. This works with command names, with the additional
feature that if the shell variable ``listpathnum'' is set,
the number of the directory in the ``path'' variable is
listed along with the commands.
The special case in which the string begins with the
character `~' causes the names of all users that match the
string to be printed. For example, typing ``command ~a''
followed by a ^D will print all user names that begin with
the letter `a'.
There are some deficiencies with this feature. First, the
names must match exactly. No metacharacters are expanded.
Also, aliases are not expanded, though the user can set up a
special directory in the execution path which contains
(nonexecutable) files with the same names as the aliases.
It is important to note that setting either the ``complete''
or ``list'' variables causes the shell to require character
echoing and cooked input mode, so changing these modes (such
as with stty(1)) will be ineffective.
Control Flow
Printed 4/6/89 10
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
The shell contains a number of commands which can be used to
regulate the flow of control in command files (shell
scripts) and (in limited but useful ways) from terminal
input. These commands all operate by forcing the shell to
reread or skip in its input and, due to the implementation,
restrict the placement of some of the commands.
The foreach, switch, and while statements, as well as the
The shell contains a number of commands which can be used to
regulate the if-then-else form of the if statement require
that the major keywords appear in a single simple command on
an input line as shown below.
Following is the syntax for the built-in control flow
commands:
if (expr) command
If the specified expression evaluates true, then the
single command with arguments is executed. Variable
substitution on command happens early, at the same time
it does for the rest of the if command. Command must be
a simple command, not a pipeline, a command list, or a
parenthesized command list. Input/output redirection
occurs even if expr is false, and when command is not
executed (this is a bug).
if (expr) then
...
else if (expr2) then
...
else
...
endif
If the specified expr is true then the commands to the
first else are executed; or if expr2 is true then the
commands to the second else are executed, and so forth.
Any number of else-if pairs are possible; only one endif
is needed. The else part is likewise optional. (The
words else and endif must appear at the beginning of
input lines; the if must appear alone on its input line
or after an else.)
while (expr)
...
end
While the specified expression evaluates nonzero, the
commands between the while and the matching end are
evaluated. Break and continue can be used to terminate
or continue the loop prematurely. (The while and end
must appear alone on their input lines.) When this
command is read from the terminal, the loop is read up
once prompting with ? before any statements in the loop
Printed 4/6/89 11
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
are executed. If you make a mistake typing in a loop at
the terminal you can rub it out.
foreach name (wordlist)
...
end
The variable name is successively set to each member of
wordlist and the sequence of commands between this
command and the matching end are executed. (Both foreach
and end must appear alone on separate lines.)
The builtin command continue may be used to continue the
loop prematurely and the builtin command break to
terminate it prematurely. Prompting occurs here the
first time through the loop as for the while command.
switch (string)
case str1:
...
breaksw
...
default:
...
breaksw
endsw
Each case label is successively matched, against the
specified string which is first command and filename
expanded. The file metacharacters *, ?, and [...]
can be used in the case labels, which are variable
expanded. If none of the labels match before a default
label is found, then the execution begins after the
default label. Each case label and the default label
must appear at the beginning of a line. The command
breaksw causes execution to continue after the endsw.
Otherwise, control may fall through case labels and
default labels as in C. If no label matches and there is
no default, execution continues after the endsw.
If the shell's input is not seekable, the shell buffers
up input whenever a loop is being read and performs seeks
in this internal buffer to accomplish the rereading
implied by the loop. (To the extent that this allows,
backward goto's will succeed on non-seekable inputs.)
Built-In Commands
Built-in commands are executed within the shell. If a
built-in command occurs as any component of a pipeline
except the last, then it is executed in a subshell. The
built-in commands are documented in separate manual entries.
See the SEE ALSO section at the end of this document for a
list of manual pages to see for descriptions of these
Printed 4/6/89 12
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
commands. statement if the input is a terminal.
Non-Built-In Command Execution
When a command to be executed is found to not be a builtin
command the shell attempts to execute the command via
execve(2). Each word in the variable pathname names a
directory from which the shell will attempt to execute the
command. If it is given neither a -c nor a -t option, the
shell will hash the names in these directories into an
internal table so that it will only try an exec in a
directory if there is a possibility that the command resides
there. This greatly speeds command location when a large
number of directories are present in the search path. If
this mechanism has been turned off (via unhash), or if the
shell was given a -c or -t argument, and in any case for
each directory component of pathname which does not begin
with a /, the shell concatenates with the given command
name to form a pathname of a file which it then attempts to
execute.
Parenthesized commands are always executed in a subshell.
Thus (cd ; pwd) ; pwd
prints the home directory; leaving you where you were
(printing this after the home directory), while cd ; pwd
leaves you in the home directory. Parenthesized commands
are most often used to prevent chdir from affecting the
current shell.
If the file has execute permissions but is not an executable
binary to the system, then it is assumed to be a file
containing Bourne shell commands and a copy of /bin/sh is
spawned to read it.
It is important to note that this version of csh does not
automatically execute scripts. In order to execute a file
as a csh script, the first line of the command must be of
the form ``#!/bin/csh [options]''. See execve(2) for more
information.
Signal Handling
The shell normally ignores quit signals. Jobs running
detached (either by & or the bg or %... & commands)
are immune to signals generated from the keyboard, including
hangups. Other signals have the values which the shell
inherited from its parent. The shells handling of
interrupts and terminate signals in shell scripts can be
controlled by onintr. Login shells catch the terminate
signal; otherwise, this signal is passed on to children from
the state in the shell's parent. In no case are interrupts
allowed when a login shell is reading the file .logout.
Printed 4/6/89 13
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
OPTIONS
If argument 0 to the shell is a dash ( - ) then this is a
login shell. The flag arguments are interpreted as follows:
-c Commands are read from the (single) following argument
which must be present. Any remaining arguments are
placed in argv.
-e The shell exits if any invoked command terminates
abnormally or yields a nonzero exit status.
-f The shell will start faster, because it will neither
search for nor execute commands from the file .cshrc in
the invoker's home directory.
-i The shell is interactive and prompts for its top-level
input, even if it appears to not be a terminal. Shells
are interactive without this option if their inputs and
outputs are terminals.
-n Commands are parsed, but not executed. This aids in
syntactic checking of shell scripts.
-s Command input is taken from the standard input.
-t A single line of input is read and executed. A backslash
( \ ) can be used to escape the newline at the end of
this line and continue onto another line.
-v Causes the verbose variable to be set, with the effect
that command input is echoed after history substitution.
-x Causes the echo variable to be set, so that commands are
echoed to the diagnostic output (even in cases of
redirection) immediately before execution.
-V Causes the verbose variable to be set even before .cshrc
is executed.
-X Is to -x as -V is to -v.
After processing of flag arguments, if arguments remain but
none of the -c, -i, -s, or -t options were given the first
argument is taken as the name of a file of commands to be
executed. The shell opens this file, and saves its name for
possible resubstitution by $0. Since many systems use
either the standard version 6 or version 7 shells whose
shell scripts are not compatible with this shell, the shell
will execute such a standard shell if the first character of
a script is not a # e.g., if the script does not start
with a comment. Remaining arguments initialize the variable
argv.
Printed 4/6/89 14
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
FILES
$HOME/.cshrc Read at beginning of execution by each shell.
$HOME/.login Read by login shell, after .cshrc at login.
$HOME/.logout
Read by login shell, at logout.
/bin/sh Standard shell, default for running scripts.
Scripts to be run by csh must begin with
`#!/bin/csh'.
/tmp/sh* Temporary file for <<.
/etc/passwd Source of home directories for ~ filenames.
VARIABLES
CDPATH The change directory search path. Used to set
$cdpathname.
HOME The user's home directory. Used to set $home.
PATH The execution search path. Used to set
$pathname.
TERM The type of terminal being used. Used in
command completion.
TERMCAP The name of the terminal capability file, or
the capability entry itself.
SHELL The user's login shell. Used to set $shell.
USER The user's login name. Used to set $user.
CAVEATS
When a command is restarted from a stop, the shell prints
the directory it started in, if this is different from the
current directory; this can be misleading (for example,
wrong) as the job may have changed directories internally.
Shell builtin functions are not stoppable/restartable.
Command sequences of the form a ; b ; c are also not handled
gracefully when stopping is attempted. If you suspend b,
the shell will then immediately execute c. This is
especially noticeable if this expansion results from an
alias. It suffices to place the sequence of commands in
parentheses ( ) to force it to a subshell; for example, ( a
; b ; c ).
Control over tty output after processes are started is
primitive; perhaps this will inspire someone to work on a
Printed 4/6/89 15
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
good virtual terminal interface. In a virtual terminal
interface much more interesting things could be done with
output control.
Alias substitution is most often used to clumsily simulate
shell procedures; shell procedures should be provided rather
than aliases.
Commands within loops, prompted for by ? are not placed in
the history list. Control structure should be parsed rather
than being recognized as built-in commands. This would
allow control commands to be placed anywhere, to be combined
with a pipe ( | ), and to be used with & and ;
metasyntax.
It should be possible to use the colon ( : ) modifiers on
the output of command substitutions. All and more than one
: modifier should be allowed on $ substitutions.
Symbolic links fool the shell. In particular, dirs and cd
.. don't work properly once you've crossed through a
symbolic link.
Words can be no longer than 2048 characters. The system
limits argument lists to 10240 characters. The number of
arguments to a command which involves filename expansion is
limited to one-sixth the number of characters allowed in an
argument list. Command substitutions may substitute no more
characters than are allowed in an argument list. To detect
looping, the shell restricts the number of alias
substitutions on a single line to 20.
Input/output redirection occurs even if expr is false, and
when commmand is not executed.
When command completion or file listing are turned on,
terminal echo mode will always be turned on and the terminal
will always be set to cooked input mode. This is done to
ensure that command completion and file listing behave
properly. If you need to change these terminal
characteristics, you must turn off command completion and
file listing.
SEE ALSO
@(1csh), alias(1csh), bg(1csh), break(1csh), cd(1csh),
chdir(1csh), continue(1csh), csh(1csh), dirs(1csh),
echo(1csh), eval(1csh), exec(1csh), exit(1csh), fg(1csh),
glob(1csh), goto(1csh), hashstat(1csh), history(1csh),
jobs(1csh), kill(1csh), limit(1csh), logout(1csh),
nice(1csh), nohup(1csh), notify(1csh), onintr(1csh),
popd(1csh), pushd(1csh), rehash(1csh), repeat(1csh),
set(1csh), setenv(1csh), sh(1sh), shift(1csh), source(1csh),
Printed 4/6/89 16
CSH(1CSH) COMMAND REFERENCE CSH(1CSH)
stop(1csh), suspend(1csh), time(1csh), umask(1csh),
unhash(1csh), unalias(1csh), unlimit(1csh), unset(1csh),
unsetenv(1csh), wait(1csh), which(1csh), access(2),
execve(2), fork(2), killpg(2), pipe(2), sigvec(2), umask(2),
setrlimit(2), wait(2), tty(4), a.out(5), and environ(7).
REFERENCES
Introduction to the C-shell in the UTek Tools documentation.
Printed 4/6/89 17
%%index%%
na:288,106;
sy:394,284;
de:678,2795;3833,3277;7470,3402;11232,2925;14517,2923;17800,3096;21256,2993;24609,2808;27777,3287;31424,2768;34552,3619;38531,3613;42504,3878;
op:46742,2930;
fi:50032,670;
va:50702,775;
ca:51477,1029;52866,2096;
se:54962,1153;56475,669;
re:57144,285;
%%index%%000000000308