SCCS-vsn: bin/csh/csh.1 5.1
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)csh.1 4.1 (Berkeley) %G%
+.\" @(#)csh.1 5.1 (Berkeley) %G%
+.TH CSH 1 "18 July 1983"
is a first implementation of a command language interpreter
incorporating a history mechanism (see
.B "History Substitutions)"
is a first implementation of a command language interpreter
incorporating a history mechanism (see
.B "History Substitutions)"
-job control facilities
-(see
+job control facilities (see
.B Jobs)
and a C-like syntax.
So as to be able to use its job control facilities, users of
.I csh
.B Jobs)
and a C-like syntax.
So as to be able to use its job control facilities, users of
.I csh
-must (and automatically) use the new tty driver summarized in
-.IR newtty (4)
-and fully described in
+must (and automatically) use the new tty driver fully described in
.IR tty (4).
This new tty driver allows generation of interrupt characters
.IR tty (4).
This new tty driver allows generation of interrupt characters
-from the keyboard to tell jobs to stop.
-See
+from the keyboard to tell jobs to stop. See
.IR stty (1)
for details on setting options in the new tty driver.
.PP
An instance of
.I csh
.IR stty (1)
for details on setting options in the new tty driver.
.PP
An instance of
.I csh
-begins by executing commands from the file `.cshrc'
-in the
+begins by executing commands from the file `.cshrc' in the
.I home
directory of the invoker.
If this is a login shell then it also executes commands from the file
.I home
directory of the invoker.
If this is a login shell then it also executes commands from the file
.PP
The shell then repeatedly performs the following actions:
a line of command input is read and broken into
.PP
The shell then repeatedly performs the following actions:
a line of command input is read and broken into
This sequence of words is placed on the command history list and then parsed.
Finally each command in the current line is executed.
.PP
This sequence of words is placed on the command history list and then parsed.
Finally each command in the current line is executed.
.PP
The quotation of strings by `\'' and `"' can be used
to prevent all or some of the remaining substitutions.
Strings enclosed in `\'' are prevented any further interpretation.
The quotation of strings by `\'' and `"' can be used
to prevent all or some of the remaining substitutions.
Strings enclosed in `\'' are prevented any further interpretation.
-Strings enclosed in `"' are yet variable and command expanded
-as described below.
+Strings enclosed in `"' may be expanded as described below.
.PP
In both cases the resulting text becomes (all or part of) a single word;
only in one special case (see
.PP
In both cases the resulting text becomes (all or part of) a single word;
only in one special case (see
-Substitutes `1' if the current input filename is know, `0' if it is not.
+Substitutes `1' if the current input filename is known, `0' if it is not.
as standard output like `>' but places output at the end of the file.
If the variable
.I noclobber
as standard output like `>' but places output at the end of the file.
If the variable
.I noclobber
-is set, then
-it is an error for the file not to exist unless
+is set, then it is an error for the file not to exist unless
one of the `!' forms is given.
Otherwise similar to `>'.
.PP
one of the `!' forms is given.
Otherwise similar to `>'.
.PP
(As in
.IR sh (1).)
The arguments are read as input to the shell and the resulting
(As in
.IR sh (1).)
The arguments are read as input to the shell and the resulting
-command(s) executed. This is usually used to execute commands
+command(s) executed in the context of the current shell.
+This is usually used to execute commands
generated as the result of command or variable substitution, since
parsing occurs before these substitutions. See
.IR tset (1)
for an example of using
generated as the result of command or variable substitution, since
parsing occurs before these substitutions. See
.IR tset (1)
for an example of using
.HP 5
.BR exec " command"
.br
.HP 5
.BR exec " command"
.br
.br
Print a statistics line indicating how effective the internal hash
table has been at locating commands (and avoiding
.br
Print a statistics line indicating how effective the internal hash
table has been at locating commands (and avoiding
An
.I exec
is attempted for each component of the
An
.I exec
is attempted for each component of the
.HP 5
.BI "history \-r" " n"
.br
.HP 5
.BI "history \-r" " n"
.br
+.ns
+.HP 5
+.BI "history \-h" " n"
+.br
Displays the history event list; if \fIn\fR is given only the
.I n
most recent events are printed.
Displays the history event list; if \fIn\fR is given only the
.I n
most recent events are printed.
.B \-r
option reverses the order of printout to be most recent first
rather than oldest first.
.B \-r
option reverses the order of printout to be most recent first
rather than oldest first.
+The
+.B \-h
+option causes the history list to be printed without leading numbers.
+This is used to produce files suitable for sourceing using the \-h
+option to
+.IR source .
.HP 5
.BR if " (expr) command"
.br
.HP 5
.BR if " (expr) command"
.br
.I ignoreeof
is set.
.HP 5
.I ignoreeof
is set.
.HP 5
-.B newgrp
-.br
-Changes the group identification of the caller; for details see
-.IR newgrp (1).
-A new shell is executed by
-.I newgrp
-so that the shell state is lost.
-.HP 5
.HP 5
.BR source " name"
.br
.HP 5
.BR source " name"
.br
+.ns
+.HP 5
+.BR "source \-h" " name"
+.br
The shell reads commands from
.I name.
.I Source
The shell reads commands from
.I name.
.I Source
at any level terminates all nested
.I source
commands.
at any level terminates all nested
.I source
commands.
-commands is
-.B never
-placed on the history list.
+commands is not placed on the history list;
+the \-h option causes the commands to be placed in the
+history list without being executed.
the specified simple command is timed and a time summary
as described under the
.I time
the specified simple command is timed and a time summary
as described under the
.I time
-variable is printed.
-If necessary, an extra shell is created to print the time
+variable is printed. If necessary, an extra shell is created to print the time
statistic when the command completes.
.HP 5
.B umask
statistic when the command completes.
.HP 5
.B umask
.I expr
which would otherwise be single words.
.IP
.I expr
which would otherwise be single words.
.IP
-Special postfix `++' and `\-\-' operators increment and decrement
+Special postfix `++' and `\-\|\-' operators increment and decrement
.I name
respectively, i.e. `@ i++'.
.sh "Pre-defined and environment variables"
.I name
respectively, i.e. `@ i++'.
.sh "Pre-defined and environment variables"
processes will import the definition of
.I path
from the environment, and re-export it if you then change it.
processes will import the definition of
.I path
from the environment, and re-export it if you then change it.
-(It could be set once in the
-.I \&.login
-except that commands through
-.IR net (1)
-would not see the definition.)
unless a preceding `\e' is given.
Default is `% ', or `# ' for the super-user.
.TP 15
unless a preceding `\e' is given.
Default is `% ', or `# ' for the super-user.
.TP 15
+.B savehist
+\c
+is given a numeric value to control the number of entries of the
+history list that are saved in ~/.history when the user logs out.
+Any command which has been referenced in this many events will be saved.
+During start up the shell sources ~/.history into the history list
+enabling history to be saved across logins.
+Too large values of
+.I savehist
+will slow down the shell during start up.
+.TP 15
.B shell
\c
The file in which the shell resides.
.B shell
\c
The file in which the shell resides.
.sh "Non-builtin command execution"
When a command to be executed is found to not be a builtin command
the shell attempts to execute the command via
.sh "Non-builtin command execution"
When a command to be executed is found to not be a builtin command
the shell attempts to execute the command via
Each word in the variable
.I path
names a directory from which the shell will attempt to execute the command.
Each word in the variable
.I path
names a directory from which the shell will attempt to execute the command.
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
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
or if the shell was given a
.B \-c
or
or if the shell was given a
.B \-c
or
.PP
If the file has execute permissions but is not an
executable binary to the system, then it is assumed to be a
.PP
If the file has execute permissions but is not an
executable binary to the system, then it is assumed to be a
-file containing shell commands an a new shell is spawned to read it.
+file containing shell commands and a new shell is spawned to read it.
.PP
If there is an
.I alias
.PP
If there is an
.I alias
.B \-n
\c
Commands are parsed, but not executed.
.B \-n
\c
Commands are parsed, but not executed.
-This may aid in syntactic checking of shell scripts.
+This aids in syntactic checking of shell scripts.
allowed in an argument list.
To detect looping, the shell restricts the number of
.I alias
allowed in an argument list.
To detect looping, the shell restricts the number of
.I alias
-substititutions on a single line to 20.
+substitutions on a single line to 20.
-sh(1), newcsh(1), access(2), exec(2), fork(2), killpg(2), pipe(2), sigsys(2),
-umask(2), vlimit(2), wait(2), jobs(3), sigset(3), tty(4), a.out(5), environ(5),
+sh(1), access(2), execve(2), fork(2), killpg(2), pipe(2), sigvec(2),
+umask(2), setrlimit(2), wait(2), tty(4), a.out(5), environ(7),
`An introduction to the C shell'
.SH BUGS
When a command is restarted from a stop,
`An introduction to the C shell'
.SH BUGS
When a command is restarted from a stop,
It should be possible to use the `:' modifiers on the output of command
substitutions.
All and more than one `:' modifier should be allowed on `$' substitutions.
It should be possible to use the `:' modifiers on the output of command
substitutions.
All and more than one `:' modifier should be allowed on `$' substitutions.
+.PP
+Symbolic links fool the shell. In particular,
+.I dirs
+and `cd ..' don't work properly once you've crossed through a symbolic
+link.