9867 lines
200 KiB
Plaintext
9867 lines
200 KiB
Plaintext
|
.\" $tcsh: tcsh.man.new,v 1.5 2016/11/24 15:06:09 christos Exp $
|
||
|
.\" From: tcsh: tcsh.man,v 3.266 2016/11/24 15:04:52 christos Exp
|
||
|
.\" Copyright (c) 1980, 1990, 1993
|
||
|
.\" The Regents of the University of California. All rights reserved.
|
||
|
.\"
|
||
|
.\" Redistribution and use in source and binary forms, with or without
|
||
|
.\" modification, are permitted provided that the following conditions
|
||
|
.\" are met:
|
||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||
|
.\" notice, this list of conditions and the following disclaimer.
|
||
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||
|
.\" notice, this list of conditions and the following disclaimer in the
|
||
|
.\" documentation and/or other materials provided with the distribution.
|
||
|
.\" 3. Neither the name of the University nor the names of its contributors
|
||
|
.\" may be used to endorse or promote products derived from this software
|
||
|
.\" without specific prior written permission.
|
||
|
.\"
|
||
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
|
||
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
|
.\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
|
.\" SUCH DAMAGE.
|
||
|
.\"
|
||
|
.\" - Indent in multiples of 4, usually 8.
|
||
|
.\"
|
||
|
.\" - Use \` for literal back-quote (`).
|
||
|
.\"
|
||
|
.\" - Use \e for literal backslash (\).
|
||
|
.\"
|
||
|
.\" - Use \-, not -.
|
||
|
.\"
|
||
|
.\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
|
||
|
.\"
|
||
|
.\" - Refer to external commands in man page format, e.g., .Xr csh 1
|
||
|
.\" However, tcsh is .Nm , because this is the tcsh man page (and
|
||
|
.\" see the next note anyway).
|
||
|
.\"
|
||
|
.\" - Say .Sq the shell , not .Sq tcsh ,
|
||
|
.\" unless distinguishing between tcsh and csh.
|
||
|
.\"
|
||
|
.\" - Say .Sq shell variable / .Sq environment variable instead of
|
||
|
.\" .Sq variable and .Sq builtin command / .Sq editor command instead of
|
||
|
.\" .Sq builtin or .Sq command
|
||
|
.\" unless the distinction is absolutely clear from context.
|
||
|
.\"
|
||
|
.\" - Use the simple present tense.
|
||
|
.\" .Sq The shell uses , not .Sq The shell will use
|
||
|
.\"
|
||
|
.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
|
||
|
.\" etc. in the reference section should be mentioned in the appropriate
|
||
|
.\" descriptive section, or at least in the reference-section description
|
||
|
.\" of another command (or whatever) which is mentioned in a description
|
||
|
.\" section. Remember to note OS-specific things in "OS variant support",
|
||
|
.\" new features in NEW FEATURES and referenced external commands in SEE
|
||
|
.\" ALSO.
|
||
|
.\"
|
||
|
.\" - tcsh.man2html depends heavily on the specific nroff commands used in the
|
||
|
.\" man page when the script was written. Please stick closely to the style
|
||
|
.\" used here if you can. In particular, please don't use nroff commands
|
||
|
.\" which aren't already used herein.
|
||
|
.\"
|
||
|
.Dd November 24, 2016
|
||
|
.Dt TCSH 1
|
||
|
.Os Astron 6.20.00
|
||
|
.Sh NAME
|
||
|
.Nm tcsh
|
||
|
.Nd C shell with file name completion and command line editing
|
||
|
.Sh SYNOPSIS
|
||
|
.Nm
|
||
|
.Op Fl bcdefFimnqstvVxX
|
||
|
.Op Fl Dname Ns Op =value
|
||
|
.Op Ar arg ...
|
||
|
.Nm
|
||
|
.Fl l
|
||
|
.Ek
|
||
|
.Sh DESCRIPTION
|
||
|
.Nm
|
||
|
is an enhanced but completely compatible version of the Berkeley
|
||
|
UNIX C shell,
|
||
|
.Xr csh 1 .
|
||
|
It is a command language interpreter usable both as an interactive login
|
||
|
shell and a shell script command processor.
|
||
|
It includes a command-line editor (see
|
||
|
.Sx The command-line editor )
|
||
|
programmable word completion (see
|
||
|
.Sx Completion and listing )
|
||
|
spelling correction (see
|
||
|
.Sx Spelling correction ) ,
|
||
|
a history mechanism (see
|
||
|
.Sx History substitution ) ,
|
||
|
job control (see
|
||
|
.Sx Jobs )
|
||
|
and a C-like syntax.
|
||
|
The
|
||
|
.Sx NEW FEATURES
|
||
|
section describes major enhancements of
|
||
|
.Nm
|
||
|
over
|
||
|
.Xr csh 1 .
|
||
|
Throughout this manual, features of
|
||
|
.Nm
|
||
|
not found in most
|
||
|
.Xr csh 1
|
||
|
implementations
|
||
|
(specifically, the 4.4BSD one)
|
||
|
are labeled with
|
||
|
.Sq (+) ,
|
||
|
and features which are present in
|
||
|
.Xr csh 1
|
||
|
but not usually documented are labeled with
|
||
|
.Sq (u) .
|
||
|
.Bl -tag
|
||
|
.Ss Argument list processing
|
||
|
If the first argument (argument 0) to the shell is
|
||
|
.Sq \-
|
||
|
then it is a login shell.
|
||
|
A login shell can be also specified by invoking the shell with
|
||
|
the
|
||
|
.Fl l
|
||
|
flag as the only argument.
|
||
|
.Pp
|
||
|
The rest of the flag arguments are interpreted as follows:
|
||
|
.Bl -tag -width indent
|
||
|
.It Fl b
|
||
|
Forces a
|
||
|
.Dq break
|
||
|
from option processing, causing any
|
||
|
further shell arguments to be treated as non-option arguments.
|
||
|
The remaining arguments will not be interpreted as shell options.
|
||
|
This may be used to pass options to a shell script without confusion
|
||
|
or possible subterfuge.
|
||
|
The shell will not run a set-user ID script without this option.
|
||
|
.It Fl c
|
||
|
Commands are read from the following argument (which must be present, and
|
||
|
must be a single argument),
|
||
|
stored in the
|
||
|
.Va command
|
||
|
shell variable for reference, and executed.
|
||
|
Any remaining arguments are placed in the
|
||
|
.Va argv
|
||
|
shell variable.
|
||
|
.It Fl d
|
||
|
The shell loads the directory stack from
|
||
|
.Pa ~/.cshdirs
|
||
|
as described under
|
||
|
.Sx Startup and shutdown ,
|
||
|
whether or not it is a login shell. (+)
|
||
|
.It Fl Dname Ns Op =value
|
||
|
Sets the environment variable
|
||
|
.Va name
|
||
|
.Dv value .
|
||
|
(Domain/OS only) (+)
|
||
|
.It Fl e
|
||
|
The shell exits if any invoked command terminates abnormally or
|
||
|
yields a non-zero exit status.
|
||
|
.It Fl f
|
||
|
The shell does not load any resource or startup files, or perform any
|
||
|
command hashing, and thus starts faster.
|
||
|
.It Fl F
|
||
|
The shell uses
|
||
|
.Xr fork 2
|
||
|
instead of
|
||
|
.Xr vfork 2
|
||
|
to spawn processes. (+)
|
||
|
.It Fl 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.
|
||
|
.It Fl l
|
||
|
The shell is a login shell.
|
||
|
Applicable only if
|
||
|
.Fl l
|
||
|
is the only
|
||
|
flag specified.
|
||
|
.It Fl m
|
||
|
The shell loads
|
||
|
.Pa ~/.tcshrc
|
||
|
even if it does not belong to the effective user.
|
||
|
Newer versions of
|
||
|
.Xr su 1
|
||
|
can pass
|
||
|
.Fl m
|
||
|
to the shell. (+)
|
||
|
.It Fl n
|
||
|
The shell parses commands but does not execute them.
|
||
|
This aids in debugging shell scripts.
|
||
|
.It Fl q
|
||
|
The shell accepts SIGQUIT (see
|
||
|
.Sx Signal handling )
|
||
|
and behaves when it is used under a debugger.
|
||
|
Job control is disabled. (u)
|
||
|
.It Fl s
|
||
|
Command input is taken from the standard input.
|
||
|
.It Fl t
|
||
|
The shell reads and executes a single line of input.
|
||
|
A
|
||
|
.Sq \e
|
||
|
may be used to
|
||
|
escape the newline at the end of this line and continue onto another line.
|
||
|
.It Fl v
|
||
|
Sets the
|
||
|
.Va verbose
|
||
|
shell variable, so that
|
||
|
command input is echoed after history substitution.
|
||
|
.It Fl x
|
||
|
Sets the
|
||
|
.Va echo
|
||
|
shell variable, so that commands are echoed
|
||
|
immediately before execution.
|
||
|
.It Fl V
|
||
|
Sets the
|
||
|
.Va verbose
|
||
|
shell variable even before executing
|
||
|
.Pa ~/.tcshrc .
|
||
|
.It Fl X
|
||
|
Is to
|
||
|
.Fl x
|
||
|
as
|
||
|
.Fl V
|
||
|
is to
|
||
|
.Fl v .
|
||
|
.TP 4
|
||
|
.It Fl \-help
|
||
|
Print a help message on the standard output and exit. (+)
|
||
|
.It Fl \-version
|
||
|
Print the version/platform/compilation options on the standard output and exit.
|
||
|
This information is also contained in the
|
||
|
.Va version
|
||
|
shell variable. (+)
|
||
|
.El
|
||
|
.Pp
|
||
|
After processing of flag arguments, if arguments remain but none of the
|
||
|
.Fl c ,
|
||
|
.Fl i ,
|
||
|
.Fl s ,
|
||
|
or
|
||
|
.Fl t
|
||
|
options were given, the first argument is taken as the name of a file of
|
||
|
commands, or
|
||
|
.Dq script ,
|
||
|
to be executed.
|
||
|
The shell opens this file and saves its name for possible
|
||
|
resubstitution by
|
||
|
.Sq $0 .
|
||
|
Because many systems use either the standard
|
||
|
version 6 or version 7 shells whose shell scripts are not compatible
|
||
|
with this shell, the shell uses such a
|
||
|
.Sq standard
|
||
|
shell to execute a script
|
||
|
whose first character is not a
|
||
|
.Sq # ,
|
||
|
i.e., that does not start with a
|
||
|
comment.
|
||
|
.Pp
|
||
|
Remaining arguments are placed in the
|
||
|
.Va argv
|
||
|
shell variable.
|
||
|
.Ss Startup and shutdown
|
||
|
A login shell begins by executing commands from the system files
|
||
|
.Pa /etc/csh.cshrc
|
||
|
and
|
||
|
.Pa /etc/csh.login .
|
||
|
It then executes commands from files in the user's
|
||
|
.Pa home
|
||
|
directory:
|
||
|
first
|
||
|
.Pa ~/.tcshrc (+)
|
||
|
or, if
|
||
|
.Pa ~/.tcshrc
|
||
|
is not found,
|
||
|
.Pa ~/.cshrc ,
|
||
|
then
|
||
|
.Pa ~/.history
|
||
|
(or the value of the
|
||
|
.Va histfile
|
||
|
shell variable), then
|
||
|
.Pa ~/.login ,
|
||
|
and finally
|
||
|
.Pa ~/.cshdirs
|
||
|
(or the value of the
|
||
|
.Va dirsfile
|
||
|
shell variable) (+).
|
||
|
The shell may read
|
||
|
.Pa /etc/csh.login
|
||
|
before instead of after
|
||
|
.Pa /etc/csh.cshrc ,
|
||
|
and
|
||
|
.Pa ~/.login
|
||
|
before instead of after
|
||
|
.Pa ~/.tcshrc
|
||
|
or
|
||
|
.Pa ~/.cshrc
|
||
|
and
|
||
|
.Pa ~/.history ,
|
||
|
if so compiled;
|
||
|
see the
|
||
|
.Va version
|
||
|
shell variable. (+)
|
||
|
.Pp
|
||
|
Non-login shells read only
|
||
|
.Pa /etc/csh.cshrc
|
||
|
and
|
||
|
.Pa ~/.tcshrc
|
||
|
or
|
||
|
.Pa ~/.cshrc
|
||
|
on startup.
|
||
|
.Pp
|
||
|
For examples of startup files, please consult:
|
||
|
.Lk http://tcshrc.sourceforge.net
|
||
|
.Pp
|
||
|
Commands like
|
||
|
.Xr stty 1
|
||
|
and
|
||
|
.Xr tset 1 ,
|
||
|
which need be run only once per login, usually go in one's
|
||
|
.Pa ~/.login
|
||
|
file.
|
||
|
Users who need to use the same set of files with both
|
||
|
.Xr csh 1
|
||
|
and
|
||
|
.Nm
|
||
|
can have only a
|
||
|
.Pa ~/.cshrc
|
||
|
which checks for the existence of the
|
||
|
.Va tcsh
|
||
|
shell variable (q.v.) before using
|
||
|
.Nm \-
|
||
|
specific commands,
|
||
|
or can have both a
|
||
|
.Pa ~/.cshrc
|
||
|
and a
|
||
|
.Pa ~/.tcshrc
|
||
|
which
|
||
|
.Ic sources
|
||
|
(see the builtin command)
|
||
|
.Pa ~/.cshrc .
|
||
|
The rest of this manual uses
|
||
|
.Pa ~/.tcshrc
|
||
|
to mean
|
||
|
.Pa ~/.tcshrc
|
||
|
or,
|
||
|
if
|
||
|
.Pa ~/.tcshrc
|
||
|
is not found,
|
||
|
.Pa ~/.cshrc .
|
||
|
.Pp
|
||
|
In the normal case, the shell begins reading commands from the terminal,
|
||
|
prompting with
|
||
|
.Sq >\~ .
|
||
|
(Processing of arguments and the use of the shell to
|
||
|
process files containing command scripts are described later.)
|
||
|
The shell repeatedly reads a line of command input, breaks it into words,
|
||
|
places it on the command history list, parses it and executes each command
|
||
|
in the line.
|
||
|
.Pp
|
||
|
One can log out by typing
|
||
|
.Sq ^D
|
||
|
on an empty line,
|
||
|
.Sq logout
|
||
|
or
|
||
|
.Sq login
|
||
|
or
|
||
|
via the shell's autologout mechanism (see the
|
||
|
.Va autologout
|
||
|
shell variable).
|
||
|
When a login shell terminates it sets the
|
||
|
.Va logout
|
||
|
shell variable to
|
||
|
.Sq normal
|
||
|
or
|
||
|
.Sq automatic
|
||
|
as appropriate, then executes commands from the files
|
||
|
.Pa /etc/csh.logout
|
||
|
and
|
||
|
.Pa ~/.logout .
|
||
|
The shell may drop DTR on logout
|
||
|
if so compiled; see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.Pp
|
||
|
The names of the system login and logout files vary from system to system for
|
||
|
compatibility with different
|
||
|
.Xr csh 1
|
||
|
variants; see
|
||
|
.Sx FILES .
|
||
|
.Ss Editing
|
||
|
We first describe
|
||
|
.Sx The command-line editor"
|
||
|
The
|
||
|
.Sx Completion and listing
|
||
|
and
|
||
|
.Sx Spelling correction
|
||
|
sections describe two sets of functionality that are implemented as editor
|
||
|
commands but which deserve their own treatment.
|
||
|
Finally,
|
||
|
.Sx Editor commands
|
||
|
lists and describes
|
||
|
the editor commands specific to the shell and their default bindings.
|
||
|
.It Sx The command-line editor (+)
|
||
|
Command-line input can be edited using key sequences much like those used in
|
||
|
.Xr emacs 1
|
||
|
or
|
||
|
.Xr vi 1 .
|
||
|
The editor is active only when the
|
||
|
.Va edit
|
||
|
shell variable is set, which it is by default in interactive shells.
|
||
|
The
|
||
|
.Ic bindkey
|
||
|
builtin can display and change key bindings.
|
||
|
.Xr emacs 1
|
||
|
style key bindings are used by default
|
||
|
(unless the shell was compiled otherwise; see the
|
||
|
.Va version
|
||
|
shell variable),
|
||
|
but
|
||
|
.Ic bindkey
|
||
|
can change the key bindings to
|
||
|
.Xr vi 1
|
||
|
style bindings en masse.
|
||
|
.Pp
|
||
|
The shell always binds the arrow keys (as defined in the
|
||
|
.Va TERMCAP
|
||
|
environment variable) to:
|
||
|
.Pp
|
||
|
.Bl -tag -width right -compact -offset indent
|
||
|
.It down
|
||
|
.Ic down-history
|
||
|
.It up
|
||
|
.Ic up-history
|
||
|
.It left
|
||
|
.Ic backward-char
|
||
|
.It right
|
||
|
.Ic forward-char
|
||
|
.El
|
||
|
.Pp
|
||
|
unless doing so would alter another single-character binding.
|
||
|
One can set the arrow key escape sequences to the empty string with
|
||
|
.Va settc
|
||
|
to prevent these bindings.
|
||
|
The ANSI/VT100 sequences for arrow keys are always bound.
|
||
|
.Pp
|
||
|
Other key bindings are, for the most part, what
|
||
|
.Xr emacs 1
|
||
|
and
|
||
|
.Xr vi 1
|
||
|
users would expect and can easily be displayed by
|
||
|
.Ic bindkey ,
|
||
|
so there
|
||
|
is no need to list them here.
|
||
|
Likewise,
|
||
|
.Ic bindkey
|
||
|
can list the editor
|
||
|
commands with a short description of each.
|
||
|
Certain key bindings have different behavior depending if
|
||
|
.Xr emacs 1
|
||
|
or
|
||
|
.Xr vi 1
|
||
|
style bindings are being used; see
|
||
|
.Va vimode
|
||
|
for more information.
|
||
|
.Pp
|
||
|
Note that editor commands do not have the same notion of a
|
||
|
.Dq word
|
||
|
as does the shell.
|
||
|
The editor delimits words with any non-alphanumeric characters not in
|
||
|
the shell variable
|
||
|
.Va wordchars ,
|
||
|
while the shell recognizes only whitespace
|
||
|
and some of the characters with special meanings to it, listed under
|
||
|
.Sx Lexical structure .
|
||
|
.Ss Completion and listing (+)
|
||
|
The shell is often able to complete words when given a unique abbreviation.
|
||
|
Type part of a word (for example
|
||
|
.Ic ls
|
||
|
.Pa /usr/lost )
|
||
|
and hit the tab key to run the
|
||
|
.Ic complete-word
|
||
|
editor command.
|
||
|
The shell completes the filename
|
||
|
.Pa /usr/lost
|
||
|
to
|
||
|
.Pa /usr/lost+found/ ,
|
||
|
replacing the incomplete word with the complete word in the input buffer.
|
||
|
(Note the terminal
|
||
|
.Sq / ;
|
||
|
completion adds a
|
||
|
.Sq /
|
||
|
to the end of completed directories and a space to the end of other completed
|
||
|
words, to speed typing and provide a visual indicator of successful completion.
|
||
|
The
|
||
|
.Va addsuffix
|
||
|
shell variable can be unset to prevent this.)
|
||
|
If no match is found (perhaps
|
||
|
.Pa /usr/lost+found
|
||
|
doesn't exist), the terminal bell rings.
|
||
|
If the word is already complete (perhaps there is a
|
||
|
.Pa /usr/lost
|
||
|
on your
|
||
|
system, or perhaps you were thinking too far ahead and typed the whole thing)
|
||
|
a
|
||
|
.Sq /
|
||
|
or space is added to the end if it isn't already there.
|
||
|
.Pp
|
||
|
Completion works anywhere in the line, not at just the end; completed
|
||
|
text pushes the rest of the line to the right.
|
||
|
Completion in the middle of a word
|
||
|
often results in leftover characters to the right of the cursor that need
|
||
|
to be deleted.
|
||
|
.Pp
|
||
|
Commands and variables can be completed in much the same way.
|
||
|
For example, typing
|
||
|
.Sq em[tab]
|
||
|
would complete
|
||
|
.Sq em
|
||
|
to
|
||
|
.Sq emacs
|
||
|
if
|
||
|
.Pa emacs
|
||
|
were the only command on your system beginning with
|
||
|
.Sq em .
|
||
|
Completion can find a command in any directory in
|
||
|
.Pa path
|
||
|
or if given a full pathname.
|
||
|
Typing
|
||
|
.Sq echo $ar[tab]
|
||
|
would complete
|
||
|
.Sq $ar
|
||
|
to
|
||
|
.Sq $argv
|
||
|
if no other variable began with
|
||
|
.Sq ar .
|
||
|
.Pp
|
||
|
The shell parses the input buffer to determine whether the word you want to
|
||
|
complete should be completed as a filename, command or variable.
|
||
|
The first word in the buffer and the first word following
|
||
|
.Sq \&; ,
|
||
|
.Sq | ,
|
||
|
.Sq |& ,
|
||
|
.Sq &&
|
||
|
or
|
||
|
.Sq ||
|
||
|
is considered to be a command.
|
||
|
A word beginning with
|
||
|
.Sq $
|
||
|
is considered to be a variable.
|
||
|
Anything else is a filename.
|
||
|
An empty line is
|
||
|
.Sq completed
|
||
|
as a filename.
|
||
|
.Pp
|
||
|
You can list the possible completions of a word at any time by typing
|
||
|
.Sq ^D
|
||
|
to run the
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
editor command.
|
||
|
The shell lists the possible completions using the
|
||
|
.Ic ls\-F
|
||
|
builtin (q.v.)
|
||
|
and reprints the prompt and unfinished command line, for example:
|
||
|
.Bd -literal -offset indent
|
||
|
> ls /usr/l[^D]
|
||
|
lbin/ lib/ local/ lost+found/
|
||
|
> ls /usr/l
|
||
|
.Ed
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va autolist
|
||
|
shell variable is set, the shell lists the remaining
|
||
|
choices (if any) whenever completion fails:
|
||
|
.Bd -literal -offset indent
|
||
|
> set autolist
|
||
|
> nm /usr/lib/libt[tab]
|
||
|
libtermcap.a@ libtermlib.a@
|
||
|
> nm /usr/lib/libterm
|
||
|
.Ed
|
||
|
.Pp
|
||
|
If
|
||
|
.Va autolist
|
||
|
shell variable is set to
|
||
|
.Sq ambiguous ,
|
||
|
choices are listed only when
|
||
|
completion fails and adds no new characters to the word being completed.
|
||
|
.Pp
|
||
|
A filename to be completed can contain variables, your own or others' home
|
||
|
directories abbreviated with
|
||
|
.Sq ~
|
||
|
(see
|
||
|
.Sx Filename substitution )
|
||
|
and directory stack entries abbreviated with
|
||
|
.Sq =
|
||
|
(see
|
||
|
.Sx Directory stack substitution ) .
|
||
|
For example,
|
||
|
.Bd -literal -offset indent
|
||
|
> ls ~k[^D]
|
||
|
kahn kas kellogg
|
||
|
> ls ~ke[tab]
|
||
|
> ls ~kellogg/
|
||
|
.Ed
|
||
|
or
|
||
|
.Bd -literal -offset indent
|
||
|
> set local = /usr/local
|
||
|
> ls $lo[tab]
|
||
|
> ls $local/[^D]
|
||
|
bin/ etc/ lib/ man/ src/
|
||
|
> ls $local/
|
||
|
.Ed
|
||
|
.Pp
|
||
|
Note that variables can also be expanded explicitly with the
|
||
|
.Ic expand-variables
|
||
|
editor command.
|
||
|
.Pp
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
lists at only the end of the line;
|
||
|
in the middle of a line it deletes the character under the cursor and
|
||
|
on an empty line it logs one out or, if then
|
||
|
.Va ignoreeof
|
||
|
variable is set, does nothing.
|
||
|
.Sq M-^D ,
|
||
|
bound to the editor command
|
||
|
.Ic list-choices ,
|
||
|
lists completion
|
||
|
possibilities anywhere on a line, and
|
||
|
.Ic list-choices
|
||
|
(or any one of the
|
||
|
related editor commands that do or don't delete, list and/or log out,
|
||
|
listed under
|
||
|
.Ic delete-char-or-list-or-eof )
|
||
|
can be bound to
|
||
|
.Sq ^D
|
||
|
with the
|
||
|
.Ic bindkey
|
||
|
builtin command if so desired.
|
||
|
.Pp
|
||
|
The
|
||
|
.Ic complete-word-fwd
|
||
|
and
|
||
|
.Ic complete-word-back
|
||
|
editor commands
|
||
|
(not bound to any keys by default) can be used to cycle up and down through
|
||
|
the list of possible completions, replacing the current word with the next or
|
||
|
previous word in the list.
|
||
|
.Pp
|
||
|
The shell variable
|
||
|
.Va fignore
|
||
|
can be set to a list of suffixes to be ignored by completion.
|
||
|
Consider the following:
|
||
|
.Bd -literal -offset indent
|
||
|
> ls
|
||
|
Makefile condiments.h~ main.o side.c
|
||
|
README main.c meal side.o
|
||
|
condiments.h main.c~
|
||
|
> set fignore = (.o \e~)
|
||
|
> emacs ma[^D]
|
||
|
main.c main.c~ main.o
|
||
|
> emacs ma[tab]
|
||
|
> emacs main.c
|
||
|
.Ed
|
||
|
.Pp
|
||
|
.Sq main.c~
|
||
|
and
|
||
|
.Sq main.o
|
||
|
are ignored by completion (but not listing),
|
||
|
because they end in suffixes in
|
||
|
.Va fignore .
|
||
|
Note that a
|
||
|
.Sq \e
|
||
|
was needed in front of
|
||
|
.Sq ~
|
||
|
to prevent it from being expanded to
|
||
|
.Va home
|
||
|
as described under
|
||
|
.Sx Filename substitution .
|
||
|
.Va fignore
|
||
|
is ignored if only one completion is possible.
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va complete
|
||
|
shell variable is set to
|
||
|
.Sq enhance ,
|
||
|
completion
|
||
|
1) ignores case and 2) considers periods, hyphens and underscores
|
||
|
.Sq ( . ,
|
||
|
.Sq \&-
|
||
|
and
|
||
|
.Sq _ )
|
||
|
to be word separators and hyphens and underscores to be equivalent.
|
||
|
If you had the following files
|
||
|
.Bd -literal -offset indent
|
||
|
comp.lang.c comp.lang.perl comp.std.c++
|
||
|
comp.lang.c++ comp.std.c
|
||
|
.Ed
|
||
|
.Pp
|
||
|
and typed
|
||
|
.Sq mail \-f c.l.c[tab] ,
|
||
|
it would be completed to
|
||
|
.Sq mail \-f comp.lang.c ,
|
||
|
and
|
||
|
.Sq ^D
|
||
|
would list
|
||
|
.Sq comp.lang.c
|
||
|
and
|
||
|
.Sq comp.lang.c++ .
|
||
|
.Sq mail \-f c..c++[^D]
|
||
|
would list
|
||
|
.Sq comp.lang.c++
|
||
|
and
|
||
|
.Sq comp.std.c++ .
|
||
|
Typing
|
||
|
.Sq rm a\-\-file[^D]
|
||
|
in the following directory
|
||
|
.Bd -literal -offset indent
|
||
|
A_silly_file a-hyphenated-file another_silly_file
|
||
|
.Ed
|
||
|
.Pp
|
||
|
would list all three files, because case is ignored and hyphens and
|
||
|
underscores are equivalent.
|
||
|
Periods, however, are not equivalent to
|
||
|
hyphens or underscores.
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va complete
|
||
|
shell variable is set to
|
||
|
.Sq enhance ,
|
||
|
completion
|
||
|
ignores case and differences between a hyphen and an underscore word
|
||
|
separator only when the user types a lowercase character or a hyphen.
|
||
|
Entering an uppercase character or an underscore will not match the
|
||
|
corresponding lowercase character or hyphen word separator.
|
||
|
Typing
|
||
|
.Sq rm a\-\-file[^D]
|
||
|
in the directory of the previous example would
|
||
|
still list all three files, but typing
|
||
|
.Sq rm A\-\-file
|
||
|
would match only
|
||
|
.Sq A_silly_file
|
||
|
and typing
|
||
|
.Sq rm a__file[^D]
|
||
|
would match just
|
||
|
.Sq A_silly_file
|
||
|
and
|
||
|
.Sq another_silly_file
|
||
|
because the user explicitly used an uppercase
|
||
|
or an underscore character.
|
||
|
.Pp
|
||
|
Completion and listing are affected by several other shell variables:
|
||
|
.Va recexact
|
||
|
can be set to complete on the shortest possible unique
|
||
|
match, even if more typing might result in a longer match:
|
||
|
.Bd -literal -offset indent
|
||
|
> ls
|
||
|
fodder foo food foonly
|
||
|
> set recexact
|
||
|
> rm fo[tab]
|
||
|
.Ed
|
||
|
.Pp
|
||
|
just beeps, because
|
||
|
.Sq fo
|
||
|
could expand to
|
||
|
.Sq fod
|
||
|
or
|
||
|
.Sq foo ,
|
||
|
but if we type another
|
||
|
.Sq o ,
|
||
|
.Bd -literal -offset indent
|
||
|
> rm foo[tab]
|
||
|
> rm foo
|
||
|
.Ed
|
||
|
.Pp
|
||
|
the completion completes on
|
||
|
.Sq foo ,
|
||
|
even though
|
||
|
.Sq food
|
||
|
and
|
||
|
.Sq foonly
|
||
|
also match.
|
||
|
.Va autoexpand
|
||
|
can be set to run the
|
||
|
.Ic expand-history
|
||
|
editor command
|
||
|
before each completion attempt,
|
||
|
.Va autocorrect
|
||
|
can be set to
|
||
|
spelling-correct the word to be completed (see
|
||
|
.Sx Spelling correction )
|
||
|
before each completion attempt and
|
||
|
.Va correct
|
||
|
can be set to complete commands automatically after one hits
|
||
|
.Sq return .
|
||
|
.Va matchbeep
|
||
|
can be set to make completion beep or not beep in a variety
|
||
|
of situations, and
|
||
|
.Va nobeep
|
||
|
can be set to never beep at all.
|
||
|
.Va nostat
|
||
|
can be set to a list of directories and/or patterns that
|
||
|
match directories to prevent the completion mechanism from
|
||
|
.Xr stat 2
|
||
|
ing
|
||
|
those directories.
|
||
|
.Va listmax
|
||
|
and
|
||
|
.Va listmaxrows
|
||
|
can be set to limit the number of items
|
||
|
and rows (respectively) that are listed without asking first.
|
||
|
.Va recognize_only_executables
|
||
|
can be set to make the shell list only
|
||
|
executables when listing commands, but it is quite slow.
|
||
|
.Pp
|
||
|
Finally, the
|
||
|
.Ic complete
|
||
|
builtin command can be used to tell the shell how
|
||
|
to complete words other than filenames, commands and variables.
|
||
|
Completion and listing do not work on glob-patterns (see
|
||
|
.Sx Filename substitution ) ,
|
||
|
but the
|
||
|
.Ic list-glob
|
||
|
and
|
||
|
.Ic expand-glob
|
||
|
editor commands perform
|
||
|
equivalent functions for glob-patterns.
|
||
|
.Ss Spelling correction (+)
|
||
|
The shell can sometimes correct the spelling of filenames, commands and
|
||
|
variable names as well as completing and listing them.
|
||
|
.Pp
|
||
|
Individual words can be spelling-corrected with the
|
||
|
.Ic spell-word
|
||
|
editor command (usually bound to M-s and M-S)
|
||
|
and the entire input buffer with
|
||
|
.Ic spell-line
|
||
|
(usually bound to M-$).
|
||
|
The
|
||
|
.Va correct
|
||
|
shell variable can be set to
|
||
|
.Dv cmd
|
||
|
to correct the command name or
|
||
|
.Dv all
|
||
|
to correct the entire line each time return is typed, and
|
||
|
.Va autocorrect
|
||
|
can be set to correct the word to be completed
|
||
|
before each completion attempt.
|
||
|
.Pp
|
||
|
When spelling correction is invoked in any of these ways and
|
||
|
the shell thinks that any part of the command line is misspelled,
|
||
|
it prompts with the corrected line:
|
||
|
.Bd -literal -offset indent
|
||
|
> set correct = cmd
|
||
|
> lz /usr/bin
|
||
|
CORRECT>ls /usr/bin (y|n|e|a)?
|
||
|
.Ed
|
||
|
.Pp
|
||
|
One can answer
|
||
|
.Sq y
|
||
|
or space to execute the corrected line,
|
||
|
.Sq e
|
||
|
to leave the uncorrected command in the input buffer,
|
||
|
.Sq a
|
||
|
to abort the command as if
|
||
|
.Sq ^C
|
||
|
had been hit, and
|
||
|
anything else to execute the original line unchanged.
|
||
|
.Pp
|
||
|
Spelling correction recognizes user-defined completions (see the
|
||
|
.Ic complete
|
||
|
builtin command).
|
||
|
If an input word in a position for
|
||
|
which a completion is defined resembles a word in the completion list,
|
||
|
spelling correction registers a misspelling and suggests the latter
|
||
|
word as a correction.
|
||
|
However, if the input word does not match any of
|
||
|
the possible completions for that position, spelling correction does
|
||
|
not register a misspelling.
|
||
|
.Pp
|
||
|
Like completion, spelling correction works anywhere in the line,
|
||
|
pushing the rest of the line to the right and possibly leaving
|
||
|
extra characters to the right of the cursor.
|
||
|
.Ss Editor commands (+)
|
||
|
.Ic bindkey
|
||
|
lists key bindings and
|
||
|
.Ic bindkey \-l
|
||
|
lists and briefly describes editor commands.
|
||
|
Only new or especially interesting editor commands are described here.
|
||
|
See
|
||
|
.Xr emacs 1
|
||
|
and
|
||
|
.Xr vi 1
|
||
|
for descriptions of each editor's key bindings.
|
||
|
.Pp
|
||
|
The character or characters to which each command is bound by default is
|
||
|
given in parentheses.
|
||
|
.Sq ^character
|
||
|
means a control character and
|
||
|
.Sq M-character
|
||
|
a meta character, typed as
|
||
|
.Sq escape-character
|
||
|
on terminals without a meta key.
|
||
|
Case counts, but commands that are bound
|
||
|
to letters by default are bound to both lower- and uppercase letters for
|
||
|
convenience.
|
||
|
.Bl -tag -width indent
|
||
|
.It Ic backward-char Ar (^B, left)
|
||
|
Move back a character.
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic backward-delete-word Ar (M-^H, M-^?)
|
||
|
Cut from beginning of current word to cursor \- saved in cut buffer.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic backward-word Ar (M-b, M-B)
|
||
|
Move to beginning of current word.
|
||
|
Word boundary and cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic beginning-of-line Ar (^A, home)
|
||
|
Move to beginning of line.
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic capitalize-word Ar (M-c, M-C)
|
||
|
Capitalize the characters from cursor to end of current word.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic complete-word Ar (tab)
|
||
|
Completes a word as described under
|
||
|
.Sx Completion and listing
|
||
|
.It Ic complete-word-back Ar (not bound)
|
||
|
Like
|
||
|
.Ic complete-word-fwd ,
|
||
|
but steps up from the end of the list.
|
||
|
.It Ic complete-word-fwd Ar (not bound)
|
||
|
Replaces the current word with the first word in the list of possible
|
||
|
completions.
|
||
|
May be repeated to step down through the list.
|
||
|
At the end of the list, beeps and reverts to the incomplete word.
|
||
|
.It Ic complete-word-raw Ar (^X-tab)
|
||
|
Like
|
||
|
.Ic complete-word ,
|
||
|
but ignores user-defined completions.
|
||
|
.It Ic copy-prev-word Ar (M-^_)
|
||
|
Copies the previous word in the current line into the input buffer.
|
||
|
See also
|
||
|
.Ic insert-last-word
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic dabbrev-expand Ar (M-/)
|
||
|
Expands the current word to the most recent preceding one for which
|
||
|
the current is a leading substring, wrapping around the history list
|
||
|
(once) if necessary.
|
||
|
Repeating
|
||
|
.Ic dabbrev-expand
|
||
|
without any intervening typing
|
||
|
changes to the next previous word etc., skipping identical matches
|
||
|
much like
|
||
|
.Ic history-search-backward
|
||
|
does.
|
||
|
.It Ic delete-char Ar (not bound)
|
||
|
Deletes the character under the cursor.
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic delete-char-or-eof Ar (not bound)
|
||
|
Does
|
||
|
.Ic delete-char
|
||
|
if there is a character under the cursor or
|
||
|
.Ic end-of-file
|
||
|
on an empty line.
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic delete-char-or-list Ar (not bound)
|
||
|
Does
|
||
|
.Ic delete-char
|
||
|
if there is a character under the cursor
|
||
|
or
|
||
|
.Ic list-choices
|
||
|
at the end of the line.
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
.It Ic delete-char-or-list-or-eof Ar (^D)
|
||
|
Does
|
||
|
.Ic delete-char
|
||
|
if there is a character under the cursor,
|
||
|
.Ic list-choices
|
||
|
at the end of the line or
|
||
|
.Ic end-of-file
|
||
|
on an empty line.
|
||
|
See also those three commands, each of which does only a single action, and
|
||
|
.Ic delete-char-or-eof ,
|
||
|
.Ic delete-char-or-list
|
||
|
and
|
||
|
.Ic list-or-eof ,
|
||
|
each of which does a different two out of the three.
|
||
|
.It Ic delete-word Ar (M-d, M-D)
|
||
|
Cut from cursor to end of current word \- save in cut buffer.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic down-history Ar (down-arrow, ^N)
|
||
|
Like
|
||
|
.Ic up-history ,
|
||
|
but steps down, stopping at the original input line.
|
||
|
.It Ic downcase-word Ar (M-l, M-L)
|
||
|
Lowercase the characters from cursor to end of current word.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic end-of-file Ar (not bound)
|
||
|
Signals an end of file, causing the shell to exit unless the
|
||
|
.Va ignoreeof
|
||
|
shell variable (q.v.) is set to prevent this.
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
.It Ic end-of-line Ar (^E, end)
|
||
|
Move cursor to end of line.
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic expand-history Ar (M-space)
|
||
|
Expands history substitutions in the current word.
|
||
|
See
|
||
|
.Sx History substitution
|
||
|
See also
|
||
|
.Ic magic-space ,
|
||
|
.Ic toggle-literal-history
|
||
|
and the
|
||
|
.Va autoexpand
|
||
|
shell variable.
|
||
|
.It Ic expand-glob Ar (^X-*)
|
||
|
Expands the glob-pattern to the left of the cursor.
|
||
|
See
|
||
|
.Sx Filename substitution
|
||
|
.It Ic expand-line Ar (not bound)
|
||
|
Like
|
||
|
.Ic expand-history ,
|
||
|
but expands history substitutions in each word in the input buffer.
|
||
|
.It Ic expand-variables Ar (^X-$)
|
||
|
Expands the variable to the left of the cursor.
|
||
|
See
|
||
|
.Sx Variable substitution
|
||
|
.It Ic forward-char Ar (^F, right)
|
||
|
Move forward one character.
|
||
|
Cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic forward-word Ar (M-f, M-F)
|
||
|
Move forward to end of current word.
|
||
|
Word boundary and cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic history-search-backward Ar (M-p, M-P)
|
||
|
Searches backwards through the history list for a command beginning with
|
||
|
the current contents of the input buffer up to the cursor and copies it
|
||
|
into the input buffer.
|
||
|
The search string may be a glob-pattern (see
|
||
|
.Sx Filename substitution )
|
||
|
containing
|
||
|
.Sq * ,
|
||
|
.Sq \&? ,
|
||
|
.Sq []
|
||
|
or
|
||
|
.Sq {}
|
||
|
.Ic up-history
|
||
|
and
|
||
|
.Ic down-history
|
||
|
will proceed from the
|
||
|
appropriate point in the history list.
|
||
|
Emacs mode only.
|
||
|
See also
|
||
|
.Ic history-search-forward
|
||
|
and
|
||
|
.Ic i-search-back
|
||
|
.It Ic history-search-forward Ar (M-n, M-N)
|
||
|
Like
|
||
|
.Ic history-search-backward ,
|
||
|
but searches forward.
|
||
|
.It Ic i-search-back Ar (not bound)
|
||
|
Searches backward like
|
||
|
.Ic history-search-backward ,
|
||
|
copies the first match
|
||
|
into the input buffer with the cursor positioned at the end of the pattern,
|
||
|
and prompts with
|
||
|
.Sq bck:
|
||
|
and the first match.
|
||
|
Additional characters may be
|
||
|
typed to extend the search,
|
||
|
.Ic i-search-back
|
||
|
may be typed to continue
|
||
|
searching with the same pattern, wrapping around the history list if
|
||
|
necessary,
|
||
|
.Ic ( i-search-back
|
||
|
must be bound to a
|
||
|
single character for this to work) or one of the following special characters
|
||
|
may be typed:
|
||
|
.Pp
|
||
|
.Sq ^W
|
||
|
Appends the rest of the word under the cursor to the search pattern.
|
||
|
delete (or any character bound to
|
||
|
.Ic backward-delete-char )
|
||
|
Undoes the effect of the last character typed and deletes a character
|
||
|
from the search pattern if appropriate.
|
||
|
.Sq ^G
|
||
|
If the previous search was successful, aborts the entire search.
|
||
|
If not, goes back to the last successful search.
|
||
|
escape
|
||
|
Ends the search, leaving the current line in the input buffer.
|
||
|
.Pp
|
||
|
Any other character not bound to
|
||
|
.Ic self-insert-command
|
||
|
terminates the
|
||
|
search, leaving the current line in the input buffer, and
|
||
|
is then interpreted as normal input.
|
||
|
In particular, a carriage return
|
||
|
causes the current line to be executed.
|
||
|
See also
|
||
|
.Ic i-search-fwd
|
||
|
and
|
||
|
.Ic history-search-backward
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic i-search-fwd Ar (not bound)
|
||
|
Like
|
||
|
.Ic i-search-back ,
|
||
|
but searches forward.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic insert-last-word Ar (M-_)
|
||
|
Inserts the last word of the previous input line
|
||
|
.Sq ( \&!$ )
|
||
|
into the input buffer.
|
||
|
See also
|
||
|
.Ic copy-prev-word
|
||
|
.It Ic list-choices Ar (M-^D)
|
||
|
Lists completion possibilities as described under
|
||
|
.Sx Completion and listing
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
and
|
||
|
.Ic list-choices-raw
|
||
|
.It Ic list-choices-raw Ar (^X-^D)
|
||
|
Like
|
||
|
.Ic list-choices ,
|
||
|
but ignores user-defined completions.
|
||
|
.It Ic list-glob Ar (^X-g, ^X-G)
|
||
|
Lists (via the
|
||
|
.Ic ls\-F
|
||
|
builtin) matches to the glob-pattern
|
||
|
(see
|
||
|
.Sx Filename substitution )
|
||
|
to the left of the cursor.
|
||
|
.It Ic list-or-eof Ar (not bound)
|
||
|
Does
|
||
|
.Ic list-choices
|
||
|
or
|
||
|
.Ic end-of-file
|
||
|
on an empty line.
|
||
|
See also
|
||
|
.Ic delete-char-or-list-or-eof
|
||
|
.It Ic magic-space Ar (not bound)
|
||
|
Expands history substitutions in the current line,
|
||
|
like
|
||
|
.Ic expand-history ,
|
||
|
and inserts a space.
|
||
|
.Ic magic-space
|
||
|
is designed to be bound to the space bar,
|
||
|
but is not bound by default.
|
||
|
.It Ic normalize-command Ar (^X-?)
|
||
|
Searches for the current word in PATH and, if it is found, replaces it with
|
||
|
the full path to the executable.
|
||
|
Special characters are quoted.
|
||
|
Aliases are
|
||
|
expanded and quoted but commands within aliases are not.
|
||
|
This command is
|
||
|
useful with commands that take commands as arguments, e.g.,
|
||
|
.Sq dbx
|
||
|
and
|
||
|
.Sq sh \-x
|
||
|
.It Ic normalize-path Ar (^X-n, ^X-N)
|
||
|
Expands the current word as described under the
|
||
|
.Sq expand
|
||
|
setting
|
||
|
of the
|
||
|
.Va symlinks
|
||
|
shell variable.
|
||
|
.It Ic overwrite-mode Ar (unbound)
|
||
|
Toggles between input and overwrite modes.
|
||
|
.It Ic run-fg-editor Ar (M-^Z)
|
||
|
Saves the current input line and
|
||
|
looks for a stopped job where the file name portion of its first word
|
||
|
is found in the
|
||
|
.Va editors
|
||
|
shell variable.
|
||
|
If
|
||
|
.Va editors
|
||
|
is not set, then the file name portion of the
|
||
|
.Va EDITOR
|
||
|
environment variable
|
||
|
.Sq ( ed
|
||
|
if unset)
|
||
|
and the
|
||
|
.Va VISUAL
|
||
|
environment variable
|
||
|
Sq ( vi
|
||
|
if unset)
|
||
|
will be used.
|
||
|
If such a job is found, it is restarted as if
|
||
|
.Sq fg %
|
||
|
.Ic job
|
||
|
had been typed.
|
||
|
This is used to toggle back and forth between an editor and
|
||
|
the shell easily.
|
||
|
Some people bind this command to
|
||
|
.Sq ^Z
|
||
|
so they
|
||
|
can do this even more easily.
|
||
|
.It Ic run-help Ar (M-h, M-H)
|
||
|
Searches for documentation on the current command, using the same notion of
|
||
|
.Sq current command
|
||
|
as the completion routines, and prints it.
|
||
|
There is no way
|
||
|
to use a pager;
|
||
|
.Ic run-help
|
||
|
is designed for short help files.
|
||
|
If the special alias
|
||
|
.Va helpcommand
|
||
|
is defined, it is run with the
|
||
|
command name as a sole argument.
|
||
|
Else,
|
||
|
documentation should be in a file named
|
||
|
.Sq command.help ,
|
||
|
.Sq command.1 ,
|
||
|
.Sq command.6 ,
|
||
|
.Sq command.8 ,
|
||
|
or
|
||
|
.Sq command ,
|
||
|
which should be in one
|
||
|
of the directories listed in the
|
||
|
.Va HPATH
|
||
|
environment variable.
|
||
|
If there is more than one help file only the first is printed.
|
||
|
.It Ic self-insert-command Ar (text characters)
|
||
|
In insert mode (the default), inserts the typed character into the input line after the character under the cursor.
|
||
|
In overwrite mode, replaces the character under the cursor with the typed character.
|
||
|
The input mode is normally preserved between lines, but the
|
||
|
.Va inputmode
|
||
|
shell variable can be set to
|
||
|
.Dv insert
|
||
|
or
|
||
|
.Dv overwrite
|
||
|
to put the
|
||
|
editor in that mode at the beginning of each line.
|
||
|
See also
|
||
|
.Ic overwrite-mode
|
||
|
.It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X)
|
||
|
Indicates that the following characters are part of a
|
||
|
multi-key sequence.
|
||
|
Binding a command to a multi-key sequence really creates
|
||
|
two bindings: the first character to
|
||
|
.Ic sequence-lead-in
|
||
|
and the
|
||
|
whole sequence to the command.
|
||
|
All sequences beginning with a character
|
||
|
bound to
|
||
|
.Ic sequence-lead-in
|
||
|
are effectively bound to
|
||
|
.Ic undefined-key
|
||
|
unless bound to another command.
|
||
|
.It Ic spell-line Ar (M-$)
|
||
|
Attempts to correct the spelling of each word in the input buffer, like
|
||
|
.Ic spell-word ,
|
||
|
but ignores words whose first character is one of
|
||
|
.Sq \- ,
|
||
|
.Sq \ ! ,
|
||
|
.Sq ^
|
||
|
or
|
||
|
.Sq % ,
|
||
|
or which contain
|
||
|
.Sq \e ,
|
||
|
.Sq *
|
||
|
or
|
||
|
.Sq \&? ,
|
||
|
to avoid problems with switches, substitutions and the like.
|
||
|
See
|
||
|
.Sx Spelling correction
|
||
|
.It Ic spell-word Ar (M-s, M-S)
|
||
|
Attempts to correct the spelling of the current word as described under
|
||
|
.Sx Spelling correction
|
||
|
Checks each component of a word which appears to be a pathname.
|
||
|
.It Ic toggle-literal-history Ar (M-r, M-R)
|
||
|
Expands or
|
||
|
.Sq unexpands
|
||
|
history substitutions in the input buffer.
|
||
|
See also
|
||
|
.Ic expand-history
|
||
|
and the
|
||
|
.Va autoexpand
|
||
|
shell variable.
|
||
|
.It Ic undefined-key Ar (any unbound key)
|
||
|
Beeps.
|
||
|
.It Ic up-history Ar (up-arrow, ^P)
|
||
|
Copies the previous entry in the history list into the input buffer.
|
||
|
If
|
||
|
.Va histlit
|
||
|
is set, uses the literal form of the entry.
|
||
|
May be repeated to step up through the history list, stopping at the top.
|
||
|
.It Ic upcase-word Ar (M-u, M-U)
|
||
|
Uppercase the characters from cursor to end of current word.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic vi-beginning-of-next-word Ar (not bound)
|
||
|
Vi goto the beginning of next word.
|
||
|
Word boundary and cursor behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic vi-eword Ar (not bound)
|
||
|
Vi move to the end of the current word.
|
||
|
Word boundary behavior modified by
|
||
|
.Va vimode
|
||
|
.It Ic vi-search-back Ar (?)
|
||
|
Prompts with
|
||
|
.Sq \&?
|
||
|
for a search string (which may be a glob-pattern, as with
|
||
|
.Ic history-search-backward ),
|
||
|
searches for it and copies it into the input buffer.
|
||
|
The bell rings if no match is found.
|
||
|
Hitting return ends the search and leaves the last match in the input
|
||
|
buffer.
|
||
|
Hitting escape ends the search and executes the match.
|
||
|
.Ic vi
|
||
|
mode only.
|
||
|
.It Ic vi-search-fwd Ar (/)
|
||
|
Like
|
||
|
.Ic vi-search-back ,
|
||
|
but searches forward.
|
||
|
.It Ic which-command Ar (M-?)
|
||
|
Does a
|
||
|
.Ic which
|
||
|
(see the description of the builtin command) on the
|
||
|
first word of the input buffer.
|
||
|
.It Ic yank-pop Ar (M-y)
|
||
|
When executed immediately after a
|
||
|
.Ic yank
|
||
|
or another
|
||
|
.Ic yank-pop ,
|
||
|
replaces the yanked string with the next previous string from the
|
||
|
killring. This also has the effect of rotating the killring, such that
|
||
|
this string will be considered the most recently killed by a later
|
||
|
.Ic yank
|
||
|
command. Repeating
|
||
|
.Ic yank-pop
|
||
|
will cycle through the
|
||
|
killring any number of times.
|
||
|
.El
|
||
|
.Ss Lexical structure
|
||
|
The shell splits input lines into words at blanks and tabs.
|
||
|
The special
|
||
|
characters
|
||
|
.Sq \&& ,
|
||
|
.Sq | ,
|
||
|
.Sq \&; ,
|
||
|
.Sq < ,
|
||
|
.Sq > ,
|
||
|
.Sq \&( ,
|
||
|
and
|
||
|
.Sq \&)
|
||
|
and the doubled characters
|
||
|
.Sq && ,
|
||
|
.Sq || ,
|
||
|
.Sq <<
|
||
|
and
|
||
|
.Sq >>
|
||
|
are always separate words, whether or not they are
|
||
|
surrounded by whitespace.
|
||
|
.Pp
|
||
|
When the shell's input is not a terminal, the character
|
||
|
.Sq #
|
||
|
is taken to begin a
|
||
|
comment.
|
||
|
Each
|
||
|
.Sq #
|
||
|
and the rest of the input line on which it appears is
|
||
|
discarded before further parsing.
|
||
|
.Pp
|
||
|
A special character (including a blank or tab) may be prevented from having
|
||
|
its special meaning, and possibly made part of another word, by preceding it
|
||
|
with a backslash
|
||
|
.Sq ( \e )
|
||
|
or enclosing it in single
|
||
|
.Sq ( \&' ) ,
|
||
|
, double
|
||
|
.Sq ( \&" )
|
||
|
or
|
||
|
backward
|
||
|
.Sq ( \&` )
|
||
|
quotes.
|
||
|
When not otherwise quoted a newline preceded by a
|
||
|
.Sq \e
|
||
|
is equivalent to a blank, but inside quotes this sequence results in a
|
||
|
newline.
|
||
|
.Pp
|
||
|
Furthermore, all
|
||
|
.Sx Substitutions
|
||
|
(see below) except
|
||
|
.Sx History substitution
|
||
|
can be prevented by enclosing the strings (or parts of strings)
|
||
|
in which they appear with single quotes or by quoting the crucial character(s)
|
||
|
(e.g.,
|
||
|
.Sq $
|
||
|
or
|
||
|
.Sq \&`
|
||
|
for
|
||
|
.Sx Variable substitution
|
||
|
or
|
||
|
.Sx Command substitution
|
||
|
respectively)
|
||
|
with
|
||
|
.Sq \e
|
||
|
.Sx ( Alias substitution
|
||
|
is no exception: quoting in any way any
|
||
|
character of a word for which an
|
||
|
.Va alias
|
||
|
has been defined prevents
|
||
|
substitution of the alias.
|
||
|
The usual way of quoting an alias is to precede it
|
||
|
with a backslash.)
|
||
|
.Sx History substitution
|
||
|
is prevented by
|
||
|
backslashes but not by single quotes.
|
||
|
Strings quoted with double or backward
|
||
|
quotes undergo
|
||
|
.Sx Variable substitution
|
||
|
and
|
||
|
.Sx Command substitution ,
|
||
|
but other substitutions are prevented.
|
||
|
.Pp
|
||
|
Text inside single or double quotes becomes a single word (or part of one).
|
||
|
Metacharacters in these strings, including blanks and tabs, do not form
|
||
|
separate words.
|
||
|
Only in one special case (see
|
||
|
.Sx Command substitution
|
||
|
below) can a double-quoted string yield parts of more than one word;
|
||
|
single-quoted strings never do.
|
||
|
Backward quotes are special: they signal
|
||
|
.Sx Command substitution
|
||
|
(q.v.), which may result in more than one word.
|
||
|
.Pp
|
||
|
Quoting complex strings, particularly strings which themselves contain quoting
|
||
|
characters, can be confusing.
|
||
|
Remember that quotes need not be used as they are
|
||
|
in human writing!
|
||
|
It may be easier to quote not an entire string, but only
|
||
|
those parts of the string which need quoting, using different types of quoting
|
||
|
to do so if appropriate.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va backslash_quote
|
||
|
shell variable (q.v.) can be set to make backslashes
|
||
|
always quote
|
||
|
.Sq \e ,
|
||
|
.Sq \&' ,
|
||
|
and
|
||
|
.Sq \&"
|
||
|
(+) This may make complex quoting tasks
|
||
|
easier, but it can cause syntax errors in
|
||
|
.Xr csh 1
|
||
|
scripts.
|
||
|
.Ss Substitutions
|
||
|
We now describe the various transformations the shell performs on the input in
|
||
|
the order in which they occur.
|
||
|
We note in passing the data structures involved
|
||
|
and the commands and variables which affect them.
|
||
|
Remember that substitutions
|
||
|
can be prevented by quoting as described under
|
||
|
.Sx Lexical structure .
|
||
|
.Ss History substitution
|
||
|
Each command, or
|
||
|
.Sq event ,
|
||
|
input from the terminal is saved in the history list.
|
||
|
The previous command is always saved, and the
|
||
|
.Va history
|
||
|
shell
|
||
|
variable can be set to a number to save that many commands.
|
||
|
The
|
||
|
.Va histdup
|
||
|
shell variable can be set to not save duplicate events or consecutive duplicate
|
||
|
events.
|
||
|
.Pp
|
||
|
Saved commands are numbered sequentially from 1 and stamped with the time.
|
||
|
It is not usually necessary to use event numbers, but the current event number
|
||
|
can be made part of the prompt by placing an
|
||
|
.Sq \&!
|
||
|
in the
|
||
|
.Va prompt
|
||
|
shell variable.
|
||
|
.Pp
|
||
|
The shell actually saves history in expanded and literal (unexpanded) forms.
|
||
|
If the
|
||
|
.Va histlit
|
||
|
shell variable is set, commands that display and store
|
||
|
history use the literal form.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va history
|
||
|
builtin command can print, store in a file, restore
|
||
|
and clear the history list at any time,
|
||
|
and the
|
||
|
.Va savehist
|
||
|
and
|
||
|
.Va histfile
|
||
|
shell variables can be set to
|
||
|
store the history list automatically on logout and restore it on login.
|
||
|
.Pp
|
||
|
History substitutions introduce words from the history list into the input
|
||
|
stream, making it easy to repeat commands, repeat arguments of a previous
|
||
|
command in the current command, or fix spelling mistakes in the previous
|
||
|
command with little typing and a high degree of confidence.
|
||
|
.Pp
|
||
|
History substitutions begin with the character
|
||
|
.Sq \&!
|
||
|
They may begin anywhere in
|
||
|
the input stream, but they do not nest.
|
||
|
The
|
||
|
.Sq \&!
|
||
|
may be preceded by a
|
||
|
.Sq \e
|
||
|
to
|
||
|
prevent its special meaning; for convenience, a
|
||
|
.Sq \&!
|
||
|
is passed unchanged when it
|
||
|
is followed by a blank, tab, newline,
|
||
|
.Sq =
|
||
|
or
|
||
|
.Sq \&(
|
||
|
History substitutions also
|
||
|
occur when an input line begins with
|
||
|
.Sq ^
|
||
|
This special abbreviation will be
|
||
|
described later.
|
||
|
The characters used to signal history substitution
|
||
|
.Sq ( \&!
|
||
|
and
|
||
|
.Sq ^ )
|
||
|
can be changed by setting the
|
||
|
.Va histchars
|
||
|
shell variable.
|
||
|
Any input
|
||
|
line which contains a history substitution is printed before it is executed.
|
||
|
.Pp
|
||
|
A history substitution may have an
|
||
|
.Sq event specification ,
|
||
|
which indicates the event from which words are to be taken, a
|
||
|
.Sq word designator ,
|
||
|
which selects particular words from the chosen event, and/or a
|
||
|
.Sq modifier ,
|
||
|
which manipulates the selected words.
|
||
|
.Pp
|
||
|
An event specification can be
|
||
|
.Pp
|
||
|
.Bl -tag -width XXXX -offset indent -compact
|
||
|
.It Ar n
|
||
|
A number, referring to a particular event
|
||
|
.It Ar \-n
|
||
|
An offset, referring to the event
|
||
|
.Ar n
|
||
|
before the current event
|
||
|
.It Ar #
|
||
|
The current event.
|
||
|
This should be used carefully in
|
||
|
.Xr csh 1 ,
|
||
|
where there is no check for recursion.
|
||
|
.Nm
|
||
|
allows 10 levels of recursion.
|
||
|
(+)
|
||
|
.It Ar \&!
|
||
|
The previous event (equivalent to
|
||
|
.Sq \-1 )
|
||
|
.It Ar s
|
||
|
The most recent event whose first word begins with the string
|
||
|
.Va s
|
||
|
.It Ar ?s?
|
||
|
The most recent event which contains the string
|
||
|
.Va s
|
||
|
The second
|
||
|
.Sq \&?
|
||
|
can be omitted if it is immediately followed by a newline.
|
||
|
.El
|
||
|
.Pp
|
||
|
For example, consider this bit of someone's history list:
|
||
|
.Bd -literal -offset indent
|
||
|
9 8:30 nroff \-man wumpus.man
|
||
|
10 8:31 cp wumpus.man wumpus.man.old
|
||
|
11 8:36 vi wumpus.man
|
||
|
12 8:37 diff wumpus.man.old wumpus.man
|
||
|
.Ed
|
||
|
.Pp
|
||
|
The commands are shown with their event numbers and time stamps.
|
||
|
The current event, which we haven't typed in yet, is event 13.
|
||
|
.Sq !11
|
||
|
and
|
||
|
.Sq !\-2
|
||
|
refer to event 11.
|
||
|
.Sq \&!!
|
||
|
refers to the previous event, 12.
|
||
|
.Sq \&!!
|
||
|
can be abbreviated
|
||
|
.Sq \&!
|
||
|
if it is
|
||
|
followed by
|
||
|
.Sq \&:
|
||
|
.Sq ( \&:
|
||
|
is described below).
|
||
|
.Sq !n
|
||
|
refers to event 9, which begins with
|
||
|
.Sq n
|
||
|
.Sq !?old?
|
||
|
also refers to event 12, which contains
|
||
|
.Sq old
|
||
|
Without word designators or modifiers history references simply expand to the
|
||
|
entire event, so we might type
|
||
|
.Sq !cp
|
||
|
to redo the copy command or
|
||
|
.Sq !!|more
|
||
|
if the
|
||
|
.Sq diff
|
||
|
output scrolled off the top of the screen.
|
||
|
.Pp
|
||
|
History references may be insulated from the surrounding text with braces if
|
||
|
necessary.
|
||
|
For example,
|
||
|
.Sq !vdoc
|
||
|
would look for a command beginning with
|
||
|
.Sq vdoc ,
|
||
|
and, in this example, not find one, but
|
||
|
.Sq !{v}doc
|
||
|
would expand
|
||
|
unambiguously to
|
||
|
.Sq vi wumpus.mandoc
|
||
|
Even in braces, history substitutions do not nest.
|
||
|
.Pp
|
||
|
(+) While
|
||
|
.Xr csh 1
|
||
|
expands, for example,
|
||
|
.Sq !3d
|
||
|
to event 3 with the
|
||
|
letter
|
||
|
.Sq d
|
||
|
appended to it,
|
||
|
.Nm
|
||
|
expands it to the last event beginning
|
||
|
with
|
||
|
.Sq 3d ;
|
||
|
only completely numeric arguments are treated as event numbers.
|
||
|
This makes it possible to recall events beginning with numbers.
|
||
|
To expand
|
||
|
.Sq !3d
|
||
|
as in
|
||
|
.Xr csh 1
|
||
|
say
|
||
|
.Sq !{3}d
|
||
|
.Pp
|
||
|
To select words from an event we can follow the event specification by a
|
||
|
.Sq \&:
|
||
|
and a designator for the desired words.
|
||
|
The words of an input line are
|
||
|
numbered from 0, the first (usually command) word being 0, the second word
|
||
|
(first argument) being 1, etc.
|
||
|
The basic word designators are:
|
||
|
.Bl -tag -width XXXX -offset indent -compact
|
||
|
.It Ar 0
|
||
|
The first (command) word
|
||
|
.It Ar n
|
||
|
The
|
||
|
.Va n
|
||
|
th argument
|
||
|
.It Ar ^
|
||
|
The first argument, equivalent to
|
||
|
.Sq 1
|
||
|
.It Ar $
|
||
|
The last argument
|
||
|
.It Ar %
|
||
|
The word matched by an ?
|
||
|
.Va s
|
||
|
? search
|
||
|
.It Ar x\-y
|
||
|
A range of words
|
||
|
.It Ar \-y
|
||
|
Equivalent to
|
||
|
.Sq 0\-y
|
||
|
.It Ar *
|
||
|
Equivalent to
|
||
|
.Sq ^\-$ ,
|
||
|
but returns nothing if the event contains only 1 word
|
||
|
.It Ar x*
|
||
|
Equivalent to
|
||
|
.Sq x\-$
|
||
|
.It Ar x\-
|
||
|
Equivalent to
|
||
|
.Sq x* ,
|
||
|
but omitting the last word
|
||
|
.Sq ( $ )
|
||
|
.El
|
||
|
.Pp
|
||
|
Selected words are inserted into the command line separated by single blanks.
|
||
|
For example, the
|
||
|
.Sq diff
|
||
|
command in the previous example might have been
|
||
|
typed as
|
||
|
.Sq diff !!:1.old !!:1
|
||
|
(using
|
||
|
.Sq \&:1
|
||
|
to select the first argument
|
||
|
from the previous event) or
|
||
|
.Sq diff !\-2:2 !\-2:1
|
||
|
to select and swap the
|
||
|
arguments from the
|
||
|
.Sq cp
|
||
|
command.
|
||
|
If we didn't care about the order of the
|
||
|
`diff' we might have said
|
||
|
.Sq diff !\-2:1\-2
|
||
|
or simply
|
||
|
.Sq diff !\-2:*
|
||
|
The
|
||
|
.Sq cp
|
||
|
command might have been written
|
||
|
.Sq cp wumpus.man !#:1.old
|
||
|
, using
|
||
|
.Sq #
|
||
|
to refer to the current event.
|
||
|
`!n:\- hurkle.man' would reuse the first two words from the
|
||
|
.Sq nroff
|
||
|
command
|
||
|
to say
|
||
|
.Sq nroff \-man hurkle.man
|
||
|
.Pp
|
||
|
The
|
||
|
.Sq \&:
|
||
|
separating the event specification from the word designator can be
|
||
|
omitted if the argument selector begins with a
|
||
|
.Sq ^ ,
|
||
|
.Sq $ ,
|
||
|
.Sq * ,
|
||
|
.Sq %
|
||
|
or
|
||
|
.Sq \&-
|
||
|
For example, our
|
||
|
.Sq diff
|
||
|
command might have been
|
||
|
.Sq diff !!^.old !!^
|
||
|
or,
|
||
|
equivalently,
|
||
|
.Sq diff !!$.old !!$
|
||
|
However, if
|
||
|
.Sq \&!!
|
||
|
is abbreviated
|
||
|
.Sq \&!
|
||
|
,
|
||
|
an argument selector beginning with
|
||
|
.Sq \-
|
||
|
will be interpreted as an event
|
||
|
specification.
|
||
|
.Pp
|
||
|
A history reference may have a word designator but no event specification.
|
||
|
It then references the previous command.
|
||
|
Continuing our
|
||
|
.Sq diff
|
||
|
example, we could have said simply `diff
|
||
|
!^.old !^' or, to get the arguments in the opposite order, just
|
||
|
.Sq diff !*
|
||
|
.Pp
|
||
|
The word or words in a history reference can be edited, or
|
||
|
.Sq `modified
|
||
|
',
|
||
|
by following it with one or more modifiers, each preceded by a
|
||
|
.Sq \&: :
|
||
|
.Pp
|
||
|
.Bl -tag -width XXXXXX -offset indent -compact
|
||
|
.It Ar h
|
||
|
Remove a trailing pathname component, leaving the head.
|
||
|
.It Ar t
|
||
|
Remove all leading pathname components, leaving the tail.
|
||
|
.It Ar r
|
||
|
Remove a filename extension
|
||
|
.Sq .xxx ,
|
||
|
leaving the root name.
|
||
|
.It Ar e
|
||
|
Remove all but the extension.
|
||
|
.It Ar u
|
||
|
Uppercase the first lowercase letter.
|
||
|
.It Ar l
|
||
|
Lowercase the first uppercase letter.
|
||
|
.It Ar s/l/r/
|
||
|
Substitute
|
||
|
.Ar l
|
||
|
for
|
||
|
.Ar r
|
||
|
.Ar l
|
||
|
is simply a string like
|
||
|
.Ar r
|
||
|
, not a regular expression as in
|
||
|
the eponymous
|
||
|
.Xr ed 1
|
||
|
command.
|
||
|
Any character may be used as the delimiter in place of
|
||
|
.Sq / ;
|
||
|
a
|
||
|
.Sq \e
|
||
|
can be used to quote the delimiter inside
|
||
|
.Va l
|
||
|
and
|
||
|
.Va r
|
||
|
The character
|
||
|
.Sq &
|
||
|
in the
|
||
|
.Va r
|
||
|
is replaced by
|
||
|
.Va l ;
|
||
|
.Sq \e
|
||
|
also quotes
|
||
|
.Sq &
|
||
|
If
|
||
|
.Va l
|
||
|
is empty (
|
||
|
.Dq \& ) ,
|
||
|
the
|
||
|
.Va l
|
||
|
from a previous substitution or the
|
||
|
.Va s
|
||
|
from a previous search or event number in event specification is used.
|
||
|
The trailing delimiter may be omitted if it is immediately followed by a
|
||
|
newline.
|
||
|
.It Ar \&&
|
||
|
Repeat the previous substitution.
|
||
|
.It Ar g
|
||
|
Apply the following modifier once to each word.
|
||
|
.It Ar a (+)
|
||
|
Apply the following modifier as many times as possible to a single word.
|
||
|
.Sq a
|
||
|
and
|
||
|
.Sq g
|
||
|
can be used together to apply a modifier globally.
|
||
|
With the
|
||
|
.Sq s
|
||
|
modifier, only the patterns contained in the original word are
|
||
|
substituted, not patterns that contain any substitution result.
|
||
|
.It Ar p
|
||
|
Print the new command line but do not execute it.
|
||
|
.It Ar q
|
||
|
Quote the substituted words, preventing further substitutions.
|
||
|
.It Ar x
|
||
|
Like
|
||
|
.Ar q ,
|
||
|
but break into words at blanks, tabs and newlines.
|
||
|
.El
|
||
|
.Pp
|
||
|
Modifiers are applied to only the first modifiable word (unless
|
||
|
.Sq g
|
||
|
is used).
|
||
|
It is an error for no word to be modifiable.
|
||
|
.Pp
|
||
|
For example, the
|
||
|
.Sq diff
|
||
|
command might have been written as `diff wumpus.man.old
|
||
|
!#^:r', using
|
||
|
.Sq \&:r
|
||
|
to remove
|
||
|
.Sq .old
|
||
|
from the first argument on the same line
|
||
|
(`!#^').
|
||
|
We could say
|
||
|
.Sq echo hello out there
|
||
|
, then
|
||
|
.Sq echo !*:u
|
||
|
to capitalize
|
||
|
`hello',
|
||
|
.Sq echo !*:au
|
||
|
to say it out loud, or
|
||
|
.Sq echo !*:agu
|
||
|
to really shout.
|
||
|
We might follow
|
||
|
.Sq mail \-s "I forgot my password" rot
|
||
|
with
|
||
|
.Sq !:s/rot/root
|
||
|
to
|
||
|
correct the spelling of
|
||
|
.Sq root
|
||
|
(but see
|
||
|
.Sx Spelling correction
|
||
|
for a
|
||
|
different approach).
|
||
|
.Pp
|
||
|
There is a special abbreviation for substitutions.
|
||
|
.Sq ^ ,
|
||
|
when it is the first character on an input line, is equivalent to
|
||
|
.Sq !:s^
|
||
|
Thus we might have said
|
||
|
.Sq ^rot^root
|
||
|
to make the spelling correction in the
|
||
|
previous example.
|
||
|
This is the only history substitution which does not explicitly begin with
|
||
|
.Sq \&!
|
||
|
.Pp
|
||
|
(+) In
|
||
|
.Xr csh 1
|
||
|
as such, only one modifier may be applied to each history
|
||
|
or variable expansion.
|
||
|
In
|
||
|
.Nm ,
|
||
|
more than one may be used, for example
|
||
|
.Bd -literal -offset indent
|
||
|
% mv wumpus.man /usr/man/man1/wumpus.1
|
||
|
% man !$:t:r
|
||
|
man wumpus
|
||
|
.Ed
|
||
|
.Pp
|
||
|
In
|
||
|
.Xr csh 1 ,
|
||
|
the result would be
|
||
|
.Sq wumpus.1:r
|
||
|
A substitution followed by a
|
||
|
colon may need to be insulated from it with braces:
|
||
|
.Bd -literal -offset indent
|
||
|
> mv a.out /usr/games/wumpus
|
||
|
> setenv PATH !$:h:$PATH
|
||
|
Bad ! modifier: $.
|
||
|
> setenv PATH !{\-2$:h}:$PATH
|
||
|
setenv PATH /usr/games:/bin:/usr/bin:.
|
||
|
.Ed
|
||
|
.Pp
|
||
|
The first attempt would succeed in
|
||
|
.Xr csh 1
|
||
|
but fails in
|
||
|
.Nm ,
|
||
|
because
|
||
|
.Nm
|
||
|
expects another modifier after the second colon
|
||
|
rather than
|
||
|
.Sq $
|
||
|
.Pp
|
||
|
Finally, history can be accessed through the editor as well as through
|
||
|
the substitutions just described.
|
||
|
The
|
||
|
.Ic up-
|
||
|
and
|
||
|
.Ic down-history ,
|
||
|
.Ic history-search-backward
|
||
|
and
|
||
|
.Va -forward ,
|
||
|
.Ic i-search-back
|
||
|
and
|
||
|
.Ic -fwd ,
|
||
|
.Ic vi-search-back
|
||
|
and
|
||
|
.Ic -fwd ,
|
||
|
.Ic copy-prev-word
|
||
|
and
|
||
|
.Ic insert-last-word
|
||
|
editor commands search for
|
||
|
events in the history list and copy them into the input buffer.
|
||
|
The
|
||
|
.Ic toggle-literal-history
|
||
|
editor command switches between the
|
||
|
expanded and literal forms of history lines in the input buffer.
|
||
|
.Ic expand-history
|
||
|
and
|
||
|
.Ic expand-line
|
||
|
expand history substitutions
|
||
|
in the current word and in the entire input buffer respectively.
|
||
|
.Ss Alias substitution
|
||
|
The shell maintains a list of aliases which can be set, unset and printed by
|
||
|
the
|
||
|
.Ic alias
|
||
|
and
|
||
|
.Ic unalias
|
||
|
commands.
|
||
|
After a command line is parsed
|
||
|
into simple commands (see
|
||
|
.Sx Commands )
|
||
|
the first word of each command,
|
||
|
left-to-right, is checked to see if it has an alias.
|
||
|
If so, the first word is
|
||
|
replaced by the alias.
|
||
|
If the alias contains a history reference, it undergoes
|
||
|
.Va History substitution
|
||
|
(q.v.) as though the original command were the
|
||
|
previous input line.
|
||
|
If the alias does not contain a history reference, the
|
||
|
argument list is left untouched.
|
||
|
.Pp
|
||
|
Thus if the alias for
|
||
|
.Sq ls
|
||
|
were
|
||
|
.Sq ls \-l
|
||
|
the command
|
||
|
.Sq ls /usr
|
||
|
would become `ls
|
||
|
\-l /usr', the argument list here being undisturbed.
|
||
|
If the alias for
|
||
|
.Sq lookup
|
||
|
were
|
||
|
.Sq grep !/etc/passwd
|
||
|
then
|
||
|
.Sq lookup bill
|
||
|
would become `grep bill
|
||
|
/etc/passwd'.
|
||
|
Aliases can be used to introduce parser metasyntax.
|
||
|
For
|
||
|
example,
|
||
|
.Sq alias print
|
||
|
pr \e!* | lpr'' defines a
|
||
|
.Sq `command
|
||
|
' (`print') which
|
||
|
.Va pr
|
||
|
(1)s its arguments to the line printer.
|
||
|
.Pp
|
||
|
Alias substitution is repeated until the first word of the command has no
|
||
|
alias.
|
||
|
If an alias substitution does not change the first word (as in the
|
||
|
previous example) it is flagged to prevent a loop.
|
||
|
Other loops are detected and
|
||
|
cause an error.
|
||
|
.Pp
|
||
|
Some aliases are referred to by the shell; see
|
||
|
.Va Special aliases
|
||
|
.Sx Variable substitution
|
||
|
The shell maintains a list of variables, each of which has as value a list of
|
||
|
zero or more words.
|
||
|
The values of shell variables can be displayed and changed with the
|
||
|
.Va set
|
||
|
and
|
||
|
.Va unset
|
||
|
commands.
|
||
|
The system maintains its own list of
|
||
|
.Sq `environment
|
||
|
' variables.
|
||
|
These can be displayed and changed with
|
||
|
.Va printenv
|
||
|
,
|
||
|
.Va setenv
|
||
|
and
|
||
|
.Va unsetenv
|
||
|
.Pp
|
||
|
(+) Variables may be made read-only with
|
||
|
.Sq set \-r
|
||
|
(q.v.).
|
||
|
Read-only variables may not be modified or unset;
|
||
|
attempting to do so will cause an error.
|
||
|
Once made read-only, a variable cannot be made writable,
|
||
|
so
|
||
|
.Sq set \-r
|
||
|
should be used with caution.
|
||
|
Environment variables cannot be made read-only.
|
||
|
.Pp
|
||
|
Some variables are set by the shell or referred to by it.
|
||
|
For instance, the
|
||
|
.Va argv
|
||
|
variable is an image of the shell's argument
|
||
|
list, and words of this variable's value are referred to in special ways.
|
||
|
Some of the variables referred to by the shell are toggles;
|
||
|
the shell does not care what their value is, only whether they are set or not.
|
||
|
For instance, the
|
||
|
.Va verbose
|
||
|
variable is a toggle which causes command
|
||
|
input to be echoed.
|
||
|
The
|
||
|
.Fl v\fR command line option sets this variable.
|
||
|
.Va Special shell variables
|
||
|
lists all variables which are referred to by the shell.
|
||
|
.Pp
|
||
|
Other operations treat variables numerically.
|
||
|
The
|
||
|
.Sq @
|
||
|
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 multi-word values are ignored.
|
||
|
.Pp
|
||
|
After the input line is aliased and parsed, and before each command is
|
||
|
executed, variable substitution is performed keyed by
|
||
|
.Sq $
|
||
|
characters.
|
||
|
This
|
||
|
expansion can be prevented by preceding the
|
||
|
.Sq $
|
||
|
with a
|
||
|
.Sq \e
|
||
|
except within
|
||
|
.Sq "
|
||
|
s
|
||
|
where it
|
||
|
.Va always
|
||
|
occurs, and within
|
||
|
.Sq
|
||
|
's where it
|
||
|
.Va never
|
||
|
occurs.
|
||
|
Strings quoted by
|
||
|
.Sq \`
|
||
|
are interpreted later (see
|
||
|
.Sx Command substitution
|
||
|
below) so
|
||
|
.Sq $
|
||
|
substitution does not occur there until later,
|
||
|
if at all.
|
||
|
A
|
||
|
.Sq $
|
||
|
is passed unchanged if followed by a blank, tab, or
|
||
|
end-of-line.
|
||
|
.Pp
|
||
|
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.
|
||
|
.Pp
|
||
|
Unless enclosed in
|
||
|
.Sq "
|
||
|
or given the
|
||
|
.Sq \&:q
|
||
|
modifier the results of variable
|
||
|
substitution may eventually be command and filename substituted.
|
||
|
Within
|
||
|
.Sq "
|
||
|
, a
|
||
|
variable whose value consists of multiple words expands to a (portion of a)
|
||
|
single word, with the words of the variable's value separated by blanks.
|
||
|
When
|
||
|
the
|
||
|
.Sq \&: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.
|
||
|
.Pp
|
||
|
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.
|
||
|
.Pp
|
||
|
.Bl -tag -width XXXXXXXXXX -offset indent -compact
|
||
|
.PD 0
|
||
|
.It Ar $name
|
||
|
.It Ar ${name}
|
||
|
Substitutes the words of the value of variable
|
||
|
.Va name ,
|
||
|
each separated
|
||
|
by a blank.
|
||
|
Braces insulate
|
||
|
.Va name
|
||
|
from following characters which would
|
||
|
otherwise be part of it.
|
||
|
Shell variables have names consisting of
|
||
|
letters and digits starting with a letter.
|
||
|
The underscore character is
|
||
|
considered a letter.
|
||
|
If
|
||
|
.Va name
|
||
|
is not a shell variable, but is set in the
|
||
|
environment, then that value is returned (but some of the other forms
|
||
|
given below are not available in this case).
|
||
|
.It Ar $name[selector]
|
||
|
.It Ar ${name[selector]}
|
||
|
Substitutes only the selected words from the value of
|
||
|
.Va name
|
||
|
The
|
||
|
.Va selector
|
||
|
is subjected to
|
||
|
.Sq $
|
||
|
substitution and may consist of
|
||
|
a single number or two numbers separated by a
|
||
|
.Sq \&-
|
||
|
The first word of a variable's value is numbered
|
||
|
.Sq 1
|
||
|
If the first number of a range is omitted it defaults to
|
||
|
.Sq 1
|
||
|
If the last member of a range is omitted it defaults to
|
||
|
.Sq $#
|
||
|
.Va name
|
||
|
The
|
||
|
.Va selector
|
||
|
.Sq *
|
||
|
selects all words.
|
||
|
It is not an error for a range to be empty if the
|
||
|
second argument is omitted or in range.
|
||
|
.It Ar $0
|
||
|
Substitutes the name of the file from which command input
|
||
|
is being read.
|
||
|
An error occurs if the name is not known.
|
||
|
.It Ar $number
|
||
|
.It Ar ${number}
|
||
|
Equivalent to
|
||
|
.Sq $argv[number]
|
||
|
.It Ar $*
|
||
|
Equivalent to
|
||
|
.Sq $argv ,
|
||
|
which is equivalent to
|
||
|
.Sq $argv[*]
|
||
|
.El
|
||
|
.Pp
|
||
|
The
|
||
|
.Sq \&:
|
||
|
modifiers described under
|
||
|
.Sx History substitution ,
|
||
|
except for
|
||
|
.Sq \&:p ,
|
||
|
can be applied to the substitutions above.
|
||
|
More than one may be used.
|
||
|
(+)
|
||
|
Braces may be needed to insulate a variable substitution from a literal colon
|
||
|
just as with
|
||
|
.Sx History substitution
|
||
|
(q.v.); any modifiers must appear
|
||
|
within the braces.
|
||
|
.Pp
|
||
|
The following substitutions can not be modified with
|
||
|
.Sq \&:
|
||
|
modifiers.
|
||
|
.Pp
|
||
|
.Bl -tag -width XXXXXXXX -offset indent -compact
|
||
|
.It Ar $?name
|
||
|
.It Ar ${?name}
|
||
|
Substitutes the string
|
||
|
.Sq 1
|
||
|
if
|
||
|
.Va name
|
||
|
is set,
|
||
|
.Sq 0
|
||
|
if it is not.
|
||
|
.It Ar $?0
|
||
|
Substitutes
|
||
|
.Sq 1
|
||
|
if the current input filename is known,
|
||
|
.Sq 0
|
||
|
if it is not.
|
||
|
Always
|
||
|
.Sq 0
|
||
|
in interactive shells.
|
||
|
.It Ar
|
||
|
$#name
|
||
|
${#name}
|
||
|
Substitutes the number of words in
|
||
|
.Va name
|
||
|
.It Ar
|
||
|
$#
|
||
|
Equivalent to
|
||
|
.Sq $#argv
|
||
|
(+)
|
||
|
.It Ar
|
||
|
$%
|
||
|
.Va name
|
||
|
.It Ar ${%name}
|
||
|
Substitutes the number of characters in
|
||
|
.Va name
|
||
|
(+)
|
||
|
.Pp
|
||
|
$%
|
||
|
.Va number
|
||
|
.TP 8
|
||
|
.It Ar ${%number}
|
||
|
Substitutes the number of characters in
|
||
|
.Va $argv[number] .
|
||
|
(+)
|
||
|
.It Ar $?
|
||
|
Equivalent to
|
||
|
.Sq $status
|
||
|
(+)
|
||
|
.It Ar $$
|
||
|
Substitutes the (decimal) process number of the (parent) shell.
|
||
|
.It Ar $!
|
||
|
Substitutes the (decimal) process number of the last
|
||
|
background process started by this shell.
|
||
|
(+)
|
||
|
.It Ar $_
|
||
|
Substitutes the command line of the last command executed.
|
||
|
(+)
|
||
|
.It Ar $<
|
||
|
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.
|
||
|
(+) While
|
||
|
.Xr csh 1
|
||
|
always quotes $<, as if it were equivalent to
|
||
|
.Sq $<:q ,
|
||
|
.Nm
|
||
|
does not.
|
||
|
Furthermore, when
|
||
|
.Nm
|
||
|
is waiting for a line to be
|
||
|
typed the user may type an interrupt to interrupt the sequence into
|
||
|
which the line is to be substituted, but
|
||
|
.Xr csh 1
|
||
|
does not allow this.
|
||
|
.El
|
||
|
.Pp
|
||
|
The editor command
|
||
|
.Va expand-variables
|
||
|
, normally bound to
|
||
|
.Sq ^X-$ ,
|
||
|
can be used to interactively expand individual variables.
|
||
|
.Ss "Command, filename and directory stack substitution"
|
||
|
The remaining substitutions are applied selectively to the arguments
|
||
|
of 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, andk
|
||
|
in a child of the main shell.
|
||
|
.Ss "Command substitution"
|
||
|
Command substitution is indicated by a command enclosed in
|
||
|
.Sq \&`
|
||
|
The output
|
||
|
from such a command is broken into separate words at blanks, tabs and newlines,
|
||
|
and null words are discarded.
|
||
|
The output is variable and command substituted
|
||
|
and put in place of the original string.
|
||
|
.Pp
|
||
|
Command substitutions inside double
|
||
|
quotes
|
||
|
.Sq ( \&" )
|
||
|
retain blanks and tabs; only newlines force new words.
|
||
|
The single
|
||
|
final newline does not force a new word in any case.
|
||
|
It is thus possible for a
|
||
|
command substitution to yield only part of a word, even if the command outputs
|
||
|
a complete line.
|
||
|
.Pp
|
||
|
By default, the shell since version 6.12 replaces all newline and carriage
|
||
|
return characters in the command by spaces.
|
||
|
If this is switched off by
|
||
|
unsetting
|
||
|
.Va csubstnonl ,
|
||
|
newlines separate commands as usual.
|
||
|
.Ss "Filename substitution"
|
||
|
If a word contains any of the characters
|
||
|
.Sq * ,
|
||
|
.Sq \&? ,
|
||
|
.Sq \&[
|
||
|
or
|
||
|
.Sq {
|
||
|
or begins with
|
||
|
the character
|
||
|
.Sq ~
|
||
|
it is a candidate for filename substitution, also known as
|
||
|
.Dq globbing .
|
||
|
This word is then regarded as a pattern
|
||
|
.Dq ( glob-pattern ) ,
|
||
|
and
|
||
|
replaced with an alphabetically sorted list of file names which match the
|
||
|
pattern.
|
||
|
.Pp
|
||
|
In matching filenames, the character
|
||
|
.Sq .
|
||
|
at the beginning of a filename or
|
||
|
immediately following a
|
||
|
.Sq / ,
|
||
|
as well as the character
|
||
|
.Sq /
|
||
|
must be matched
|
||
|
explicitly (unless either
|
||
|
.Va globdot
|
||
|
or
|
||
|
.Va globstar
|
||
|
or both are set(+)).
|
||
|
The character
|
||
|
.Sq *
|
||
|
matches any string of characters,
|
||
|
including the null string.
|
||
|
The character
|
||
|
.Sq \&?
|
||
|
matches any single character.
|
||
|
The sequence
|
||
|
.Sq [...]
|
||
|
matches any one of the characters enclosed.
|
||
|
Within
|
||
|
.Sq [...]
|
||
|
, a pair of
|
||
|
characters separated by
|
||
|
.Sq \&-
|
||
|
matches any character lexically between the two.
|
||
|
.Pp
|
||
|
(+) Some glob-patterns can be negated:
|
||
|
The sequence
|
||
|
.Sq [^...]
|
||
|
matches any single character
|
||
|
.Va not
|
||
|
specified by the
|
||
|
characters and/or ranges of characters in the braces.
|
||
|
.Pp
|
||
|
An entire glob-pattern can also be negated with
|
||
|
.Sq ^ :
|
||
|
.Bd -literal -offset indent
|
||
|
> echo *
|
||
|
bang crash crunch ouch
|
||
|
> echo ^cr*
|
||
|
bang ouch
|
||
|
.Ed
|
||
|
.Pp
|
||
|
Glob-patterns which do not use
|
||
|
.Sq \&? ,
|
||
|
.Sq * , or
|
||
|
.Sq []
|
||
|
or which use
|
||
|
.Sq {}
|
||
|
or
|
||
|
.Sq ~
|
||
|
(below) are not negated correctly.
|
||
|
.Pp
|
||
|
The metanotation
|
||
|
.Sq a{b,c,d}e
|
||
|
is a shorthand for
|
||
|
.Sq abe ace ade
|
||
|
Left-to-right order is preserved:
|
||
|
.Sq /usr/source/s1/{oldls,ls}.c
|
||
|
expands
|
||
|
to
|
||
|
.Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c
|
||
|
The results of matches are
|
||
|
sorted separately at a low level to preserve this order:
|
||
|
.Sq ../{memo,*box}
|
||
|
might expand to
|
||
|
.Sq ../memo ../box ../mbox
|
||
|
(Note that
|
||
|
.Sq memo
|
||
|
was not sorted with the results of matching
|
||
|
.Sq *box . )
|
||
|
It is not an error when this construct expands to files which do not exist,
|
||
|
but it is possible to get an error from a command to which the expanded list
|
||
|
is passed.
|
||
|
This construct may be nested.
|
||
|
As a special case the words
|
||
|
.Sq { ,
|
||
|
.Sq }
|
||
|
and
|
||
|
.Sq {}
|
||
|
are passed undisturbed.
|
||
|
.Pp
|
||
|
The character
|
||
|
.Sq ~
|
||
|
at the beginning of a filename refers to home directories.
|
||
|
Standing alone, i.e.,
|
||
|
.Sq ~ ,
|
||
|
it expands to the invoker's home directory as
|
||
|
reflected in the value of the
|
||
|
.Va home
|
||
|
shell variable.
|
||
|
When followed by a
|
||
|
name consisting of letters, digits and
|
||
|
.Sq \&-
|
||
|
characters the shell searches for a
|
||
|
user with that name and substitutes their home directory; thus
|
||
|
.Sq ~ken
|
||
|
might
|
||
|
expand to
|
||
|
.Sq /usr/ken
|
||
|
and
|
||
|
.Sq ~ken/chmach
|
||
|
to
|
||
|
.Sq /usr/ken/chmach
|
||
|
If the character
|
||
|
.Sq ~
|
||
|
is followed by a character other than a letter or
|
||
|
.Sq /
|
||
|
or appears elsewhere
|
||
|
than at the beginning of a word, it is left undisturbed.
|
||
|
A command like
|
||
|
.Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man
|
||
|
does not,
|
||
|
therefore, do home directory substitution as one might hope.
|
||
|
.Pp
|
||
|
It is an error for a glob-pattern containing
|
||
|
.Sq * ,
|
||
|
.Sq \&? ,
|
||
|
.Sq \&[
|
||
|
or
|
||
|
.Sq ~ ,
|
||
|
with or
|
||
|
without
|
||
|
.Sq ^ ,
|
||
|
not to match any files.
|
||
|
However, only one pattern in a list of
|
||
|
glob-patterns must match a file (so that, e.g.,
|
||
|
.Sq rm *.a *.c *.o
|
||
|
would fail
|
||
|
only if there were no files in the current directory ending in
|
||
|
.Sq .a ,
|
||
|
.Sq .c ,
|
||
|
or
|
||
|
.Sq .o ) ,
|
||
|
and if the
|
||
|
.Va nonomatch
|
||
|
shell variable is set a pattern (or list
|
||
|
of patterns) which matches nothing is left unchanged rather than causing
|
||
|
an error.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va globstar
|
||
|
shell variable can be set to allow
|
||
|
.Sq **
|
||
|
or
|
||
|
.Sq ***
|
||
|
as
|
||
|
a file glob pattern that matches any string of characters including
|
||
|
.Sq / ,
|
||
|
recursively traversing any existing sub-directories.
|
||
|
For example,
|
||
|
.Sq ls **.c
|
||
|
will list all the .c files in the current directory tree.
|
||
|
If used by itself, it will match zero or more sub-directories
|
||
|
(e.g.
|
||
|
.Sq ls /usr/include/**/time.h
|
||
|
will list any file named
|
||
|
.Sq time.h
|
||
|
in the /usr/include directory tree;
|
||
|
.Sq ls /usr/include/**time.h
|
||
|
will match
|
||
|
any file in the /usr/include directory tree ending in
|
||
|
.Sq time.h ;
|
||
|
and
|
||
|
.Sq ls /usr/include/**time**.h
|
||
|
will match any .h file with
|
||
|
.Sq time
|
||
|
either
|
||
|
in a subdirectory name or in the filename itself).
|
||
|
To prevent problems with recursion, the
|
||
|
.Sq **
|
||
|
glob-pattern will not
|
||
|
descend into a symbolic link containing a directory.
|
||
|
To override this,
|
||
|
use
|
||
|
.Sq ***
|
||
|
(+)
|
||
|
.Pp
|
||
|
The
|
||
|
.Va noglob
|
||
|
shell variable can be set to prevent filename substitution,
|
||
|
and the
|
||
|
.Va expand-glob
|
||
|
editor command, normally bound to
|
||
|
.Sq ^X-* ,
|
||
|
can be
|
||
|
used to interactively expand individual filename substitutions.
|
||
|
.Ss "Directory stack substitution (+)"
|
||
|
The directory stack is a list of directories, numbered from zero, used by the
|
||
|
.Va pushd ,
|
||
|
.Va popd
|
||
|
and
|
||
|
.Va dirs
|
||
|
builtin commands (q.v.).
|
||
|
.Va dirs
|
||
|
can print, store in a file, restore and clear the directory stack
|
||
|
at any time, and the
|
||
|
.Va savedirs
|
||
|
and
|
||
|
.Va dirsfile
|
||
|
shell variables can be set to
|
||
|
store the directory stack automatically on logout and restore it on login.
|
||
|
The
|
||
|
.Va dirstack
|
||
|
shell variable can be examined to see the directory stack and
|
||
|
set to put arbitrary directories into the directory stack.
|
||
|
.Pp
|
||
|
The character
|
||
|
.Sq =
|
||
|
followed by one or more digits expands to an entry in
|
||
|
the directory stack.
|
||
|
The special case
|
||
|
.Sq =-
|
||
|
expands to the last directory in
|
||
|
the stack.
|
||
|
For example,
|
||
|
.Bd -literal -offset indent
|
||
|
> dirs \&-v
|
||
|
0 /usr/bin
|
||
|
1 /usr/spool/uucp
|
||
|
2 /usr/accts/sys
|
||
|
> echo =1
|
||
|
/usr/spool/uucp
|
||
|
> echo =0/calendar
|
||
|
/usr/bin/calendar
|
||
|
> echo =\-
|
||
|
/usr/accts/sys
|
||
|
.Ed
|
||
|
.Pp
|
||
|
The
|
||
|
.Va noglob
|
||
|
and
|
||
|
.Va nonomatch
|
||
|
shell variables and the
|
||
|
.Va expand-glob
|
||
|
editor command apply to directory stack as well as filename substitutions.
|
||
|
.Ss "Other substitutions (+)"
|
||
|
There are several more transformations involving filenames, not strictly
|
||
|
related to the above but mentioned here for completeness.
|
||
|
.Va Any
|
||
|
filename may be expanded to a full path when the
|
||
|
.Va symlinks
|
||
|
variable (q.v.) is set to
|
||
|
.Sq expand
|
||
|
Quoting prevents this expansion, and
|
||
|
the
|
||
|
.Va normalize-path
|
||
|
editor command does it on demand.
|
||
|
The
|
||
|
.Va normalize-command
|
||
|
editor command expands commands in PATH into
|
||
|
full paths on demand.
|
||
|
Finally,
|
||
|
.Va cd
|
||
|
and
|
||
|
.Va pushd
|
||
|
interpret
|
||
|
.Sq \&-
|
||
|
as the old working directory
|
||
|
(equivalent to the shell variable
|
||
|
.Va owd ) .
|
||
|
This is not a substitution at all, but an abbreviation recognized by only
|
||
|
those commands.
|
||
|
Nonetheless, it too can be prevented by quoting.
|
||
|
.Ss "Commands"
|
||
|
The next three sections describe how the shell executes commands and
|
||
|
deals with their input and output.
|
||
|
.Ss "Simple commands, pipelines and sequences"
|
||
|
A simple command is a sequence of words, the first of which specifies the
|
||
|
command to be executed.
|
||
|
A series of simple commands joined by
|
||
|
.Sq |
|
||
|
characters
|
||
|
forms a pipeline.
|
||
|
The output of each command in a pipeline is connected to the
|
||
|
input of the next.
|
||
|
.Pp
|
||
|
Simple commands and pipelines may be joined into sequences with
|
||
|
.Sq ; ,
|
||
|
and will
|
||
|
be executed sequentially.
|
||
|
Commands and pipelines can also be joined into
|
||
|
sequences with
|
||
|
.Sq ||
|
||
|
or
|
||
|
.Sq && ,
|
||
|
indicating, as in the C language, that the second
|
||
|
is to be executed only if the first fails or succeeds respectively.
|
||
|
.Pp
|
||
|
A simple command, pipeline or sequence may be placed in parentheses,
|
||
|
.Sq () ,
|
||
|
to form a simple command, which may in turn be a component of a pipeline or
|
||
|
sequence.
|
||
|
A command, pipeline or sequence can be executed
|
||
|
without waiting for it to terminate by following it with an
|
||
|
.Sq \&& .
|
||
|
.Ss "Builtin and non-builtin command execution"
|
||
|
Builtin commands are executed within the shell.
|
||
|
If any component of a
|
||
|
pipeline except the last is a builtin command, the pipeline is executed
|
||
|
in a subshell.
|
||
|
.Pp
|
||
|
Parenthesized commands are always executed in a subshell.
|
||
|
.Bd -literal -offset indent
|
||
|
(cd; pwd); pwd
|
||
|
.Ed
|
||
|
.Pp
|
||
|
thus prints the
|
||
|
.Va home
|
||
|
directory, leaving you where you were
|
||
|
(printing this after the home directory), while
|
||
|
.Bd -literal -offset indent
|
||
|
cd; pwd
|
||
|
.Ed
|
||
|
.Pp
|
||
|
leaves you in the
|
||
|
.Va home
|
||
|
directory.
|
||
|
Parenthesized commands are most often
|
||
|
used to prevent
|
||
|
.Va cd
|
||
|
from affecting the current shell.
|
||
|
.Pp
|
||
|
When a command to be executed is found not to be a builtin command the shell
|
||
|
attempts to execute the command via
|
||
|
.Xr execve 2 .
|
||
|
Each word in the variable
|
||
|
.Va path
|
||
|
names a directory in which the shell will look for the
|
||
|
command.
|
||
|
If the shell is not given a
|
||
|
.Fl f
|
||
|
option, the shell
|
||
|
hashes the names in these directories into an internal table so that it will
|
||
|
try an
|
||
|
.Xr execve 2
|
||
|
in only a directory where 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. This hashing mechanism is
|
||
|
not used:
|
||
|
.TP 4
|
||
|
.Bl -enum -width indent
|
||
|
.It
|
||
|
If hashing is turned explicitly off via
|
||
|
.Va unhash
|
||
|
.It
|
||
|
If the shell was given a
|
||
|
.Fl f Ar argument
|
||
|
.It
|
||
|
For each directory component of
|
||
|
.Va path
|
||
|
which does not begin with a
|
||
|
.Sq /
|
||
|
.It
|
||
|
If the command contains a
|
||
|
.Sq /
|
||
|
.El
|
||
|
.Pp
|
||
|
In the above four cases the shell concatenates each component of the path
|
||
|
vector with the given command name to form a path name of a file which it
|
||
|
then attempts to execute it. If execution is successful, the search stops.
|
||
|
.Pp
|
||
|
If the file has execute permissions but is not an executable to the system
|
||
|
(i.e., it is neither an executable binary nor a script that specifies its
|
||
|
interpreter), then it is assumed to be a file containing shell commands and
|
||
|
a new shell is spawned to read it.
|
||
|
The
|
||
|
.Va shell
|
||
|
special alias may be set
|
||
|
to specify an interpreter other than the shell itself.
|
||
|
.Pp
|
||
|
On systems which do not understand the
|
||
|
.Sq #!
|
||
|
script interpreter convention
|
||
|
the shell may be compiled to emulate it; see the
|
||
|
.Va version
|
||
|
shell
|
||
|
variable.
|
||
|
If so, the shell checks the first line of the file to
|
||
|
see if it is of the form
|
||
|
.Sq #!interpreter arg ...
|
||
|
If it is,
|
||
|
the shell starts
|
||
|
.Va interpreter
|
||
|
with the given
|
||
|
.Va arg
|
||
|
s and feeds the
|
||
|
file to it on standard input.
|
||
|
.Ss "Input/output"
|
||
|
The standard input and standard output of a command may be redirected with the
|
||
|
following syntax:
|
||
|
.Pp
|
||
|
.Bl -tag -width XXXXXX -offset indent -compact
|
||
|
.It Ar < name
|
||
|
Open file
|
||
|
.Va name
|
||
|
(which is first variable, command and filename
|
||
|
expanded) as the standard input.
|
||
|
.It Ar << word
|
||
|
Read the shell input up to a line which is identical to
|
||
|
.Va word .
|
||
|
.Va word
|
||
|
is not subjected to variable, filename or command substitution, and each input
|
||
|
line is compared to
|
||
|
.Va word
|
||
|
before any substitutions are done on this input
|
||
|
line.
|
||
|
Unless a quoting
|
||
|
.Sq \e ,
|
||
|
.Sq \&"
|
||
|
,
|
||
|
.Sq \&'
|
||
|
or
|
||
|
.Sq \&`
|
||
|
appears in
|
||
|
.Va word
|
||
|
variable and
|
||
|
command substitution is performed on the intervening lines, allowing
|
||
|
.Sq \e
|
||
|
to
|
||
|
quote
|
||
|
.Sq $ ,
|
||
|
.Sq \e
|
||
|
and
|
||
|
.Sq \&` .
|
||
|
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.
|
||
|
.Pp
|
||
|
.It Ar > name
|
||
|
.It Ar >! name
|
||
|
.It Ar >& name
|
||
|
.It Ar >&! name
|
||
|
The file
|
||
|
.Va name
|
||
|
is used as standard output.
|
||
|
If the file does not exist
|
||
|
then it is created; if the file exists, it is truncated, its previous contents
|
||
|
being lost.
|
||
|
.Pp
|
||
|
If the shell variable
|
||
|
.Va noclobber
|
||
|
is set, then the file must not exist or be a
|
||
|
character special file (e.g., a terminal or
|
||
|
.Sq /dev/null )
|
||
|
or an error results.
|
||
|
This helps prevent accidental destruction of files.
|
||
|
In this case the
|
||
|
.Sq \&!
|
||
|
forms
|
||
|
can be used to suppress this check.
|
||
|
If
|
||
|
.Va notempty
|
||
|
is given in
|
||
|
.Va noclobber ,
|
||
|
.Sq >
|
||
|
is allowed on empty files;
|
||
|
if
|
||
|
.Va ask
|
||
|
is set, an interacive confirmation is presented, rather than an
|
||
|
error.
|
||
|
.Pp
|
||
|
The forms involving
|
||
|
.Sq \&&
|
||
|
route the diagnostic output into the specified file as
|
||
|
well as the standard output.
|
||
|
.Va name
|
||
|
is expanded in the same way as
|
||
|
.Sq <
|
||
|
input filenames are.
|
||
|
.Pp
|
||
|
.It Ar >> name
|
||
|
.It Ar >>& name
|
||
|
.It Ar >>! name
|
||
|
.It Ar >>&! name
|
||
|
Like
|
||
|
.Sq >
|
||
|
, but appends output to the end of
|
||
|
.Va name
|
||
|
If the shell variable
|
||
|
.Va noclobber
|
||
|
is set, then it is an error for
|
||
|
the file
|
||
|
.Va not
|
||
|
to exist, unless one of the
|
||
|
.Sq \&!
|
||
|
forms is given.
|
||
|
.El
|
||
|
.Pp
|
||
|
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
|
||
|
.Sq <<
|
||
|
mechanism should be used to
|
||
|
present inline 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
|
||
|
.Va not
|
||
|
the empty file
|
||
|
.Va /dev/null ,
|
||
|
but 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
|
||
|
.Sx Jobs ) .
|
||
|
.Pp
|
||
|
Diagnostic output may be directed through a pipe with the standard output.
|
||
|
Simply use the form
|
||
|
.Sq |&
|
||
|
rather than just
|
||
|
.Sq | .
|
||
|
.Pp
|
||
|
The shell cannot presently redirect diagnostic output without also redirecting
|
||
|
standard output, but
|
||
|
.Sq \&( command > output-file ) >& error-file
|
||
|
is often an acceptable workaround.
|
||
|
Either
|
||
|
.Va output-file
|
||
|
or
|
||
|
.Va error-file
|
||
|
may be
|
||
|
.Sq /dev/tty
|
||
|
to send output to the terminal.
|
||
|
.Ss "Features"
|
||
|
Having described how the shell accepts, parses and executes
|
||
|
command lines, we now turn to a variety of its useful features.
|
||
|
.Ss "Control flow"
|
||
|
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.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va foreach ,
|
||
|
.Va switch ,
|
||
|
and
|
||
|
.Va while
|
||
|
statements, as well as the
|
||
|
.Va if-then-else
|
||
|
form of the
|
||
|
.Va if
|
||
|
statement, require that the major
|
||
|
keywords appear in a single simple command on an input line as shown below.
|
||
|
.Pp
|
||
|
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
|
||
|
.Va goto
|
||
|
s will succeed on non-seekable inputs.)
|
||
|
.Ss "Expressions"
|
||
|
The
|
||
|
.Va if ,
|
||
|
.Va while
|
||
|
and
|
||
|
.Va exit
|
||
|
builtin commands
|
||
|
use expressions with a common syntax.
|
||
|
The expressions can include any
|
||
|
of the operators described in the next three sections.
|
||
|
Note that the
|
||
|
.Va @
|
||
|
builtin command (q.v.) has its own separate syntax.
|
||
|
.Ss "Logical, arithmetical and comparison operators"
|
||
|
These operators are similar to those of C and have the same precedence.
|
||
|
They include
|
||
|
.IP "" 4
|
||
|
.Bl -tag -width XXXXXX -offset indent -compact
|
||
|
.It || && | & == != =~ !~ <= >=
|
||
|
.It < > << >> + \- * / % ! ~ ( )
|
||
|
.El
|
||
|
.Pp
|
||
|
Here the precedence increases to the right,
|
||
|
.Sq ==
|
||
|
.Sq \&!=
|
||
|
.Sq =~
|
||
|
and
|
||
|
.Sq \&!~ ,
|
||
|
.Sq <=
|
||
|
.Sq >=
|
||
|
.Sq <
|
||
|
and
|
||
|
.Sq > ,
|
||
|
.Sq <<
|
||
|
.Sq >> ,
|
||
|
.Sq +
|
||
|
and
|
||
|
.Sq \&- ,
|
||
|
.Sq *
|
||
|
.Sq /
|
||
|
and
|
||
|
.Sq %
|
||
|
being, in
|
||
|
groups, at the same level.
|
||
|
The
|
||
|
.Sq ==
|
||
|
.Sq \&!=
|
||
|
.Sq =~
|
||
|
and
|
||
|
.Sq \&!~
|
||
|
operators compare
|
||
|
their arguments as strings; all others operate on numbers.
|
||
|
The operators
|
||
|
.Sq =~
|
||
|
and
|
||
|
.Sq \&!~
|
||
|
are like
|
||
|
.Sq \&!=
|
||
|
and
|
||
|
.Sq ==
|
||
|
except that the right hand side is a
|
||
|
glob-pattern (see
|
||
|
.Sx Filename substitution )
|
||
|
against which the left hand operand is matched.
|
||
|
This reduces the need for use of the
|
||
|
.Va switch
|
||
|
builtin command in shell scripts when all that is really needed is
|
||
|
pattern matching.
|
||
|
.Pp
|
||
|
Null or
|
||
|
missing arguments are considered
|
||
|
.Sq 0
|
||
|
The results 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
|
||
|
.Sq ( \&&
|
||
|
.Sq |
|
||
|
.Sq <
|
||
|
.Sq >
|
||
|
.Sq \&(
|
||
|
.Sq \&) )
|
||
|
they should be
|
||
|
surrounded by spaces.
|
||
|
.Ss "Command exit status"
|
||
|
Commands can be executed in expressions and their exit status
|
||
|
returned by enclosing them in braces
|
||
|
.Sq ( {} ) .
|
||
|
Remember that the braces should
|
||
|
be separated from the words of the command by spaces.
|
||
|
Command executions
|
||
|
succeed, returning true, i.e.,
|
||
|
.Sq 1 ,
|
||
|
if the command exits with status 0,
|
||
|
otherwise they fail, returning false, i.e.,
|
||
|
.Sq 0 .
|
||
|
If more detailed status
|
||
|
information is required then the command should be executed outside of an
|
||
|
expression and the
|
||
|
.Va status
|
||
|
shell variable examined.
|
||
|
.Ss "File inquiry operators"
|
||
|
Some of these operators perform true/false tests on files and related
|
||
|
objects.
|
||
|
They are of the form
|
||
|
.Fl
|
||
|
.Va op file
|
||
|
, where
|
||
|
.Va op
|
||
|
is one of
|
||
|
.Bl -tag -width XXX -offset indent -compact
|
||
|
.It Ar r
|
||
|
Read access
|
||
|
.It Ar w
|
||
|
Write access
|
||
|
.It Ar x
|
||
|
Execute access
|
||
|
.It Ar X
|
||
|
Executable in the path or shell builtin, e.g.,
|
||
|
.Sq \&-X ls
|
||
|
and
|
||
|
.Sq \&-X ls\&-F
|
||
|
are
|
||
|
generally true, but
|
||
|
.Sq \&-X /bin/ls
|
||
|
is not (+)
|
||
|
.It Ar e
|
||
|
Existence
|
||
|
.It Ar o
|
||
|
Ownership
|
||
|
.It Ar z
|
||
|
Zero size
|
||
|
.It Ar s
|
||
|
Non-zero size (+)
|
||
|
.It Ar f
|
||
|
Plain file
|
||
|
.It Ar d
|
||
|
Directory
|
||
|
.It Ar l
|
||
|
Symbolic link (+) *
|
||
|
.It Ar b
|
||
|
Block special file (+)
|
||
|
.It Ar c
|
||
|
Character special file (+)
|
||
|
.It Ar p
|
||
|
Named pipe (fifo) (+) *
|
||
|
.It Ar S
|
||
|
Socket special file (+) *
|
||
|
.It Ar u
|
||
|
Set-user-ID bit is set (+)
|
||
|
.It Ar g
|
||
|
Set-group-ID bit is set (+)
|
||
|
.It Ar k
|
||
|
Sticky bit is set (+)
|
||
|
.It Ar t file
|
||
|
(which must be a digit) is an open file descriptor
|
||
|
for a terminal device (+)
|
||
|
.It Ar R
|
||
|
Has been migrated (Convex only) (+)
|
||
|
.It Ar L
|
||
|
Applies subsequent operators in a multiple-operator test to a symbolic link
|
||
|
rather than to the file to which the link points (+) *
|
||
|
.El
|
||
|
.Pp
|
||
|
.Va file
|
||
|
is command and filename expanded and then tested to
|
||
|
see if it has the specified relationship to the real user.
|
||
|
If
|
||
|
.Va file
|
||
|
does not exist or is inaccessible or, for the operators indicated by
|
||
|
.Sq * ,
|
||
|
if the specified file type does not exist on the current system,
|
||
|
then all inquiries return false, i.e.,
|
||
|
.Sq 0 .
|
||
|
.Pp
|
||
|
These operators may be combined for conciseness:
|
||
|
.Sq \&-
|
||
|
.Va xy file
|
||
|
is
|
||
|
equivalent to
|
||
|
.Sq \&-x file && \&-y file .
|
||
|
(+) For example,
|
||
|
.Sq \&-fx
|
||
|
is true
|
||
|
(returns
|
||
|
.Sq 1 )
|
||
|
for plain executable files, but not for directories.
|
||
|
.Pp
|
||
|
.Va L
|
||
|
may be used in a multiple-operator test to apply subsequent operators
|
||
|
to a symbolic link rather than to the file to which the link points.
|
||
|
For example,
|
||
|
.Sq \&-lLo
|
||
|
is true for links owned by the invoking user.
|
||
|
.Va Lr ,
|
||
|
.Va Lw
|
||
|
and
|
||
|
.Va Lx
|
||
|
are always true for links and false for
|
||
|
non-links.
|
||
|
.Va L
|
||
|
has a different meaning when it is the last operator
|
||
|
in a multiple-operator test; see below.
|
||
|
.Pp
|
||
|
It is possible but not useful, and sometimes misleading, to combine operators
|
||
|
which expect
|
||
|
.Va file
|
||
|
to be a file with operators which do not
|
||
|
(e.g.,
|
||
|
.Va X
|
||
|
and
|
||
|
.Va t ) .
|
||
|
Following
|
||
|
.Va L
|
||
|
with a non-file operator
|
||
|
can lead to particularly strange results.
|
||
|
.Pp
|
||
|
Other operators return other information, i.e., not just
|
||
|
.Sq 0
|
||
|
or
|
||
|
.Sq 1
|
||
|
(+)
|
||
|
They have the same format as before;
|
||
|
.Va op
|
||
|
may be one of
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.RS +4
|
||
|
.TP 8
|
||
|
.B A
|
||
|
Last file access time, as the number of seconds since the epoch
|
||
|
.TP 8
|
||
|
.B A:
|
||
|
Like
|
||
|
.Va A
|
||
|
, but in timestamp format, e.g.,
|
||
|
.Sq Fri May 14 16:36:10 1993
|
||
|
.TP 8
|
||
|
.B M
|
||
|
Last file modification time
|
||
|
.TP 8
|
||
|
.B M:
|
||
|
Like
|
||
|
.Va M
|
||
|
, but in timestamp format
|
||
|
.TP 8
|
||
|
.B C
|
||
|
Last inode modification time
|
||
|
.TP 8
|
||
|
.B C:
|
||
|
Like
|
||
|
.Va C
|
||
|
, but in timestamp format
|
||
|
.TP 8
|
||
|
.B D
|
||
|
Device number
|
||
|
.TP 8
|
||
|
.B I
|
||
|
Inode number
|
||
|
.TP 8
|
||
|
.B F
|
||
|
Composite
|
||
|
.Va f
|
||
|
ile identifier, in the form
|
||
|
.Va device
|
||
|
:
|
||
|
.Va inode
|
||
|
.TP 8
|
||
|
.B L
|
||
|
The name of the file pointed to by a symbolic link
|
||
|
.TP 8
|
||
|
.B N
|
||
|
Number of (hard) links
|
||
|
.TP 8
|
||
|
.B P
|
||
|
Permissions, in octal, without leading zero
|
||
|
.TP 8
|
||
|
.B P:
|
||
|
Like
|
||
|
.Va P
|
||
|
, with leading zero
|
||
|
.TP 8
|
||
|
.B P\fImode
|
||
|
Equivalent to
|
||
|
.Sq \-P
|
||
|
.Va file
|
||
|
&
|
||
|
.Va mode
|
||
|
, e.g.,
|
||
|
.Sq \-P22
|
||
|
.Va file
|
||
|
returns
|
||
|
`22' if
|
||
|
.Va file
|
||
|
is writable by group and other,
|
||
|
.Sq 20
|
||
|
if by group only,
|
||
|
and
|
||
|
.Sq 0
|
||
|
if by neither
|
||
|
.TP 8
|
||
|
.B P\fImode\fB:
|
||
|
Like \fBP
|
||
|
.Va mode
|
||
|
, with leading zero
|
||
|
.TP 8
|
||
|
.B U
|
||
|
Numeric userid
|
||
|
.TP 8
|
||
|
.B U:
|
||
|
Username, or the numeric userid if the username is unknown
|
||
|
.TP 8
|
||
|
.B G
|
||
|
Numeric groupid
|
||
|
.TP 8
|
||
|
.B G:
|
||
|
Groupname, or the numeric groupid if the groupname is unknown
|
||
|
.TP 8
|
||
|
.B Z
|
||
|
Size, in bytes
|
||
|
.RE
|
||
|
.PD
|
||
|
.Pp
|
||
|
Only one of these operators may appear in a multiple-operator test, and it
|
||
|
must be the last.
|
||
|
Note that
|
||
|
.Va L
|
||
|
has a different meaning at the end of and
|
||
|
elsewhere in a multiple-operator test.
|
||
|
Because
|
||
|
.Sq 0
|
||
|
is a valid return value
|
||
|
for many of these operators, they do not return
|
||
|
.Sq 0
|
||
|
when they fail: most
|
||
|
return
|
||
|
.Sq \&-1
|
||
|
, and
|
||
|
.Va F
|
||
|
returns
|
||
|
.Sq \&:
|
||
|
.Pp
|
||
|
If the shell is compiled with POSIX defined (see the
|
||
|
.Va version
|
||
|
shell
|
||
|
variable), the result of a file inquiry is based on the permission bits of
|
||
|
the file and not on the result of the
|
||
|
.Va access
|
||
|
(2) system call.
|
||
|
For example, if one tests a file with
|
||
|
.Fl w\fR whose permissions would
|
||
|
ordinarily allow writing but which is on a file system mounted read-only,
|
||
|
the test will succeed in a POSIX shell but fail in a non-POSIX shell.
|
||
|
.Pp
|
||
|
File inquiry operators can also be evaluated with the
|
||
|
.Va filetest
|
||
|
builtin
|
||
|
command (q.v.) (+).
|
||
|
.Ss Jobs
|
||
|
The shell associates a
|
||
|
.Va job
|
||
|
with each pipeline.
|
||
|
It keeps a table of
|
||
|
current jobs, printed by the
|
||
|
.Va jobs
|
||
|
command, and assigns them small integer
|
||
|
numbers.
|
||
|
When a job is started asynchronously with
|
||
|
.Sq &
|
||
|
, the shell prints a
|
||
|
line which looks like
|
||
|
.IP "" 4
|
||
|
[1] 1234
|
||
|
.Pp
|
||
|
indicating that the job which was started asynchronously was job number 1 and
|
||
|
had one (top-level) process, whose process id was 1234.
|
||
|
.Pp
|
||
|
If you are running a job and wish to do something else you may hit the suspend
|
||
|
key (usually
|
||
|
.Sq ^Z ) ,
|
||
|
which sends a STOP signal to the current job.
|
||
|
The shell will then normally
|
||
|
indicate that the job has been
|
||
|
.Sq Suspended
|
||
|
and print another prompt.
|
||
|
If the
|
||
|
.Va listjobs
|
||
|
shell variable is set, all jobs will be listed
|
||
|
like the
|
||
|
.Va jobs
|
||
|
builtin command; if it is set to
|
||
|
.Sq long
|
||
|
the listing will
|
||
|
be in long format, like
|
||
|
.Sq jobs \&-l
|
||
|
You can then manipulate the state of the suspended job.
|
||
|
You can put it in the
|
||
|
.Dq background
|
||
|
with the
|
||
|
.Va bg
|
||
|
command or run some other commands and
|
||
|
eventually bring the job back into the
|
||
|
.Sq foreground
|
||
|
' with
|
||
|
.Va fg
|
||
|
(See also the
|
||
|
.Va run-fg-editor
|
||
|
editor command.)
|
||
|
A
|
||
|
.Sq ^Z
|
||
|
takes effect immediately and is like an interrupt
|
||
|
in that pending output and unread input are discarded when it is typed.
|
||
|
The
|
||
|
.Va wait
|
||
|
builtin command causes the shell to wait for all background
|
||
|
jobs to complete.
|
||
|
.Pp
|
||
|
The
|
||
|
.Sq ^]
|
||
|
key sends a delayed suspend signal, which does not generate a STOP
|
||
|
signal until a program attempts to
|
||
|
.Va read
|
||
|
(2) it, to the current job.
|
||
|
This can usefully be typed ahead when you have prepared some commands for a
|
||
|
job which you wish to stop after it has read them.
|
||
|
The
|
||
|
.Sq ^Y
|
||
|
key performs this function in
|
||
|
.Xr csh 1
|
||
|
; in
|
||
|
.Nm
|
||
|
,
|
||
|
`^Y' is an editing command.
|
||
|
(+)
|
||
|
.Pp
|
||
|
A job being run in the background stops if it tries to read from the
|
||
|
terminal.
|
||
|
Background jobs are normally allowed to produce output, but this can
|
||
|
be disabled by giving the command
|
||
|
.Sq stty tostop
|
||
|
If you set this tty option,
|
||
|
then background jobs will stop when they try to produce output like they do
|
||
|
when they try to read input.
|
||
|
.Pp
|
||
|
There are several ways to refer to jobs in the shell.
|
||
|
The character
|
||
|
.Sq %
|
||
|
introduces a job name.
|
||
|
If you wish to refer to job number 1, you can name it
|
||
|
as
|
||
|
.Sq %1
|
||
|
Just naming a job brings it to the foreground; thus
|
||
|
.Sq %1
|
||
|
is a synonym
|
||
|
for
|
||
|
.Sq fg %1
|
||
|
, bringing job 1 back into the foreground.
|
||
|
Similarly, saying
|
||
|
.Sq %1 &
|
||
|
resumes job 1 in the background, just like
|
||
|
.Sq bg %1
|
||
|
A job can also be named
|
||
|
by an unambiguous prefix of the string typed in to start it:
|
||
|
.Sq %ex
|
||
|
would
|
||
|
normally restart a suspended
|
||
|
.Va ex
|
||
|
(1) job, if there were only one suspended
|
||
|
job whose name began with the string
|
||
|
.Sq ex
|
||
|
It is also possible to say
|
||
|
`%?
|
||
|
.Va string
|
||
|
' to specify a job whose text contains
|
||
|
.Va string
|
||
|
, if there
|
||
|
is only one such job.
|
||
|
.Pp
|
||
|
The shell maintains a notion of the current and previous jobs.
|
||
|
In output
|
||
|
pertaining to jobs, the current job is marked with a
|
||
|
.Sq +
|
||
|
and the previous job
|
||
|
with a
|
||
|
.Sq \-
|
||
|
The abbreviations
|
||
|
.Sq %+
|
||
|
,
|
||
|
.Sq %
|
||
|
, and (by analogy with the syntax of
|
||
|
the
|
||
|
.Va history
|
||
|
mechanism)
|
||
|
.Sq %%
|
||
|
all refer to the current job, and
|
||
|
.Sq %\-
|
||
|
refers
|
||
|
to the previous job.
|
||
|
.Pp
|
||
|
The job control mechanism requires that the
|
||
|
.Va stty
|
||
|
(1) option
|
||
|
.Sq new
|
||
|
be set
|
||
|
on some systems.
|
||
|
It is an artifact from a
|
||
|
.Sq new
|
||
|
implementation of the tty
|
||
|
driver which allows generation of interrupt characters from the keyboard to
|
||
|
tell jobs to stop.
|
||
|
See
|
||
|
.Va stty
|
||
|
(1) and the
|
||
|
.Va setty
|
||
|
builtin command for
|
||
|
details on setting options in the new tty driver.
|
||
|
.Ss "Status reporting"
|
||
|
The shell learns immediately whenever a process changes state.
|
||
|
It normally
|
||
|
informs you whenever a job becomes blocked so that no further progress is
|
||
|
possible, but only right before it prints a prompt.
|
||
|
This is done so that it
|
||
|
does not otherwise disturb your work.
|
||
|
If, however, you set the shell variable
|
||
|
.Va notify
|
||
|
, the shell will notify you immediately of changes of status in
|
||
|
background jobs.
|
||
|
There is also a shell command
|
||
|
.Va notify
|
||
|
which marks a
|
||
|
single process so that its status changes will be immediately reported.
|
||
|
By
|
||
|
default
|
||
|
.Va notify
|
||
|
marks the current process; simply say
|
||
|
.Sq notify
|
||
|
after
|
||
|
starting a background job to mark it.
|
||
|
.Pp
|
||
|
When you try to leave the shell while jobs are stopped, you will be
|
||
|
warned that
|
||
|
.Sq There are suspended jobs.
|
||
|
You may use the
|
||
|
.Va jobs
|
||
|
command to
|
||
|
see what they are.
|
||
|
If you do this or immediately try to exit again, the shell
|
||
|
will not warn you a second time, and the suspended jobs will be terminated.
|
||
|
.Ss "Automatic, periodic and timed events (+)"
|
||
|
There are various ways to run commands and take other actions automatically
|
||
|
at various times in the
|
||
|
.Sq `life cycle
|
||
|
' of the shell.
|
||
|
They are summarized here,
|
||
|
and described in detail under the appropriate
|
||
|
.Va Builtin commands
|
||
|
,
|
||
|
.Va Special shell variables
|
||
|
and
|
||
|
.Va Special aliases
|
||
|
.Pp
|
||
|
The
|
||
|
.Va sched
|
||
|
builtin command puts commands in a scheduled-event list,
|
||
|
to be executed by the shell at a given time.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va beepcmd
|
||
|
,
|
||
|
.Va cwdcmd
|
||
|
,
|
||
|
.Va periodic
|
||
|
,
|
||
|
.Va precmd
|
||
|
,
|
||
|
.Va postcmd
|
||
|
,
|
||
|
and
|
||
|
.Va jobcmd
|
||
|
.Va Special aliases
|
||
|
can be set, respectively, to execute commands when the shell wants
|
||
|
to ring the bell, when the working directory changes, every
|
||
|
.Va tperiod
|
||
|
minutes, before each prompt, before each command gets executed, after each
|
||
|
command gets executed, and when a job is started or is brought into the
|
||
|
foreground.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va autologout
|
||
|
shell variable can be set to log out or lock the shell
|
||
|
after a given number of minutes of inactivity.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va mail
|
||
|
shell variable can be set to check for new mail periodically.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va printexitvalue
|
||
|
shell variable can be set to print the exit status
|
||
|
of commands which exit with a status other than zero.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va rmstar
|
||
|
shell variable can be set to ask the user, when
|
||
|
.Sq rm *
|
||
|
is
|
||
|
typed, if that is really what was meant.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va time
|
||
|
shell variable can be set to execute the
|
||
|
.Va time
|
||
|
builtin
|
||
|
command after the completion of any process that takes more than a given
|
||
|
number of CPU seconds.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va watch
|
||
|
and
|
||
|
.Va who
|
||
|
shell variables can be set to report when
|
||
|
selected users log in or out, and the
|
||
|
.Va log
|
||
|
builtin command reports
|
||
|
on those users at any time.
|
||
|
.Ss "Native Language System support (+)"
|
||
|
The shell is eight bit clean
|
||
|
(if so compiled; see the
|
||
|
.Va version
|
||
|
shell variable)
|
||
|
and thus supports character sets needing this capability.
|
||
|
NLS support differs depending on whether or not
|
||
|
the shell was compiled to use the system's NLS (again, see
|
||
|
.Va version
|
||
|
).
|
||
|
In either case, 7-bit ASCII is the default character code
|
||
|
(e.g., the classification of which characters are printable) and sorting,
|
||
|
and changing the
|
||
|
.Va LANG
|
||
|
or
|
||
|
.Va LC_CTYPE
|
||
|
environment variables
|
||
|
causes a check for possible changes in these respects.
|
||
|
.Pp
|
||
|
When using the system's NLS, the
|
||
|
.Va setlocale
|
||
|
(3) function is called
|
||
|
to determine appropriate character code/classification and sorting
|
||
|
(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
|
||
|
This function typically examines the
|
||
|
.Va LANG
|
||
|
and
|
||
|
.Va LC_CTYPE
|
||
|
environment variables; refer to the system documentation for further details.
|
||
|
When not using the system's NLS, the shell simulates it by assuming that the
|
||
|
ISO 8859-1 character set is used
|
||
|
whenever either of the
|
||
|
.Va LANG
|
||
|
and
|
||
|
.Va LC_CTYPE
|
||
|
variables are set, regardless of
|
||
|
their values.
|
||
|
Sorting is not affected for the simulated NLS.
|
||
|
.Pp
|
||
|
In addition, with both real and simulated NLS, all printable
|
||
|
characters in the range \e200\-\e377, i.e., those that have
|
||
|
M-
|
||
|
.Va char
|
||
|
bindings, are automatically rebound to
|
||
|
.Va self-insert-command
|
||
|
The corresponding binding for the escape-
|
||
|
.Va char
|
||
|
sequence, if any, is
|
||
|
left alone.
|
||
|
These characters are not rebound if the
|
||
|
.Va NOREBIND
|
||
|
environment variable
|
||
|
is set.
|
||
|
This may be useful for the simulated NLS or a primitive real NLS
|
||
|
which assumes full ISO 8859-1.
|
||
|
Otherwise, all M-
|
||
|
.Va char
|
||
|
bindings in the
|
||
|
range \e240\-\e377 are effectively undone.
|
||
|
Explicitly rebinding the relevant keys with
|
||
|
.Va bindkey
|
||
|
is of course still possible.
|
||
|
.Pp
|
||
|
Unknown characters (i.e., those that are neither printable nor control
|
||
|
characters) are printed in the format \ennn.
|
||
|
If the tty is not in 8 bit mode, other 8 bit characters are printed by
|
||
|
converting them to ASCII and using standout mode.
|
||
|
The shell
|
||
|
never changes the 7/8 bit mode of the tty and tracks user-initiated
|
||
|
changes of 7/8 bit mode.
|
||
|
NLS users (or, for that matter, those who want to
|
||
|
use a meta key) may need to explicitly set
|
||
|
the tty in 8 bit mode through the appropriate
|
||
|
.Va stty
|
||
|
(1)
|
||
|
command in, e.g., the
|
||
|
.Va ~/.login
|
||
|
file.
|
||
|
.Ss "OS variant support (+)"
|
||
|
A number of new builtin commands are provided to support features in
|
||
|
particular operating systems.
|
||
|
All are described in detail in the
|
||
|
.Va Builtin commands
|
||
|
section.
|
||
|
.Pp
|
||
|
On systems that support TCF (aix-ibm370, aix-ps2),
|
||
|
.Va getspath
|
||
|
and
|
||
|
.Va setspath
|
||
|
get and set the system execution path,
|
||
|
.Va getxvers
|
||
|
and
|
||
|
.Va setxvers
|
||
|
get and set the experimental version prefix
|
||
|
and
|
||
|
.Va migrate
|
||
|
migrates processes between sites.
|
||
|
The
|
||
|
.Va jobs
|
||
|
builtin
|
||
|
prints the site on which each job is executing.
|
||
|
.Pp
|
||
|
Under BS2000,
|
||
|
.Va bs2cmd
|
||
|
executes commands of the underlying BS2000/OSD
|
||
|
operating system.
|
||
|
.Pp
|
||
|
Under Domain/OS,
|
||
|
.Va inlib
|
||
|
adds shared libraries to the current environment,
|
||
|
.Va rootnode
|
||
|
changes the rootnode and
|
||
|
.Va ver
|
||
|
changes the systype.
|
||
|
.Pp
|
||
|
Under Mach,
|
||
|
.Va setpath
|
||
|
is equivalent to Mach's
|
||
|
.Va setpath
|
||
|
(1).
|
||
|
.Pp
|
||
|
Under Masscomp/RTU and Harris CX/UX,
|
||
|
.Va universe
|
||
|
sets the universe.
|
||
|
.Pp
|
||
|
Under Harris CX/UX,
|
||
|
.Va ucb
|
||
|
or
|
||
|
.Va att
|
||
|
runs a command under the specified
|
||
|
universe.
|
||
|
.Pp
|
||
|
Under Convex/OS,
|
||
|
.Va warp
|
||
|
prints or sets the universe.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va VENDOR
|
||
|
,
|
||
|
.Va OSTYPE
|
||
|
and
|
||
|
.Va MACHTYPE
|
||
|
environment variables
|
||
|
indicate respectively the vendor, operating system and machine type
|
||
|
(microprocessor class or machine model) of the
|
||
|
system on which the shell thinks it is running.
|
||
|
These are particularly useful when sharing one's home directory between several
|
||
|
types of machines; one can, for example,
|
||
|
.IP "" 4
|
||
|
set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
|
||
|
.Pp
|
||
|
in one's
|
||
|
.Va ~/.login
|
||
|
and put executables compiled for each machine in the
|
||
|
appropriate directory.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va version
|
||
|
shell
|
||
|
variable indicates what options were chosen when the shell was compiled.
|
||
|
.Pp
|
||
|
Note also the
|
||
|
.Va newgrp
|
||
|
builtin, the
|
||
|
.Va afsuser
|
||
|
and
|
||
|
.Va echo_style
|
||
|
shell variables and the system-dependent locations of
|
||
|
the shell's input files (see
|
||
|
.Va FILES
|
||
|
).
|
||
|
.Ss "Signal handling"
|
||
|
Login shells ignore interrupts when reading the file
|
||
|
.Va ~/.logout
|
||
|
The shell ignores quit signals unless started with
|
||
|
.Fl q\fR.
|
||
|
Login shells catch the terminate signal, but non-login shells inherit the
|
||
|
terminate behavior from their parents.
|
||
|
Other signals have the values which the shell inherited from its parent.
|
||
|
.Pp
|
||
|
In shell scripts, the shell's handling of interrupt and terminate signals
|
||
|
can be controlled with
|
||
|
.Va onintr
|
||
|
, and its handling of hangups can be
|
||
|
controlled with
|
||
|
.Va hup
|
||
|
and
|
||
|
.Va nohup
|
||
|
.Pp
|
||
|
The shell exits on a hangup (see also the
|
||
|
.Va logout
|
||
|
shell variable).
|
||
|
By
|
||
|
default, the shell's children do too, but the shell does not send them a
|
||
|
hangup when it exits.
|
||
|
.Va hup
|
||
|
arranges for the shell to send a hangup to
|
||
|
a child when it exits, and
|
||
|
.Va nohup
|
||
|
sets a child to ignore hangups.
|
||
|
.Ss "Terminal management (+)"
|
||
|
The shell uses three different sets of terminal (
|
||
|
.Dq tty
|
||
|
) modes:
|
||
|
`edit', used when editing,
|
||
|
.Sq quote
|
||
|
, used when quoting literal characters,
|
||
|
and
|
||
|
.Sq execute
|
||
|
, used when executing commands.
|
||
|
The shell holds some settings in each mode constant, so commands which leave
|
||
|
the tty in a confused state do not interfere with the shell.
|
||
|
The shell also matches changes in the speed and padding of the tty.
|
||
|
The list of tty modes that are kept constant
|
||
|
can be examined and modified with the
|
||
|
.Va setty
|
||
|
builtin.
|
||
|
Note that although the editor uses CBREAK mode (or its equivalent),
|
||
|
it takes typed-ahead characters anyway.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va echotc
|
||
|
,
|
||
|
.Va settc
|
||
|
and
|
||
|
.Va telltc
|
||
|
commands can be used to
|
||
|
manipulate and debug terminal capabilities from the command line.
|
||
|
.Pp
|
||
|
On systems that support SIGWINCH or SIGWINDOW, the shell
|
||
|
adapts to window resizing automatically and adjusts the environment
|
||
|
variables
|
||
|
.Va LINES
|
||
|
and
|
||
|
.Va COLUMNS
|
||
|
if set.
|
||
|
If the environment
|
||
|
variable
|
||
|
.Va TERMCAP
|
||
|
contains li# and co# fields, the shell adjusts
|
||
|
them to reflect the new window size.
|
||
|
.Sh REFERENCE
|
||
|
The next sections of this manual describe all of the available
|
||
|
.Va Builtin commands
|
||
|
,
|
||
|
.Va Special aliases
|
||
|
and
|
||
|
.Va Special shell variables
|
||
|
.Ss "Builtin commands"
|
||
|
.TP 8
|
||
|
.B %\fIjob
|
||
|
A synonym for the
|
||
|
.Va fg
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B %\fIjob \fB&
|
||
|
A synonym for the
|
||
|
.Va bg
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B :
|
||
|
Does nothing, successfully.
|
||
|
.Pp
|
||
|
.B @
|
||
|
.br
|
||
|
.B @ \fIname\fB = \fIexpr
|
||
|
.br
|
||
|
.B @
|
||
|
.Va name
|
||
|
[
|
||
|
.Va index
|
||
|
]\fB = \fIexpr
|
||
|
.br
|
||
|
.B @ \fIname
|
||
|
.Va ++
|
||
|
|\fB--
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B @
|
||
|
.Va name
|
||
|
[
|
||
|
.Va index
|
||
|
]
|
||
|
.Va ++
|
||
|
|\fB--
|
||
|
The first form prints the values of all shell variables.
|
||
|
.PD
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
The second form assigns the value of
|
||
|
.Va expr
|
||
|
to
|
||
|
.Va name
|
||
|
The third form assigns the value of
|
||
|
.Va expr
|
||
|
to the
|
||
|
.Va index
|
||
|
'th
|
||
|
component of
|
||
|
.Va name
|
||
|
; both
|
||
|
.Va name
|
||
|
and its
|
||
|
.Va index
|
||
|
'th component
|
||
|
must already exist.
|
||
|
.Pp
|
||
|
.Va expr
|
||
|
may contain the operators
|
||
|
.Sq *
|
||
|
,
|
||
|
.Sq +
|
||
|
, etc., as in C.
|
||
|
If
|
||
|
.Va expr
|
||
|
contains
|
||
|
.Sq <
|
||
|
,
|
||
|
.Sq >
|
||
|
,
|
||
|
.Sq &
|
||
|
or
|
||
|
.Sq
|
||
|
then at least that part of
|
||
|
.Va expr
|
||
|
must be placed within
|
||
|
.Sq ()
|
||
|
Note that the syntax of
|
||
|
.Va expr
|
||
|
has nothing to do with that described
|
||
|
under
|
||
|
.Va Expressions
|
||
|
.Pp
|
||
|
The fourth and fifth forms increment (`++') or decrement (`\-\-')
|
||
|
.Va name
|
||
|
or its
|
||
|
.Va index
|
||
|
'th component.
|
||
|
.Pp
|
||
|
The space between
|
||
|
.Sq @
|
||
|
and
|
||
|
.Va name
|
||
|
is required.
|
||
|
The spaces between
|
||
|
.Va name
|
||
|
and
|
||
|
.Sq =
|
||
|
and between
|
||
|
.Sq =
|
||
|
and
|
||
|
.Va expr
|
||
|
are optional.
|
||
|
Components of
|
||
|
.Va expr
|
||
|
must be separated by spaces.
|
||
|
.RE
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B alias \fR[
|
||
|
.Va name
|
||
|
[
|
||
|
.Va wordlist
|
||
|
]]
|
||
|
Without arguments, prints all aliases.
|
||
|
With
|
||
|
.Va name
|
||
|
, prints the alias for name.
|
||
|
With
|
||
|
.Va name
|
||
|
and
|
||
|
.Va wordlist
|
||
|
, assigns
|
||
|
.Va wordlist
|
||
|
as the alias of
|
||
|
.Va name
|
||
|
.Va wordlist
|
||
|
is command and filename substituted.
|
||
|
.Va name
|
||
|
may not be
|
||
|
.Sq alias
|
||
|
or
|
||
|
.Sq unalias
|
||
|
See also the
|
||
|
.Va unalias
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B alloc
|
||
|
Shows the amount of dynamic memory acquired, broken down into used and free
|
||
|
memory.
|
||
|
With an argument shows the number of free and used blocks in each size
|
||
|
category.
|
||
|
The categories start at size 8 and double at each step.
|
||
|
This
|
||
|
command's output may vary across system types, because systems other than the VAX
|
||
|
may use a different memory allocator.
|
||
|
.TP 8
|
||
|
.B bg \fR[\fB%
|
||
|
.Va job
|
||
|
...]
|
||
|
Puts the specified jobs (or, without arguments, the current job)
|
||
|
into the background, continuing each if it is stopped.
|
||
|
.Va job
|
||
|
may be a number, a string,
|
||
|
.Sq
|
||
|
,
|
||
|
.Sq %
|
||
|
,
|
||
|
.Sq +
|
||
|
or
|
||
|
.Sq \-
|
||
|
as described
|
||
|
under
|
||
|
.Va Jobs
|
||
|
.Pp
|
||
|
.B bindkey \fR[
|
||
|
.Fl l\fR|
|
||
|
.Fl d\fR|
|
||
|
.Fl e\fR|
|
||
|
.Fl v\fR|
|
||
|
.Fl u\fR] (+)
|
||
|
.br
|
||
|
.Va bindkey
|
||
|
[
|
||
|
.Fl a\fR] [
|
||
|
.Fl b\fR] [
|
||
|
.Fl k\fR] [
|
||
|
.Fl r\fR] [
|
||
|
.Fl \-\fR]
|
||
|
.Va key
|
||
|
(+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.Va bindkey
|
||
|
[
|
||
|
.Fl a\fR] [
|
||
|
.Fl b\fR] [
|
||
|
.Fl k\fR] [
|
||
|
.Fl c\fR|
|
||
|
.Fl s\fR] [
|
||
|
.Fl \-\fR]
|
||
|
.Va key command
|
||
|
(+)
|
||
|
.\" .B macro can't take too many words, so I used \fB in the previous tags
|
||
|
Without options, the first form lists all bound keys and the editor command to which each is bound,
|
||
|
the second form lists the editor command to which
|
||
|
.Va key
|
||
|
is bound and
|
||
|
the third form binds the editor command
|
||
|
.Va command
|
||
|
to
|
||
|
.Va key
|
||
|
Options include:
|
||
|
.PD
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.RS +8
|
||
|
.TP 4
|
||
|
.Fl l
|
||
|
Lists all editor commands and a short description of each.
|
||
|
.TP 4
|
||
|
.Fl d
|
||
|
Binds all keys to the standard bindings for the default editor,
|
||
|
as per
|
||
|
.Va -e
|
||
|
and
|
||
|
.Va -v
|
||
|
below.
|
||
|
.TP 4
|
||
|
.Fl e
|
||
|
Binds all keys to
|
||
|
.Va emacs
|
||
|
(1)\-style bindings.
|
||
|
Unsets
|
||
|
.Va vimode
|
||
|
.TP 4
|
||
|
.Fl v
|
||
|
Binds all keys to
|
||
|
.Va vi
|
||
|
(1)\-style bindings.
|
||
|
Sets
|
||
|
.Va vimode
|
||
|
.TP 4
|
||
|
.Fl a
|
||
|
Lists or changes key-bindings in the alternative key map.
|
||
|
This is the key map used in
|
||
|
.Va vimode
|
||
|
command mode.
|
||
|
.TP 4
|
||
|
.Fl b
|
||
|
.Va key
|
||
|
is interpreted as
|
||
|
a control character written ^
|
||
|
.Va character
|
||
|
(e.g.,
|
||
|
.Sq ^A
|
||
|
) or
|
||
|
C-
|
||
|
.Va character
|
||
|
(e.g.,
|
||
|
.Sq C-A
|
||
|
),
|
||
|
a meta character written M-
|
||
|
.Va character
|
||
|
(e.g.,
|
||
|
.Sq M-A
|
||
|
),
|
||
|
a function key written F-
|
||
|
.Va string
|
||
|
(e.g.,
|
||
|
.Sq F-string
|
||
|
),
|
||
|
or an extended prefix key written X-
|
||
|
.Va character
|
||
|
(e.g.,
|
||
|
.Sq X-A
|
||
|
).
|
||
|
.TP 4
|
||
|
.Fl k
|
||
|
.Va key
|
||
|
is interpreted as a symbolic arrow key name, which may be one of
|
||
|
`down',
|
||
|
.Sq up
|
||
|
,
|
||
|
.Sq left
|
||
|
or
|
||
|
.Sq right
|
||
|
.TP 4
|
||
|
.Fl r
|
||
|
Removes
|
||
|
.Va key
|
||
|
's binding.
|
||
|
Be careful:
|
||
|
.Sq bindkey \-r
|
||
|
does
|
||
|
.Va not
|
||
|
bind
|
||
|
.Va key
|
||
|
to
|
||
|
.Va self-insert-command
|
||
|
(q.v.), it unbinds
|
||
|
.Va key
|
||
|
completely.
|
||
|
.TP 4
|
||
|
.Fl c
|
||
|
.Va command
|
||
|
is interpreted as a builtin or external command instead of an
|
||
|
editor command.
|
||
|
.TP 4
|
||
|
.Fl s
|
||
|
.Va command
|
||
|
is taken as a literal string and treated as terminal input
|
||
|
when
|
||
|
.Va key
|
||
|
is typed.
|
||
|
Bound keys in
|
||
|
.Va command
|
||
|
are themselves
|
||
|
reinterpreted, and this continues for ten levels of interpretation.
|
||
|
.TP 4
|
||
|
.Fl \-
|
||
|
Forces a break from option processing, so the next word is taken as
|
||
|
.Va key
|
||
|
even if it begins with '\-'.
|
||
|
.TP 4
|
||
|
.Fl u \fR(or any invalid option)
|
||
|
Prints a usage message.
|
||
|
.PD
|
||
|
.Pp
|
||
|
.Va key
|
||
|
may be a single character or a string.
|
||
|
If a command is bound to a string, the first character of the string is bound to
|
||
|
.Va sequence-lead-in
|
||
|
and the entire string is bound to the command.
|
||
|
.Pp
|
||
|
Control characters in
|
||
|
.Va key
|
||
|
can be literal (they can be typed by preceding
|
||
|
them with the editor command
|
||
|
.Va quoted-insert
|
||
|
, normally bound to
|
||
|
.Sq ^V
|
||
|
) or
|
||
|
written caret-character style, e.g.,
|
||
|
.Sq ^A
|
||
|
Delete is written
|
||
|
.Sq ^?
|
||
|
(caret-question mark).
|
||
|
.Va key
|
||
|
and
|
||
|
.Va command
|
||
|
can contain backslashed
|
||
|
escape sequences (in the style of System V
|
||
|
.Va echo
|
||
|
(1)) as follows:
|
||
|
.RS +4
|
||
|
.TP 8
|
||
|
.PD 0
|
||
|
.B \ea
|
||
|
Bell
|
||
|
.TP 8
|
||
|
.B \eb
|
||
|
Backspace
|
||
|
.TP 8
|
||
|
.B \ee
|
||
|
Escape
|
||
|
.TP 8
|
||
|
.B \ef
|
||
|
Form feed
|
||
|
.TP 8
|
||
|
.B \en
|
||
|
Newline
|
||
|
.TP 8
|
||
|
.B \er
|
||
|
Carriage return
|
||
|
.TP 8
|
||
|
.B \et
|
||
|
Horizontal tab
|
||
|
.TP 8
|
||
|
.B \ev
|
||
|
Vertical tab
|
||
|
.TP 8
|
||
|
.B \e\fInnn
|
||
|
The ASCII character corresponding to the octal number
|
||
|
.Va nnn
|
||
|
.PD
|
||
|
.RE
|
||
|
.Pp
|
||
|
`\e' nullifies the special meaning of the following character, if it has
|
||
|
any, notably
|
||
|
.Sq \e
|
||
|
and
|
||
|
.Sq ^
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B bs2cmd
|
||
|
.Va bs2000-command
|
||
|
(+)
|
||
|
Passes
|
||
|
.Va bs2000-command
|
||
|
to the BS2000 command interpreter for
|
||
|
execution. Only non-interactive commands can be executed, and it is
|
||
|
not possible to execute any command that would overlay the image
|
||
|
of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
|
||
|
.TP 8
|
||
|
.B break
|
||
|
Causes execution to resume after the
|
||
|
.Va end
|
||
|
of the nearest
|
||
|
enclosing
|
||
|
.Va foreach
|
||
|
or
|
||
|
.Va while
|
||
|
The remaining commands on the
|
||
|
current line are executed.
|
||
|
Multi-level breaks are thus
|
||
|
possible by writing them all on one line.
|
||
|
.TP 8
|
||
|
.B breaksw
|
||
|
Causes a break from a
|
||
|
.Va switch
|
||
|
, resuming after the
|
||
|
.Va endsw
|
||
|
.TP 8
|
||
|
.B builtins \fR(+)
|
||
|
Prints the names of all builtin commands.
|
||
|
.TP 8
|
||
|
.B bye \fR(+)
|
||
|
A synonym for the
|
||
|
.Va logout
|
||
|
builtin command.
|
||
|
Available only if the shell was so compiled;
|
||
|
see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B case \fIlabel\fB:
|
||
|
A label in a
|
||
|
.Va switch
|
||
|
statement as discussed below.
|
||
|
.TP 8
|
||
|
.B cd \fR[
|
||
|
.Fl p\fR] [
|
||
|
.Fl l\fR] [
|
||
|
.Fl n\fR|
|
||
|
.Fl v\fR] [\I--\fR] [
|
||
|
.Va name
|
||
|
]
|
||
|
If a directory
|
||
|
.Va name
|
||
|
is given, changes the shell's working directory
|
||
|
to
|
||
|
.Va name
|
||
|
If not, changes to
|
||
|
.Va home
|
||
|
, unless the
|
||
|
.Va cdtohome
|
||
|
variable is not set, in which case a
|
||
|
.Va name
|
||
|
is required.
|
||
|
If
|
||
|
.Va name
|
||
|
is
|
||
|
.Sq \-
|
||
|
it is interpreted as the previous working directory
|
||
|
(see
|
||
|
.Va Other substitutions
|
||
|
).
|
||
|
(+)
|
||
|
If
|
||
|
.Va name
|
||
|
is not a subdirectory of the current directory
|
||
|
(and does not begin with
|
||
|
.Sq /
|
||
|
,
|
||
|
.Sq ./
|
||
|
or
|
||
|
.Sq ../
|
||
|
), each component of the variable
|
||
|
.Va cdpath
|
||
|
is checked to see if it has a subdirectory
|
||
|
.Va name
|
||
|
Finally, if
|
||
|
all else fails but
|
||
|
.Va name
|
||
|
is a shell variable whose value
|
||
|
begins with
|
||
|
.Sq /
|
||
|
or '.', then this is tried to see if it is a directory, and
|
||
|
the
|
||
|
.Fl p\fR option is implied.
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
With
|
||
|
.Fl p\fR, prints the final directory stack, just like
|
||
|
.Va dirs
|
||
|
The
|
||
|
.Fl l\fR,
|
||
|
.Fl n\fR and
|
||
|
.Fl v\fR flags have the same effect on
|
||
|
.Va cd
|
||
|
as on
|
||
|
.Va dirs
|
||
|
, and they imply
|
||
|
.Fl p\fR.
|
||
|
(+)
|
||
|
Using
|
||
|
.Fl \-\fR forces a break from option processing so the next word
|
||
|
is taken as the directory
|
||
|
.Va name
|
||
|
even if it begins with '\-'. (+)
|
||
|
.Pp
|
||
|
See also the
|
||
|
.Va implicitcd
|
||
|
and
|
||
|
.Va cdtohome
|
||
|
shell variables.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B chdir
|
||
|
A synonym for the
|
||
|
.Va cd
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B complete \fR[
|
||
|
.Va command
|
||
|
[\fIword\fB/\fIpattern\fB/
|
||
|
.Va list
|
||
|
[\fB:
|
||
|
.Va select
|
||
|
]
|
||
|
.Va /
|
||
|
[[
|
||
|
.Va suffix
|
||
|
]
|
||
|
.Va /
|
||
|
] ...]] (+)
|
||
|
Without arguments, lists all completions.
|
||
|
With
|
||
|
.Va command
|
||
|
, lists completions for
|
||
|
.Va command
|
||
|
With
|
||
|
.Va command
|
||
|
and
|
||
|
.Va word
|
||
|
etc., defines completions.
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
.Va command
|
||
|
may be a full command name or a glob-pattern
|
||
|
(see
|
||
|
.Va Filename substitution
|
||
|
).
|
||
|
It can begin with
|
||
|
.Sq \-
|
||
|
to indicate that
|
||
|
completion should be used only when
|
||
|
.Va command
|
||
|
is ambiguous.
|
||
|
.Pp
|
||
|
.Va word
|
||
|
specifies which word relative to the current word
|
||
|
is to be completed, and may be one of the following:
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.RS +4
|
||
|
.TP 4
|
||
|
.B c
|
||
|
Current-word completion.
|
||
|
.Va pattern
|
||
|
is a glob-pattern which must match the beginning of the current word on
|
||
|
the command line.
|
||
|
.Va pattern
|
||
|
is ignored when completing the current word.
|
||
|
.TP 4
|
||
|
.B C
|
||
|
Like
|
||
|
.Va c
|
||
|
, but includes
|
||
|
.Va pattern
|
||
|
when completing the current word.
|
||
|
.TP 4
|
||
|
.B n
|
||
|
Next-word completion.
|
||
|
.Va pattern
|
||
|
is a glob-pattern which must match the beginning of the previous word on
|
||
|
the command line.
|
||
|
.TP 4
|
||
|
.B N
|
||
|
Like
|
||
|
.Va n
|
||
|
, but must match the beginning of the word two before the current word.
|
||
|
.TP 4
|
||
|
.B p
|
||
|
Position-dependent completion.
|
||
|
.Va pattern
|
||
|
is a numeric range, with the same syntax used to index shell
|
||
|
variables, which must include the current word.
|
||
|
.PD
|
||
|
.RE
|
||
|
.Pp
|
||
|
.Va list
|
||
|
, the list of possible completions, may be one of the following:
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.RS +4
|
||
|
.TP 8
|
||
|
.B a
|
||
|
Aliases
|
||
|
.TP 8
|
||
|
.B b
|
||
|
Bindings (editor commands)
|
||
|
.TP 8
|
||
|
.B c
|
||
|
Commands (builtin or external commands)
|
||
|
.TP 8
|
||
|
.B C
|
||
|
External commands which begin with the supplied path prefix
|
||
|
.TP 8
|
||
|
.B d
|
||
|
Directories
|
||
|
.TP 8
|
||
|
.B D
|
||
|
Directories which begin with the supplied path prefix
|
||
|
.TP 8
|
||
|
.B e
|
||
|
Environment variables
|
||
|
.TP 8
|
||
|
.B f
|
||
|
Filenames
|
||
|
.TP 8
|
||
|
.B F
|
||
|
Filenames which begin with the supplied path prefix
|
||
|
.TP 8
|
||
|
.B g
|
||
|
Groupnames
|
||
|
.TP 8
|
||
|
.B j
|
||
|
Jobs
|
||
|
.TP 8
|
||
|
.B l
|
||
|
Limits
|
||
|
.TP 8
|
||
|
.B n
|
||
|
Nothing
|
||
|
.TP 8
|
||
|
.B s
|
||
|
Shell variables
|
||
|
.TP 8
|
||
|
.B S
|
||
|
Signals
|
||
|
.TP 8
|
||
|
.B t
|
||
|
Plain (
|
||
|
.Dq text )
|
||
|
files
|
||
|
.TP 8
|
||
|
.B T
|
||
|
Plain (
|
||
|
.Dq text )
|
||
|
files which begin with the supplied path prefix
|
||
|
.TP 8
|
||
|
.B v
|
||
|
Any variables
|
||
|
.TP 8
|
||
|
.B u
|
||
|
Usernames
|
||
|
.TP 8
|
||
|
.B x
|
||
|
Like
|
||
|
.Va n ,
|
||
|
but prints
|
||
|
.Va select
|
||
|
when
|
||
|
.Va list-choices
|
||
|
is used.
|
||
|
.TP 8
|
||
|
.B X
|
||
|
Completions
|
||
|
.TP 8
|
||
|
$
|
||
|
.Va var
|
||
|
Words from the variable
|
||
|
.Va var
|
||
|
.TP 8
|
||
|
(...)
|
||
|
Words from the given list
|
||
|
.TP 8
|
||
|
\`...\`
|
||
|
Words from the output of command
|
||
|
.PD
|
||
|
.RE
|
||
|
.Pp
|
||
|
.Va select
|
||
|
is an optional glob-pattern.
|
||
|
If given, words from only
|
||
|
.Va list
|
||
|
that match
|
||
|
.Va select
|
||
|
are considered
|
||
|
and the
|
||
|
.Va fignore
|
||
|
shell variable is ignored.
|
||
|
The last three types of completion may not have a
|
||
|
.Va select
|
||
|
pattern, and
|
||
|
.Va x
|
||
|
uses
|
||
|
.Va select
|
||
|
as an explanatory message when
|
||
|
the
|
||
|
.Va list-choices
|
||
|
editor command is used.
|
||
|
.Pp
|
||
|
.Va suffix
|
||
|
is a single character to be appended to a successful
|
||
|
completion.
|
||
|
If null, no character is appended.
|
||
|
If omitted (in which
|
||
|
case the fourth delimiter can also be omitted), a slash is appended to
|
||
|
directories and a space to other words.
|
||
|
.Pp
|
||
|
.Va command
|
||
|
invoked from \`...\` version has additional environment
|
||
|
variable set, the variable name is \%
|
||
|
.Va COMMAND_LINE
|
||
|
\% and
|
||
|
contains (as its name indicates) contents of the current (already
|
||
|
typed in) command line. One can examine and use contents of the
|
||
|
\%
|
||
|
.Va COMMAND_LINE
|
||
|
\% variable in her custom script to build more
|
||
|
sophisticated completions (see completion for svn(1) included in
|
||
|
this package).
|
||
|
.Pp
|
||
|
Now for some examples.
|
||
|
Some commands take only directories as arguments,
|
||
|
so there's no point completing plain files.
|
||
|
.IP "" 4
|
||
|
> complete cd 'p/1/d/'
|
||
|
.Pp
|
||
|
completes only the first word following
|
||
|
.Sq cd
|
||
|
(`p/1') with a directory.
|
||
|
.Va p
|
||
|
-type completion can also be used to narrow down command completion:
|
||
|
.IP "" 4
|
||
|
> co[^D]
|
||
|
.br
|
||
|
complete compress
|
||
|
.br
|
||
|
> complete \-co* 'p/0/(compress)/'
|
||
|
.br
|
||
|
> co[^D]
|
||
|
.br
|
||
|
> compress
|
||
|
.Pp
|
||
|
This completion completes commands (words in position 0,
|
||
|
.Sq p/0
|
||
|
)
|
||
|
which begin with
|
||
|
.Sq co
|
||
|
(thus matching
|
||
|
.Sq co*
|
||
|
) to
|
||
|
.Sq compress
|
||
|
(the only
|
||
|
word in the list).
|
||
|
The leading
|
||
|
.Sq \-
|
||
|
indicates that this completion is to be used with only
|
||
|
ambiguous commands.
|
||
|
.IP "" 4
|
||
|
> complete find 'n/\-user/u/'
|
||
|
.Pp
|
||
|
is an example of
|
||
|
.Va n
|
||
|
-type completion.
|
||
|
Any word following
|
||
|
.Sq find
|
||
|
and
|
||
|
immediately following
|
||
|
.Sq \-user
|
||
|
is completed from the list of users.
|
||
|
.IP "" 4
|
||
|
> complete cc 'c/\-I/d/'
|
||
|
.Pp
|
||
|
demonstrates
|
||
|
.Va c
|
||
|
-type completion.
|
||
|
Any word following
|
||
|
.Sq cc
|
||
|
and beginning
|
||
|
with
|
||
|
.Sq \-I
|
||
|
is completed as a directory.
|
||
|
`\-I' is not taken as part of the
|
||
|
directory because we used lowercase
|
||
|
.Va c
|
||
|
.Pp
|
||
|
Different
|
||
|
.Va list
|
||
|
s are useful with different commands.
|
||
|
.IP "" 4
|
||
|
> complete alias 'p/1/a/'
|
||
|
.br
|
||
|
> complete man 'p/*/c/'
|
||
|
.br
|
||
|
> complete set 'p/1/s/'
|
||
|
.br
|
||
|
> complete true 'p/1/x:Truth has no options./'
|
||
|
.Pp
|
||
|
These complete words following
|
||
|
.Sq alias
|
||
|
with aliases,
|
||
|
.Sq man
|
||
|
with commands,
|
||
|
and
|
||
|
.Sq set
|
||
|
with shell variables.
|
||
|
`true' doesn't have any options, so
|
||
|
.Va x
|
||
|
does nothing when completion
|
||
|
is attempted and prints
|
||
|
.Sq Truth has no options.
|
||
|
when completion choices are listed.
|
||
|
.Pp
|
||
|
Note that the
|
||
|
.Va man
|
||
|
example, and several other examples below, could
|
||
|
just as well have used 'c/*' or 'n/*' as 'p/*'.
|
||
|
.Pp
|
||
|
Words can be completed from a variable evaluated at completion time,
|
||
|
.IP "" 4
|
||
|
> complete ftp 'p/1/$hostnames/'
|
||
|
.br
|
||
|
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
|
||
|
.br
|
||
|
> ftp [^D]
|
||
|
.br
|
||
|
rtfm.mit.edu tesla.ee.cornell.edu
|
||
|
.br
|
||
|
> ftp [^C]
|
||
|
.br
|
||
|
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
|
||
|
.br
|
||
|
> ftp [^D]
|
||
|
.br
|
||
|
rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
|
||
|
.Pp
|
||
|
or from a command run at completion time:
|
||
|
.IP "" 4
|
||
|
> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
|
||
|
.br
|
||
|
> kill \-9 [^D]
|
||
|
.br
|
||
|
23113 23377 23380 23406 23429 23529 23530 PID
|
||
|
.Pp
|
||
|
Note that the
|
||
|
.Va complete
|
||
|
command does not itself quote its arguments,
|
||
|
so the braces, space and
|
||
|
.Sq $
|
||
|
in
|
||
|
.Sq {print $1}
|
||
|
must be quoted explicitly.
|
||
|
.Pp
|
||
|
One command can have multiple completions:
|
||
|
.IP "" 4
|
||
|
> complete dbx 'p/2/(core)/' 'p/*/c/'
|
||
|
.Pp
|
||
|
completes the second argument to
|
||
|
.Sq dbx
|
||
|
with the word
|
||
|
.Sq core
|
||
|
and all other
|
||
|
arguments with commands.
|
||
|
Note that the positional completion is specified
|
||
|
before the next-word completion.
|
||
|
Because completions are evaluated from left to right, if
|
||
|
the next-word completion were specified first it would always match
|
||
|
and the positional completion would never be executed.
|
||
|
This is a
|
||
|
common mistake when defining a completion.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va select
|
||
|
pattern is useful when a command takes files with only
|
||
|
particular forms as arguments.
|
||
|
For example,
|
||
|
.IP "" 4
|
||
|
> complete cc 'p/*/f:*.[cao]/'
|
||
|
.Pp
|
||
|
completes
|
||
|
.Sq cc
|
||
|
arguments to files ending in only
|
||
|
.Sq .c
|
||
|
,
|
||
|
.Sq .a
|
||
|
, or
|
||
|
.Sq .o
|
||
|
.Va select
|
||
|
can also exclude files, using negation of a glob-pattern as
|
||
|
described under
|
||
|
.Va Filename substitution
|
||
|
One might use
|
||
|
.IP "" 4
|
||
|
> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
|
||
|
.Pp
|
||
|
to exclude precious source code from
|
||
|
.Sq rm
|
||
|
completion.
|
||
|
Of course, one
|
||
|
could still type excluded names manually or override the completion
|
||
|
mechanism using the
|
||
|
.Va complete-word-raw
|
||
|
or
|
||
|
.Va list-choices-raw
|
||
|
editor commands (q.v.).
|
||
|
.Pp
|
||
|
The
|
||
|
.Sq C
|
||
|
,
|
||
|
.Sq D
|
||
|
,
|
||
|
.Sq F
|
||
|
and
|
||
|
.Sq T
|
||
|
|
||
|
.Va list
|
||
|
s are like
|
||
|
.Sq c
|
||
|
,
|
||
|
.Sq d
|
||
|
,
|
||
|
.Sq f
|
||
|
and
|
||
|
.Sq t
|
||
|
respectively, but they use the
|
||
|
.Va select
|
||
|
argument in a different way: to
|
||
|
restrict completion to files beginning with a particular path prefix.
|
||
|
For
|
||
|
example, the Elm mail program uses
|
||
|
.Sq =
|
||
|
as an abbreviation for one's mail
|
||
|
directory.
|
||
|
One might use
|
||
|
.IP "" 4
|
||
|
> complete elm c@=@F:$HOME/Mail/@
|
||
|
.Pp
|
||
|
to complete
|
||
|
.Sq elm \-f =
|
||
|
as if it were
|
||
|
.Sq elm \-f ~/Mail/
|
||
|
Note that we used
|
||
|
.Sq @
|
||
|
instead of
|
||
|
.Sq /
|
||
|
to avoid confusion with the
|
||
|
.Va select
|
||
|
argument, and we used
|
||
|
`$HOME' instead of
|
||
|
.Sq ~
|
||
|
because home directory substitution works at only the
|
||
|
beginning of a word.
|
||
|
.Pp
|
||
|
.Va suffix
|
||
|
is used to add a nonstandard suffix
|
||
|
(not space or
|
||
|
.Sq /
|
||
|
for directories) to completed words.
|
||
|
.IP "" 4
|
||
|
> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
|
||
|
.Pp
|
||
|
completes arguments to
|
||
|
.Sq finger
|
||
|
from the list of users, appends an
|
||
|
.Sq @
|
||
|
,
|
||
|
and then completes after the
|
||
|
.Sq @
|
||
|
from the
|
||
|
.Sq hostnames
|
||
|
variable.
|
||
|
Note
|
||
|
again the order in which the completions are specified.
|
||
|
.Pp
|
||
|
Finally, here's a complex example for inspiration:
|
||
|
.IP "" 4
|
||
|
> complete find \e
|
||
|
.br
|
||
|
\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
|
||
|
.br
|
||
|
\&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
|
||
|
.br
|
||
|
\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
|
||
|
.br
|
||
|
\&'n/\-type/(b c d f l p s)/' \e
|
||
|
.br
|
||
|
\'c/\-/(name newer cpio ncpio exec ok user \e
|
||
|
.br
|
||
|
group fstype type atime ctime depth inum \e
|
||
|
.br
|
||
|
ls mtime nogroup nouser perm print prune \e
|
||
|
.br
|
||
|
size xdev)/' \e
|
||
|
.br
|
||
|
\&'p/*/d/'
|
||
|
.Pp
|
||
|
This completes words following
|
||
|
.Sq \-name
|
||
|
,
|
||
|
.Sq \-newer
|
||
|
,
|
||
|
.Sq \-cpio
|
||
|
or
|
||
|
.Sq ncpio
|
||
|
(note the pattern which matches both) to files,
|
||
|
words following
|
||
|
.Sq \-exec
|
||
|
or
|
||
|
.Sq \-ok
|
||
|
to commands, words following
|
||
|
.Sq user
|
||
|
and
|
||
|
.Sq group
|
||
|
to users and groups respectively
|
||
|
and words following
|
||
|
.Sq \-fstype
|
||
|
or
|
||
|
.Sq \-type
|
||
|
to members of the
|
||
|
given lists.
|
||
|
It also completes the switches themselves from the given list
|
||
|
(note the use of
|
||
|
.Va c
|
||
|
-type completion)
|
||
|
and completes anything not otherwise completed to a directory.
|
||
|
Whew.
|
||
|
.Pp
|
||
|
Remember that programmed completions are ignored if the word being completed
|
||
|
is a tilde substitution (beginning with
|
||
|
.Sq ~
|
||
|
) or a variable (beginning with
|
||
|
.Sq $
|
||
|
).
|
||
|
See also the
|
||
|
.Va uncomplete
|
||
|
builtin command.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B continue
|
||
|
Continues execution of the nearest enclosing
|
||
|
.Va while
|
||
|
or
|
||
|
.Va foreach
|
||
|
The rest of the commands on the current line are executed.
|
||
|
.TP 8
|
||
|
.B default:
|
||
|
Labels the default case in a
|
||
|
.Va switch
|
||
|
statement.
|
||
|
It should come after all
|
||
|
.Va case
|
||
|
labels.
|
||
|
.Pp
|
||
|
.B dirs \fR[
|
||
|
.Fl l\fR] [
|
||
|
.Fl n\fR|
|
||
|
.Fl v\fR]
|
||
|
.br
|
||
|
.B dirs \-S\fR|
|
||
|
.Fl L \fR[
|
||
|
.Va filename
|
||
|
] (+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B dirs \-c \fR(+)
|
||
|
The first form prints the directory stack.
|
||
|
The top of the stack is at the
|
||
|
left and the first directory in the stack is the current directory.
|
||
|
With
|
||
|
.Fl l\fR,
|
||
|
.Sq ~
|
||
|
or
|
||
|
.Sq ~\fIname\fP
|
||
|
in the output is expanded explicitly
|
||
|
to
|
||
|
.Va home
|
||
|
or the pathname of the home directory for user \fIname\fP.
|
||
|
(+)
|
||
|
With
|
||
|
.Fl n\fR, entries are wrapped before they reach the edge of the screen.
|
||
|
(+)
|
||
|
With
|
||
|
.Fl v\fR, entries are printed one per line, preceded by their stack positions.
|
||
|
(+)
|
||
|
If more than one of
|
||
|
.Fl n\fR or
|
||
|
.Fl v\fR is given,
|
||
|
.Fl v\fR takes precedence.
|
||
|
.Fl p\fR is accepted but does nothing.
|
||
|
.PD
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
With
|
||
|
.Fl S\fR, the second form saves the directory stack to
|
||
|
.Va filename
|
||
|
as a series of
|
||
|
.Va cd
|
||
|
and
|
||
|
.Va pushd
|
||
|
commands.
|
||
|
With
|
||
|
.Fl L\fR, the shell sources
|
||
|
.Va filename
|
||
|
, which is presumably
|
||
|
a directory stack file saved by the
|
||
|
.Fl S\fR option or the
|
||
|
.Va savedirs
|
||
|
mechanism.
|
||
|
In either case,
|
||
|
.Va dirsfile
|
||
|
is used if
|
||
|
.Va filename
|
||
|
is not given and
|
||
|
.Va ~/.cshdirs
|
||
|
is used if
|
||
|
.Va dirsfile
|
||
|
is unset.
|
||
|
.Pp
|
||
|
Note that login shells do the equivalent of
|
||
|
.Sq dirs \-L
|
||
|
on startup
|
||
|
and, if
|
||
|
.Va savedirs
|
||
|
is set,
|
||
|
.Sq dirs \-S
|
||
|
before exiting.
|
||
|
Because only
|
||
|
.Va ~/.tcshrc
|
||
|
is normally sourced before
|
||
|
.Va ~/.cshdirs
|
||
|
,
|
||
|
.Va dirsfile
|
||
|
should be set in
|
||
|
.Va ~/.tcshrc
|
||
|
rather than
|
||
|
.Va ~/.login
|
||
|
.Pp
|
||
|
The last form clears the directory stack.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B echo \fR[
|
||
|
.Fl n\fR]
|
||
|
.Va word
|
||
|
...
|
||
|
Writes each
|
||
|
.Va word
|
||
|
to the shell's standard
|
||
|
output, separated by spaces and terminated with a newline.
|
||
|
The
|
||
|
.Va echo_style
|
||
|
shell variable may be set to emulate (or not) the flags and escape
|
||
|
sequences of the BSD and/or System V versions of
|
||
|
.Va echo
|
||
|
; see
|
||
|
.Va echo
|
||
|
(1).
|
||
|
.TP 8
|
||
|
.B echotc \fR[
|
||
|
.Fl sv\fR]
|
||
|
.Va arg
|
||
|
... (+)
|
||
|
Exercises the terminal capabilities (see
|
||
|
.Va termcap
|
||
|
(5)) in
|
||
|
.Va args
|
||
|
For example, 'echotc home' sends the cursor to the home position,
|
||
|
\&'echotc cm 3 10' sends it to column 3 and row 10, and
|
||
|
\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
|
||
|
in the status line.
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
If
|
||
|
.Va arg
|
||
|
is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
|
||
|
value of that capability ("yes" or "no" indicating that the terminal does
|
||
|
or does not have that capability).
|
||
|
One might use this to make the output
|
||
|
from a shell script less verbose on slow terminals, or limit command
|
||
|
output to the number of lines on the screen:
|
||
|
.IP "" 4
|
||
|
> set history=\`echotc lines\`
|
||
|
.br
|
||
|
> @ history\-\-
|
||
|
.Pp
|
||
|
Termcap strings may contain wildcards which will not echo correctly.
|
||
|
One should use double quotes when setting a shell variable to a terminal
|
||
|
capability string, as in the following example that places the date in
|
||
|
the status line:
|
||
|
.IP "" 4
|
||
|
> set tosl="\`echotc ts 0\`"
|
||
|
.br
|
||
|
> set frsl="\`echotc fs\`"
|
||
|
.br
|
||
|
> echo \-n "$tosl";date; echo \-n "$frsl"
|
||
|
.Pp
|
||
|
With
|
||
|
.Fl s\fR, nonexistent capabilities return the empty string rather
|
||
|
than causing an error.
|
||
|
With
|
||
|
.Fl v\fR, messages are verbose.
|
||
|
.RE
|
||
|
.Pp
|
||
|
.B else
|
||
|
.br
|
||
|
.B end
|
||
|
.br
|
||
|
.B endif
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B endsw
|
||
|
See the description of the
|
||
|
.Va foreach
|
||
|
,
|
||
|
.Va if
|
||
|
,
|
||
|
.Va switch
|
||
|
, and
|
||
|
.Va while
|
||
|
statements below.
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B eval
|
||
|
.Va arg
|
||
|
...
|
||
|
Treats the arguments as input to the
|
||
|
shell and executes the resulting command(s) in the context
|
||
|
of the current shell.
|
||
|
This is usually used to execute commands
|
||
|
generated as the result of command or variable substitution,
|
||
|
because parsing occurs before these substitutions.
|
||
|
See
|
||
|
.Va tset
|
||
|
(1) for a sample use of
|
||
|
.Va eval
|
||
|
.TP 8
|
||
|
.B exec
|
||
|
.Va command
|
||
|
Executes the specified command in place of the current shell.
|
||
|
.TP 8
|
||
|
.B exit \fR[
|
||
|
.Va expr
|
||
|
]
|
||
|
The shell exits either with the value of the specified
|
||
|
.Va expr
|
||
|
(an expression, as described under
|
||
|
.Va Expressions
|
||
|
)
|
||
|
or, without
|
||
|
.Va expr
|
||
|
, with the value 0.
|
||
|
.TP 8
|
||
|
.B fg \fR[\fB%
|
||
|
.Va job
|
||
|
...]
|
||
|
Brings the specified jobs (or, without arguments, the current job)
|
||
|
into the foreground, continuing each if it is stopped.
|
||
|
.Va job
|
||
|
may be a number, a string,
|
||
|
.Sq
|
||
|
,
|
||
|
.Sq %
|
||
|
,
|
||
|
.Sq +
|
||
|
or
|
||
|
.Sq \-
|
||
|
as described
|
||
|
under
|
||
|
.Va Jobs
|
||
|
See also the
|
||
|
.Va run-fg-editor
|
||
|
editor command.
|
||
|
.TP 8
|
||
|
.B filetest \-
|
||
|
.Va op file
|
||
|
... (+)
|
||
|
Applies
|
||
|
.Va op
|
||
|
(which is a file inquiry operator as described under
|
||
|
.Va File inquiry operators
|
||
|
) to each
|
||
|
.Va file
|
||
|
and returns the results as a
|
||
|
space-separated list.
|
||
|
.Pp
|
||
|
.B foreach \fIname \fB(\fIwordlist\fB)
|
||
|
.br
|
||
|
\&...
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B end
|
||
|
Successively sets the variable
|
||
|
.Va name
|
||
|
to each member of
|
||
|
.Va wordlist
|
||
|
and executes the sequence of commands between this command
|
||
|
and the matching
|
||
|
.Va end
|
||
|
(Both
|
||
|
.Va foreach
|
||
|
and
|
||
|
.Va end
|
||
|
must appear alone on separate lines.) The builtin command
|
||
|
.Va continue
|
||
|
may be used to continue the loop prematurely and
|
||
|
the builtin command
|
||
|
.Va break
|
||
|
to terminate it prematurely.
|
||
|
When this command is read from the terminal, the loop is read once
|
||
|
prompting with
|
||
|
.Sq foreach?
|
||
|
(or
|
||
|
.Va prompt2
|
||
|
) before any statements in
|
||
|
the loop are executed.
|
||
|
If you make a mistake typing in a
|
||
|
loop at the terminal you can rub it out.
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B getspath \fR(+)
|
||
|
Prints the system execution path.
|
||
|
(TCF only)
|
||
|
.TP 8
|
||
|
.B getxvers \fR(+)
|
||
|
Prints the experimental version prefix.
|
||
|
(TCF only)
|
||
|
.TP 8
|
||
|
.B glob \fIwordlist
|
||
|
Like
|
||
|
.Va echo
|
||
|
, but the
|
||
|
.Sq -n
|
||
|
parameter is not recognized and words are
|
||
|
delimited by null characters in the output.
|
||
|
Useful for
|
||
|
programs which wish to use the shell to filename expand a list of words.
|
||
|
.TP 8
|
||
|
.B goto \fIword
|
||
|
.Va word
|
||
|
is filename and command-substituted to
|
||
|
yield a string of the form
|
||
|
.Sq label
|
||
|
The shell rewinds its
|
||
|
input as much as possible, searches for a line of the
|
||
|
form
|
||
|
.Sq label:
|
||
|
, possibly preceded by blanks or tabs, and
|
||
|
continues execution after that line.
|
||
|
.TP 8
|
||
|
.B hashstat
|
||
|
Prints a statistics line indicating how effective the
|
||
|
internal hash table has been at locating commands (and avoiding
|
||
|
.Va exec
|
||
|
's).
|
||
|
An
|
||
|
.Va exec
|
||
|
is attempted for each component of the
|
||
|
.Va path
|
||
|
where the hash function indicates a possible hit, and
|
||
|
in each component which does not begin with a
|
||
|
.Sq /
|
||
|
.IP
|
||
|
On machines without
|
||
|
.Va vfork
|
||
|
(2), prints only the number and size of
|
||
|
hash buckets.
|
||
|
.Pp
|
||
|
.B history \fR[
|
||
|
.Fl hTr\fR] [
|
||
|
.Va n
|
||
|
]
|
||
|
.br
|
||
|
.B history \-S\fR|
|
||
|
.Fl L|
|
||
|
.Fl M \fR[
|
||
|
.Va filename
|
||
|
] (+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B history \-c \fR(+)
|
||
|
The first form prints the history event list.
|
||
|
If
|
||
|
.Va n
|
||
|
is given only the
|
||
|
.Va n
|
||
|
most recent events are printed or saved.
|
||
|
With
|
||
|
.Fl h\fR, the history list is printed without leading numbers.
|
||
|
If
|
||
|
.Va -T
|
||
|
is specified, timestamps are printed also in comment form.
|
||
|
(This can be used to
|
||
|
produce files suitable for loading with 'history \-L' or 'source \-h'.)
|
||
|
With
|
||
|
.Fl r\fR, the order of printing is most recent
|
||
|
first rather than oldest first.
|
||
|
.PD
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
With
|
||
|
.Fl S\fR, the second form saves the history list to
|
||
|
.Va filename
|
||
|
If the first word of the
|
||
|
.Va savehist
|
||
|
shell variable is set to a
|
||
|
number, at most that many lines are saved.
|
||
|
If the second word of
|
||
|
.Va savehist
|
||
|
is set to
|
||
|
.Sq merge
|
||
|
, the history list is merged with the
|
||
|
existing history file instead of replacing it (if there is one) and
|
||
|
sorted by time stamp.
|
||
|
(+) Merging is intended for an environment like
|
||
|
the X Window System
|
||
|
with several shells in simultaneous use.
|
||
|
If the second word of
|
||
|
.Va savehist
|
||
|
is
|
||
|
.Sq merge
|
||
|
and the third word is set to
|
||
|
.Sq lock
|
||
|
, the history file update
|
||
|
will be serialized with other shell sessions that would possibly like
|
||
|
to merge history at exactly the same time.
|
||
|
.Pp
|
||
|
With
|
||
|
.Fl L\fR, the shell appends
|
||
|
.Va filename
|
||
|
, which is presumably a
|
||
|
history list saved by the
|
||
|
.Fl S\fR option or the
|
||
|
.Va savehist
|
||
|
mechanism,
|
||
|
to the history list.
|
||
|
.Fl M\fR is like
|
||
|
.Fl L\fR, but the contents of
|
||
|
.Va filename
|
||
|
are merged
|
||
|
into the history list and sorted by timestamp.
|
||
|
In either case,
|
||
|
.Va histfile
|
||
|
is used if
|
||
|
.Va filename
|
||
|
is not given and
|
||
|
.Va ~/.history
|
||
|
is used if
|
||
|
.Va histfile
|
||
|
is unset.
|
||
|
`history \-L' is exactly like 'source \-h' except that it does not require a
|
||
|
filename.
|
||
|
.Pp
|
||
|
Note that login shells do the equivalent of
|
||
|
.Sq history \-L
|
||
|
on startup
|
||
|
and, if
|
||
|
.Va savehist
|
||
|
is set,
|
||
|
.Sq history \-S
|
||
|
before exiting.
|
||
|
Because only
|
||
|
.Va ~/.tcshrc
|
||
|
is normally sourced before
|
||
|
.Va ~/.history
|
||
|
,
|
||
|
.Va histfile
|
||
|
should be set in
|
||
|
.Va ~/.tcshrc
|
||
|
rather than
|
||
|
.Va ~/.login
|
||
|
.Pp
|
||
|
If
|
||
|
.Va histlit
|
||
|
is set, the first and second forms print and save the literal
|
||
|
(unexpanded) form of the history list.
|
||
|
.Pp
|
||
|
The last form clears the history list.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B hup \fR[
|
||
|
.Va command
|
||
|
] \fR(+)
|
||
|
With
|
||
|
.Va command
|
||
|
, runs
|
||
|
.Va command
|
||
|
such that it will exit on a hangup
|
||
|
signal and arranges for the shell to send it a hangup signal when the shell
|
||
|
exits.
|
||
|
Note that commands may set their own response to hangups, overriding
|
||
|
.Va hup
|
||
|
Without an argument, causes the non-interactive shell only to
|
||
|
exit on a hangup for the remainder of the script.
|
||
|
See also
|
||
|
.Va Signal handling
|
||
|
and the
|
||
|
.Va nohup
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B if (\fIexpr\fB) \fIcommand
|
||
|
If
|
||
|
.Va expr
|
||
|
(an expression, as described under
|
||
|
.Va Expressions
|
||
|
)
|
||
|
evaluates true, then
|
||
|
.Va command
|
||
|
is executed.
|
||
|
Variable substitution on
|
||
|
.Va command
|
||
|
happens early, at the same time it
|
||
|
does for the rest of the
|
||
|
.Va if
|
||
|
command.
|
||
|
.Va command
|
||
|
must be a simple command, not an alias, a pipeline, a command list
|
||
|
or a parenthesized command list, but it may have arguments.
|
||
|
Input/output redirection occurs even if
|
||
|
.Va expr
|
||
|
is
|
||
|
false and
|
||
|
.Va command
|
||
|
is thus
|
||
|
.Va not
|
||
|
executed; this is a bug.
|
||
|
.Pp
|
||
|
.B if (\fIexpr\fB) then
|
||
|
.br
|
||
|
\&...
|
||
|
.br
|
||
|
.B else if (\fIexpr2\fB) then
|
||
|
.br
|
||
|
\&...
|
||
|
.br
|
||
|
.B else
|
||
|
.br
|
||
|
\&...
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B endif
|
||
|
If the specified
|
||
|
.Va expr
|
||
|
is true then the commands to the
|
||
|
first
|
||
|
.Va else
|
||
|
are executed; otherwise if
|
||
|
.Va expr2
|
||
|
is true then
|
||
|
the commands to the second
|
||
|
.Va else
|
||
|
are executed, etc.
|
||
|
Any
|
||
|
number of
|
||
|
.Va else-if
|
||
|
pairs are possible; only one
|
||
|
.Va endif
|
||
|
is
|
||
|
needed.
|
||
|
The
|
||
|
.Va else
|
||
|
part is likewise optional.
|
||
|
(The words
|
||
|
.Va else
|
||
|
and
|
||
|
.Va endif
|
||
|
must appear at the beginning of input lines;
|
||
|
the
|
||
|
.Va if
|
||
|
must appear alone on its input line or after an
|
||
|
.Va else
|
||
|
.)
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B inlib
|
||
|
.Va shared-library
|
||
|
... (+)
|
||
|
Adds each
|
||
|
.Va shared-library
|
||
|
to the current environment.
|
||
|
There is no way
|
||
|
to remove a shared library.
|
||
|
(Domain/OS only)
|
||
|
.TP 8
|
||
|
.B jobs \fR[
|
||
|
.Fl l\fR]
|
||
|
Lists the active jobs.
|
||
|
With
|
||
|
.Fl l\fR, lists process
|
||
|
IDs in addition to the normal information.
|
||
|
On TCF systems, prints
|
||
|
the site on which each job is executing.
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B kill \fR[
|
||
|
.Fl s
|
||
|
.Va signal
|
||
|
] \fB%
|
||
|
.Va job
|
||
|
|
|
||
|
.Va pid
|
||
|
...
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B kill \-l
|
||
|
The first and second forms sends the specified
|
||
|
.Va signal
|
||
|
(or, if none
|
||
|
is given, the TERM (terminate) signal) to the specified jobs or processes.
|
||
|
.Va job
|
||
|
may be a number, a string,
|
||
|
.Sq
|
||
|
,
|
||
|
.Sq %
|
||
|
,
|
||
|
.Sq +
|
||
|
or
|
||
|
.Sq \-
|
||
|
as described
|
||
|
under
|
||
|
.Va Jobs
|
||
|
Signals are either given by number or by name (as given in
|
||
|
.Va /usr/include/signal.h
|
||
|
, stripped of the prefix
|
||
|
.Sq SIG
|
||
|
).
|
||
|
There is no default
|
||
|
.Va job
|
||
|
; saying just
|
||
|
.Sq kill
|
||
|
does not send a signal
|
||
|
to the current job.
|
||
|
If the signal being sent is TERM (terminate)
|
||
|
or HUP (hangup), then the job or process is sent a
|
||
|
CONT (continue) signal as well.
|
||
|
The third form lists the signal names.
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B limit \fR[
|
||
|
.Fl h\fR] [
|
||
|
.Va resource
|
||
|
[
|
||
|
.Va maximum-use
|
||
|
]]
|
||
|
Limits the consumption by the current process and each
|
||
|
process it creates to not individually exceed
|
||
|
.Va maximum-use
|
||
|
on
|
||
|
the specified
|
||
|
.Va resource
|
||
|
If no
|
||
|
.Va maximum-use
|
||
|
is given, then
|
||
|
the current limit is printed; if no
|
||
|
.Va resource
|
||
|
is given, then
|
||
|
all limitations are given.
|
||
|
If the
|
||
|
.Fl h\fR flag is given, the
|
||
|
hard limits are used instead of the current limits.
|
||
|
The
|
||
|
hard limits impose a ceiling on the values of the current
|
||
|
limits.
|
||
|
Only the super-user may raise the hard limits, but
|
||
|
a user may lower or raise the current limits within the legal range.
|
||
|
.Pp
|
||
|
Controllable resources currently include (if supported by the OS):
|
||
|
.Bl -tag -width pseudoterminals -compact -offset indent
|
||
|
.It Va cputime
|
||
|
the maximum number of cpu-seconds to be used by each process
|
||
|
.It Va filesize
|
||
|
the largest single file which can be created
|
||
|
.It Va datasize
|
||
|
the maximum growth of the data+stack region via sbrk(2) beyond
|
||
|
the end of the program text
|
||
|
.It Va stacksize
|
||
|
the maximum size of the automatically-extended stack region
|
||
|
.It Va coredumpsize
|
||
|
the size of the largest core dump that will be created
|
||
|
.It Va memoryuse
|
||
|
the maximum amount of physical memory a process
|
||
|
may have allocated to it at a given time
|
||
|
.It Va vmemoryuse
|
||
|
the maximum amount of virtual memory a process
|
||
|
may have allocated to it at a given time (address space)
|
||
|
.It Va vmemoryuse
|
||
|
the maximum amount of virtual memory a process
|
||
|
may have allocated to it at a given time
|
||
|
.It Va heapsize
|
||
|
the maximum amount of memory a process
|
||
|
may allocate per
|
||
|
.Xr brk 2
|
||
|
system call
|
||
|
.It Va descriptors
|
||
|
or
|
||
|
.It Va openfiles
|
||
|
the maximum number of open files for this process
|
||
|
.It Va pseudoterminals
|
||
|
the maximum number of pseudo-terminals for this user
|
||
|
.It Va kqueues
|
||
|
the maximum number of kqueues allocated for this process
|
||
|
.It Va concurrency
|
||
|
the maximum number of threads for this process
|
||
|
.It Va memorylocked
|
||
|
the maximum size which a process may lock into memory using mlock(2)
|
||
|
.It Va maxproc
|
||
|
the maximum number of simultaneous processes for this user id
|
||
|
.It Va maxthread
|
||
|
the maximum number of simultaneous threads (lightweight processes) for this
|
||
|
user id
|
||
|
.It Va threads
|
||
|
the maximum number of threads for this process
|
||
|
.It Va sbsize
|
||
|
the maximum size of socket buffer usage for this user
|
||
|
.It Va swapsize
|
||
|
the maximum amount of swap space reserved or used for this user
|
||
|
.It Va maxlocks
|
||
|
the maximum number of locks for this user
|
||
|
.It Va posixlocks
|
||
|
the maximum number of POSIX advisory locks for this user
|
||
|
.It Va maxsignal
|
||
|
the maximum number of pending signals for this user
|
||
|
.It Va maxmessage
|
||
|
the maximum number of bytes in POSIX mqueues for this user
|
||
|
.It Va maxnice
|
||
|
the maximum nice priority the user is allowed to raise mapped from [19...-20]
|
||
|
to [0...39] for this user
|
||
|
.It Va maxrtprio
|
||
|
the maximum realtime priority for this user
|
||
|
.It Va maxrttime
|
||
|
the timeout for RT tasks in microseconds for this user.
|
||
|
.El
|
||
|
.Pp
|
||
|
.Va maximum-use
|
||
|
may be given as a (floating point or
|
||
|
integer) number followed by a scale factor.
|
||
|
For all limits
|
||
|
other than
|
||
|
.Va cputime
|
||
|
the default scale is
|
||
|
.Sq k
|
||
|
or
|
||
|
.Sq kilobytes
|
||
|
(1024 bytes); a scale factor of
|
||
|
.Sq m
|
||
|
or
|
||
|
.Sq megabytes
|
||
|
or
|
||
|
.Sq g
|
||
|
or
|
||
|
.Sq gigabytes
|
||
|
may also be used.
|
||
|
For
|
||
|
.Va cputime
|
||
|
the default scaling is
|
||
|
.Sq seconds ,
|
||
|
while
|
||
|
.Sq m
|
||
|
for minutes or
|
||
|
.Sq h
|
||
|
for hours, or a time of the
|
||
|
form
|
||
|
.Sq mm:ss
|
||
|
giving minutes and seconds may be used.
|
||
|
.Pp
|
||
|
If
|
||
|
.Va maximum-use
|
||
|
is
|
||
|
.Sq unlimited ,
|
||
|
then the limitation on the specified
|
||
|
.Va resource
|
||
|
is removed (this is equivalent to the
|
||
|
.Va unlimit
|
||
|
builtin command).
|
||
|
.Pp
|
||
|
For both
|
||
|
.Va resource
|
||
|
names and scale factors, unambiguous
|
||
|
prefixes of the names suffice.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B log \fR(+)
|
||
|
Prints the
|
||
|
.Va watch
|
||
|
shell variable and reports on each user indicated
|
||
|
in
|
||
|
.Va watch
|
||
|
who is logged in, regardless of when they last logged in.
|
||
|
See also
|
||
|
.Va watchlog
|
||
|
.TP 8
|
||
|
.B login
|
||
|
Terminates a login shell, replacing it with an instance of
|
||
|
.Va /bin/login
|
||
|
. This is one way to log off, included for
|
||
|
compatibility with
|
||
|
.Xr sh 1 .
|
||
|
.TP 8
|
||
|
.B logout
|
||
|
Terminates a login shell.
|
||
|
Especially useful if
|
||
|
.Va ignoreeof
|
||
|
is set.
|
||
|
.TP 8
|
||
|
.B ls\-F \fR[\-
|
||
|
.Va switch
|
||
|
...] [
|
||
|
.Va file
|
||
|
...] (+)
|
||
|
Lists files like
|
||
|
.Sq ls \-F
|
||
|
, but much faster.
|
||
|
It identifies each type of
|
||
|
special file in the listing with a special character:
|
||
|
.Bl -tag -width x -offset indent -compact
|
||
|
.It Dv /
|
||
|
Directory
|
||
|
.It Dv *
|
||
|
Executable
|
||
|
.It Dv #
|
||
|
Block device
|
||
|
.It Dv %
|
||
|
Character device
|
||
|
.It Dv |
|
||
|
Named pipe (systems with named pipes only)
|
||
|
.It Dv =
|
||
|
Socket (systems with sockets only)
|
||
|
.It Dv @
|
||
|
Symbolic link (systems with symbolic links only)
|
||
|
.It Dv +
|
||
|
Hidden directory (AIX only) or context dependent (HP/UX only)
|
||
|
.It Dv :
|
||
|
Network special (HP/UX only)
|
||
|
.El
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va listlinks
|
||
|
shell variable is set, symbolic links are identified
|
||
|
in more detail (on only systems that have them, of course):
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
@
|
||
|
Symbolic link to a non-directory
|
||
|
.TP 4
|
||
|
>
|
||
|
Symbolic link to a directory
|
||
|
.TP 4
|
||
|
&
|
||
|
Symbolic link to nowhere
|
||
|
.PD
|
||
|
.Pp
|
||
|
.Va listlinks
|
||
|
also slows down \fIls\-F\fR and causes partitions holding
|
||
|
files pointed to by symbolic links to be mounted.
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va listflags
|
||
|
shell variable is set to
|
||
|
.Sq x
|
||
|
,
|
||
|
.Sq a
|
||
|
or
|
||
|
.Sq A
|
||
|
, or any
|
||
|
combination thereof (e.g.,
|
||
|
.Sq xA
|
||
|
), they are used as flags to \fIls\-F\fR,
|
||
|
making it act like
|
||
|
.Sq ls \-xF
|
||
|
,
|
||
|
.Sq ls \-Fa
|
||
|
,
|
||
|
.Sq ls \-FA
|
||
|
or a combination
|
||
|
(e.g.,
|
||
|
.Sq ls \-FxA
|
||
|
).
|
||
|
On machines where
|
||
|
.Sq ls \-C
|
||
|
is not the default, \fIls\-F\fR acts like
|
||
|
.Sq ls \-CF
|
||
|
,
|
||
|
unless
|
||
|
.Va listflags
|
||
|
contains an
|
||
|
.Sq x
|
||
|
, in which case it acts like
|
||
|
.Sq ls \-xF
|
||
|
\fIls\-F\fR passes its arguments to
|
||
|
.Va ls
|
||
|
(1) if it is given any switches,
|
||
|
so
|
||
|
.Sq alias ls ls\-F
|
||
|
generally does the right thing.
|
||
|
.Pp
|
||
|
The \fBls\-F\fR builtin can list files using different colors depending on the
|
||
|
filetype or extension.
|
||
|
See the
|
||
|
.Va color
|
||
|
shell variable and the
|
||
|
.Va LS_COLORS
|
||
|
environment variable.
|
||
|
.RE
|
||
|
.Pp
|
||
|
.B migrate \fR[
|
||
|
.Fl
|
||
|
.Va site
|
||
|
]
|
||
|
.Va pid
|
||
|
|\fB%
|
||
|
.Va jobid
|
||
|
... (+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B migrate \-
|
||
|
.Va site
|
||
|
(+)
|
||
|
The first form migrates the process or job to the site specified or the
|
||
|
default site determined by the system path.
|
||
|
The second form is equivalent to
|
||
|
.Sq migrate \-
|
||
|
.Va site
|
||
|
$$
|
||
|
: it migrates the
|
||
|
current process to the specified site.
|
||
|
Migrating the shell
|
||
|
itself can cause unexpected behavior, because the shell
|
||
|
does not like to lose its tty.
|
||
|
(TCF only)
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B newgrp \fR[
|
||
|
.Fl \fR]
|
||
|
.Va [group]
|
||
|
(+)
|
||
|
Equivalent to
|
||
|
.Sq exec newgrp
|
||
|
; see
|
||
|
.Va newgrp
|
||
|
(1).
|
||
|
Available only if the shell was so compiled;
|
||
|
see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B nice \fR[\fB+
|
||
|
.Va number
|
||
|
] [
|
||
|
.Va command
|
||
|
]
|
||
|
Sets the scheduling priority for the shell to
|
||
|
.Va number
|
||
|
, or, without
|
||
|
.Va number
|
||
|
, to 4.
|
||
|
With
|
||
|
.Va command ,
|
||
|
runs
|
||
|
.Va command
|
||
|
at the appropriate
|
||
|
priority.
|
||
|
The greater the
|
||
|
.Va number
|
||
|
, the less cpu
|
||
|
the process gets.
|
||
|
The super-user may specify negative
|
||
|
priority by using
|
||
|
.Sq nice \-number ...
|
||
|
Command is always
|
||
|
executed in a sub-shell, and the restrictions placed on
|
||
|
commands in simple
|
||
|
.Va if
|
||
|
statements apply.
|
||
|
.TP 8
|
||
|
.B nohup \fR[
|
||
|
.Va command
|
||
|
]
|
||
|
With
|
||
|
.Va command
|
||
|
, runs
|
||
|
.Va command
|
||
|
such that it will ignore hangup signals.
|
||
|
Note that commands may set their own response to hangups, overriding
|
||
|
.Va nohup
|
||
|
Without an argument, causes the non-interactive shell only to
|
||
|
ignore hangups for the remainder of the script.
|
||
|
See also
|
||
|
.Va Signal handling
|
||
|
and the
|
||
|
.Va hup
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B notify \fR[\fB%
|
||
|
.Va job
|
||
|
...]
|
||
|
Causes the shell to notify the user asynchronously when the status of any
|
||
|
of the specified jobs (or, without %
|
||
|
.Va job
|
||
|
, the current job) changes,
|
||
|
instead of waiting until the next prompt as is usual.
|
||
|
.Va job
|
||
|
may be a number, a string,
|
||
|
.Sq
|
||
|
,
|
||
|
.Sq %
|
||
|
,
|
||
|
.Sq +
|
||
|
or
|
||
|
.Sq \-
|
||
|
as described
|
||
|
under
|
||
|
.Va Jobs
|
||
|
See also the
|
||
|
.Va notify
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B onintr \fR[
|
||
|
.Fl \fR|
|
||
|
.Va label
|
||
|
]
|
||
|
Controls the action of the shell on interrupts.
|
||
|
Without arguments,
|
||
|
restores the default action of the shell on interrupts,
|
||
|
which is to terminate shell scripts or to return to the
|
||
|
terminal command input level.
|
||
|
With
|
||
|
.Sq \-
|
||
|
, causes all interrupts to be ignored.
|
||
|
With
|
||
|
.Va label
|
||
|
, causes the shell to execute a
|
||
|
.Sq goto
|
||
|
.Va label
|
||
|
when an interrupt is received or a child process terminates because it was
|
||
|
interrupted.
|
||
|
.IP "" 8
|
||
|
.Va onintr
|
||
|
is ignored if the shell is running detached and in system
|
||
|
startup files (see
|
||
|
.Va FILES
|
||
|
), where interrupts are disabled anyway.
|
||
|
.TP 8
|
||
|
.B popd \fR[
|
||
|
.Fl p\fR] [
|
||
|
.Fl l\fR] [
|
||
|
.Fl n\fR|
|
||
|
.Fl v\fR] \fR[\fB+
|
||
|
.Va n
|
||
|
]
|
||
|
Without arguments, pops the directory stack and returns to the new top directory.
|
||
|
With a number
|
||
|
.Sq +
|
||
|
.Va n
|
||
|
, discards the
|
||
|
.Va n
|
||
|
'th entry in the stack.
|
||
|
.IP "" 8
|
||
|
Finally, all forms of
|
||
|
.Va popd
|
||
|
print the final directory stack,
|
||
|
just like
|
||
|
.Va dirs
|
||
|
The
|
||
|
.Va pushdsilent
|
||
|
shell variable can be set to
|
||
|
prevent this and the
|
||
|
.Fl p\fR flag can be given to override
|
||
|
.Va pushdsilent
|
||
|
The
|
||
|
.Fl l\fR,
|
||
|
.Fl n\fR and
|
||
|
.Fl v\fR flags have the same effect on
|
||
|
.Va popd
|
||
|
as on
|
||
|
.Va dirs
|
||
|
(+)
|
||
|
.TP 8
|
||
|
.B printenv \fR[
|
||
|
.Va name
|
||
|
] (+)
|
||
|
Prints the names and values of all environment variables or,
|
||
|
with
|
||
|
.Va name
|
||
|
, the value of the environment variable
|
||
|
.Va name
|
||
|
.TP 8
|
||
|
.B pushd \fR[
|
||
|
.Fl p\fR] [
|
||
|
.Fl l\fR] [
|
||
|
.Fl n\fR|
|
||
|
.Fl v\fR] [
|
||
|
.Va name
|
||
|
|\fB+
|
||
|
.Va n
|
||
|
]
|
||
|
Without arguments, exchanges the top two elements of the directory stack.
|
||
|
If
|
||
|
.Va pushdtohome
|
||
|
is set,
|
||
|
.Va pushd
|
||
|
without arguments does
|
||
|
.Sq pushd ~
|
||
|
,
|
||
|
like
|
||
|
.Va cd
|
||
|
(+)
|
||
|
With
|
||
|
.Va name
|
||
|
, pushes the current working directory onto the directory
|
||
|
stack and changes to
|
||
|
.Va name
|
||
|
If
|
||
|
.Va name
|
||
|
is
|
||
|
.Sq \-
|
||
|
it is interpreted as the previous working directory
|
||
|
(see
|
||
|
.Va Filename substitution
|
||
|
).
|
||
|
(+)
|
||
|
If
|
||
|
.Va dunique
|
||
|
is set,
|
||
|
.Va pushd
|
||
|
removes any instances of
|
||
|
.Va name
|
||
|
from the stack before pushing it onto the stack.
|
||
|
(+)
|
||
|
With a number
|
||
|
.Sq +
|
||
|
.Va n
|
||
|
, rotates the
|
||
|
.Va n
|
||
|
th element of the
|
||
|
directory stack around to be the top element and changes to it.
|
||
|
If
|
||
|
.Va dextract
|
||
|
is set, however,
|
||
|
.Sq pushd +
|
||
|
.Va n
|
||
|
extracts the
|
||
|
.Va n
|
||
|
th
|
||
|
directory, pushes it onto the top of the stack and changes to it.
|
||
|
(+)
|
||
|
.IP "" 8
|
||
|
Finally, all forms of
|
||
|
.Va pushd
|
||
|
print the final directory stack,
|
||
|
just like
|
||
|
.Va dirs
|
||
|
The
|
||
|
.Va pushdsilent
|
||
|
shell variable can be set to
|
||
|
prevent this and the
|
||
|
.Fl p\fR flag can be given to override
|
||
|
.Va pushdsilent
|
||
|
The
|
||
|
.Fl l\fR,
|
||
|
.Fl n\fR and
|
||
|
.Fl v\fR flags have the same effect on
|
||
|
.Va pushd
|
||
|
as on
|
||
|
.Va dirs
|
||
|
(+)
|
||
|
.TP 8
|
||
|
.B rehash
|
||
|
Causes the internal hash table of the contents of the
|
||
|
directories in the
|
||
|
.Va path
|
||
|
variable to be recomputed.
|
||
|
This is
|
||
|
needed if the
|
||
|
.Va autorehash
|
||
|
shell variable is not set and new
|
||
|
commands are added to directories in
|
||
|
.Va path
|
||
|
while you are logged
|
||
|
in.
|
||
|
With
|
||
|
.Va autorehash
|
||
|
, a new command will be found
|
||
|
automatically, except in the special case where another command of
|
||
|
the same name which is located in a different directory already
|
||
|
exists in the hash table.
|
||
|
Also flushes the cache of home directories
|
||
|
built by tilde expansion.
|
||
|
.TP 8
|
||
|
.B repeat \fIcount command
|
||
|
The specified
|
||
|
.Va command
|
||
|
,
|
||
|
which is subject to the same restrictions as the
|
||
|
.Va command
|
||
|
in the one line
|
||
|
.Va if
|
||
|
statement above, is executed
|
||
|
.Va count
|
||
|
times.
|
||
|
I/O redirections occur exactly once, even if
|
||
|
.Va count
|
||
|
is 0.
|
||
|
.TP 8
|
||
|
.B rootnode //
|
||
|
.Va nodename
|
||
|
(+)
|
||
|
Changes the rootnode to //
|
||
|
.Va nodename
|
||
|
, so that
|
||
|
.Sq /
|
||
|
will be interpreted
|
||
|
as
|
||
|
.Sq //
|
||
|
.Va nodename
|
||
|
(Domain/OS only)
|
||
|
.Pp
|
||
|
.B sched \fR(+)
|
||
|
.br
|
||
|
.B sched \fR[
|
||
|
.Va +
|
||
|
]
|
||
|
.Va hh:mm command
|
||
|
\fR(+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B sched \-
|
||
|
.Va n
|
||
|
(+)
|
||
|
The first form prints the scheduled-event list.
|
||
|
The
|
||
|
.Va sched
|
||
|
shell variable may be set to define the format in which
|
||
|
the scheduled-event list is printed.
|
||
|
The second form adds
|
||
|
.Va command
|
||
|
to the scheduled-event list.
|
||
|
For example,
|
||
|
.PD
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> sched 11:00 echo It\e's eleven o\e'clock.
|
||
|
.Pp
|
||
|
causes the shell to echo
|
||
|
.Sq It's eleven o'clock .
|
||
|
at 11 AM.
|
||
|
The time may be in 12-hour AM/PM format
|
||
|
.IP "" 4
|
||
|
.\" TODO
|
||
|
> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
|
||
|
.Pp
|
||
|
or may be relative to the current time:
|
||
|
.IP "" 4
|
||
|
> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
|
||
|
.Pp
|
||
|
A relative time specification may not use AM/PM format.
|
||
|
The third form removes item
|
||
|
.Va n
|
||
|
from the event list:
|
||
|
.Bd -literal -offset indent
|
||
|
> sched
|
||
|
1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
|
||
|
2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: >
|
||
|
> sched \-2
|
||
|
> sched
|
||
|
1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
|
||
|
.Ed
|
||
|
.Pp
|
||
|
A command in the scheduled-event list is executed just before the first
|
||
|
prompt is printed after the time when the command is scheduled.
|
||
|
It is possible to miss the exact time when the command is to be run, but
|
||
|
an overdue command will execute at the next prompt.
|
||
|
A command which comes due while the shell
|
||
|
is waiting for user input is executed immediately.
|
||
|
However, normal operation of an already-running command will not
|
||
|
be interrupted so that a scheduled-event list element may be run.
|
||
|
.Pp
|
||
|
This mechanism is similar to, but not the same as, the
|
||
|
.Va at
|
||
|
(1)
|
||
|
command on some Unix systems.
|
||
|
Its major disadvantage is that it may not run a command at exactly the
|
||
|
specified time.
|
||
|
Its major advantage is that because
|
||
|
.Va sched
|
||
|
runs directly from
|
||
|
the shell, it has access to shell variables and other structures.
|
||
|
This provides a mechanism for changing one's working environment
|
||
|
based on the time of day.
|
||
|
.RE
|
||
|
.Pp
|
||
|
.B set
|
||
|
.br
|
||
|
.B set
|
||
|
.Va name
|
||
|
...
|
||
|
.br
|
||
|
.B set
|
||
|
.Va name
|
||
|
\fB=
|
||
|
.Va word
|
||
|
...
|
||
|
.br
|
||
|
.B set [\-r] [\-f|\-l]
|
||
|
.Va name
|
||
|
\fB=(\fIwordlist
|
||
|
.Va )
|
||
|
... (+)
|
||
|
.br
|
||
|
.B set
|
||
|
.Va name[index]
|
||
|
\fB=
|
||
|
.Va word
|
||
|
...
|
||
|
.br
|
||
|
.B set \-r \fR(+)
|
||
|
.br
|
||
|
.B set \-r
|
||
|
.Va name
|
||
|
... (+)
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B set \-r
|
||
|
.Va name
|
||
|
\fB=
|
||
|
.Va word
|
||
|
... (+)
|
||
|
The first form of the command prints the value of all shell variables.
|
||
|
Variables which contain more than a single word print as a
|
||
|
parenthesized word list.
|
||
|
The second form sets
|
||
|
.Va name
|
||
|
to the null string.
|
||
|
The third form sets
|
||
|
.Va name
|
||
|
to the single
|
||
|
.Va word
|
||
|
The fourth form sets
|
||
|
.Va name
|
||
|
to the list of words in
|
||
|
.Va wordlist
|
||
|
In all cases the value is command and filename expanded.
|
||
|
If
|
||
|
.Fl r\fR is specified, the value is set read-only.
|
||
|
If
|
||
|
.Fl f\fR or
|
||
|
.Fl l\fR are specified, set only unique words keeping their order.
|
||
|
.Fl f\fR prefers the first occurrence of a word, and
|
||
|
.Fl l\fR the last.
|
||
|
The fifth form sets the
|
||
|
.Va index
|
||
|
'th component of
|
||
|
.Va name
|
||
|
to
|
||
|
.Va word
|
||
|
;
|
||
|
this component must already exist.
|
||
|
The sixth form lists only the names of all shell variables that are read-only.
|
||
|
The seventh form makes
|
||
|
.Va name
|
||
|
read-only, whether or not it has a value.
|
||
|
The eighth form is the same as the third form, but
|
||
|
make
|
||
|
.Va name
|
||
|
read-only at the same time.
|
||
|
.PD
|
||
|
.IP "" 8
|
||
|
These arguments can be repeated to set and/or make read-only multiple variables
|
||
|
in a single set command.
|
||
|
Note, however, that variable expansion
|
||
|
happens for all arguments before any setting occurs.
|
||
|
Note also that
|
||
|
.Sq =
|
||
|
can
|
||
|
be adjacent to both
|
||
|
.Va name
|
||
|
and
|
||
|
.Va word
|
||
|
or separated from both by
|
||
|
whitespace, but cannot be adjacent to only one or the other.
|
||
|
See also the
|
||
|
.Va unset
|
||
|
builtin command.
|
||
|
.TP 8
|
||
|
.B setenv \fR[
|
||
|
.Va name
|
||
|
[
|
||
|
.Va value
|
||
|
]]
|
||
|
Without arguments, prints the names and values of all environment variables.
|
||
|
Given
|
||
|
.Va name
|
||
|
, sets the environment variable
|
||
|
.Va name
|
||
|
to
|
||
|
.Va value
|
||
|
or, without
|
||
|
.Va value
|
||
|
, to the null string.
|
||
|
.TP 8
|
||
|
.B setpath
|
||
|
.Va path
|
||
|
(+)
|
||
|
Equivalent to
|
||
|
.Va setpath
|
||
|
(1).
|
||
|
(Mach only)
|
||
|
.TP 8
|
||
|
.B setspath\fR LOCAL|
|
||
|
.Va site
|
||
|
|
|
||
|
.Va cpu
|
||
|
...
|
||
|
(+)
|
||
|
Sets the system execution path.
|
||
|
(TCF only)
|
||
|
.TP 8
|
||
|
.B settc
|
||
|
.Va cap value
|
||
|
(+)
|
||
|
Tells the shell to believe that the terminal capability
|
||
|
.Va cap
|
||
|
(as defined in
|
||
|
.Va termcap
|
||
|
(5)) has the value
|
||
|
.Va value
|
||
|
No sanity checking is done.
|
||
|
Concept terminal users may have to
|
||
|
.Sq settc xn no
|
||
|
to get proper
|
||
|
wrapping at the rightmost column.
|
||
|
.TP 8
|
||
|
.B setty \fR[
|
||
|
.Fl d\fR|
|
||
|
.Fl q\fR|
|
||
|
.Fl x\fR] [
|
||
|
.Fl a\fR] [[
|
||
|
.Va +
|
||
|
|
|
||
|
.Fl \fR]
|
||
|
.Va mode
|
||
|
] (+)
|
||
|
Controls which tty modes (see
|
||
|
.Va Terminal management
|
||
|
)
|
||
|
the shell does not allow to change.
|
||
|
.Fl d\fR,
|
||
|
.Fl q\fR or
|
||
|
.Fl x\fR tells
|
||
|
.Va setty
|
||
|
to act
|
||
|
on the
|
||
|
.Sq edit
|
||
|
,
|
||
|
.Sq quote
|
||
|
or
|
||
|
.Sq execute
|
||
|
set of tty modes respectively; without
|
||
|
.Fl d\fR,
|
||
|
.Fl q\fR or
|
||
|
.Fl x\fR,
|
||
|
.Sq execute
|
||
|
is used.
|
||
|
.IP "" 8
|
||
|
Without other arguments,
|
||
|
.Va setty
|
||
|
lists the modes in the chosen set
|
||
|
which are fixed on (`+mode') or off (`\-mode').
|
||
|
The available modes, and thus the display, vary from system to system.
|
||
|
With
|
||
|
.Fl a\fR, lists all tty modes in the chosen set
|
||
|
whether or not they are fixed.
|
||
|
With \fB+
|
||
|
.Va mode
|
||
|
,
|
||
|
.Fl
|
||
|
.Va mode
|
||
|
or
|
||
|
.Va mode
|
||
|
, fixes
|
||
|
.Va mode
|
||
|
on or off
|
||
|
or removes control from
|
||
|
.Va mode
|
||
|
in the chosen set.
|
||
|
For example,
|
||
|
.Sq setty +echok echoe
|
||
|
fixes
|
||
|
.Sq echok
|
||
|
mode on and allows commands
|
||
|
to turn
|
||
|
.Sq echoe
|
||
|
mode on or off, both when the shell is executing commands.
|
||
|
.TP 8
|
||
|
.B setxvers\fR [
|
||
|
.Va string
|
||
|
] (+)
|
||
|
Set the experimental version prefix to
|
||
|
.Va string
|
||
|
, or removes it
|
||
|
if
|
||
|
.Va string
|
||
|
is omitted.
|
||
|
(TCF only)
|
||
|
.TP 8
|
||
|
.B shift \fR[
|
||
|
.Va variable
|
||
|
]
|
||
|
Without arguments, discards
|
||
|
.Va argv
|
||
|
[1] and shifts the members of
|
||
|
.Va argv
|
||
|
to the left.
|
||
|
It is an error for
|
||
|
.Va argv
|
||
|
not to be set or to have
|
||
|
less than one word as value.
|
||
|
With
|
||
|
.Va variable
|
||
|
, performs the
|
||
|
same function on
|
||
|
.Va variable
|
||
|
.TP 8
|
||
|
.B source \fR[
|
||
|
.Fl h\fR]
|
||
|
.Va name
|
||
|
[
|
||
|
.Va args
|
||
|
...]
|
||
|
The shell reads and executes commands from
|
||
|
.Va name
|
||
|
The commands are not placed on the history list.
|
||
|
If any
|
||
|
.Va args
|
||
|
are given, they are placed in
|
||
|
.Va argv
|
||
|
(+)
|
||
|
.Va source
|
||
|
commands may be nested;
|
||
|
if they are nested too deeply the shell may run out of file descriptors.
|
||
|
An error in a
|
||
|
.Va source
|
||
|
at any level terminates all nested
|
||
|
.Va source
|
||
|
commands.
|
||
|
With
|
||
|
.Fl h\fR, commands are placed on the history list instead of being
|
||
|
executed, much like
|
||
|
.Sq history \-L
|
||
|
.TP 8
|
||
|
.B stop \fB%
|
||
|
.Va job
|
||
|
|
|
||
|
.Va pid
|
||
|
...
|
||
|
Stops the specified jobs or processes which are executing in the background.
|
||
|
.Va job
|
||
|
may be a number, a string,
|
||
|
.Sq
|
||
|
,
|
||
|
.Sq %
|
||
|
,
|
||
|
.Sq +
|
||
|
or
|
||
|
.Sq \-
|
||
|
as described
|
||
|
under
|
||
|
.Va Jobs
|
||
|
There is no default
|
||
|
.Va job
|
||
|
; saying just
|
||
|
.Sq stop
|
||
|
does not stop
|
||
|
the current job.
|
||
|
.TP 8
|
||
|
.B suspend
|
||
|
Causes the shell to stop in its tracks, much as if it had
|
||
|
been sent a stop signal with
|
||
|
.Va ^Z
|
||
|
This is most often used to
|
||
|
stop shells started by
|
||
|
.Va su
|
||
|
(1).
|
||
|
.Pp
|
||
|
.B switch (\fIstring\fB)
|
||
|
.br
|
||
|
.B case \fIstr1\fB:
|
||
|
.PD 0
|
||
|
.IP "" 4
|
||
|
\&...
|
||
|
.br
|
||
|
.B breaksw
|
||
|
.Pp
|
||
|
\&...
|
||
|
.Pp
|
||
|
.B default:
|
||
|
.IP "" 4
|
||
|
\&...
|
||
|
.br
|
||
|
.B breaksw
|
||
|
.TP 8
|
||
|
.B endsw
|
||
|
Each case label is successively matched, against the
|
||
|
specified
|
||
|
.Va string
|
||
|
which is first command and filename expanded.
|
||
|
The file metacharacters
|
||
|
.Sq *
|
||
|
,
|
||
|
.Sq \&?
|
||
|
and
|
||
|
.Sq [...]
|
||
|
may be used
|
||
|
in the case labels, which are variable expanded.
|
||
|
If none
|
||
|
of the labels match before a
|
||
|
.Sq 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
|
||
|
.Va breaksw
|
||
|
causes execution to continue
|
||
|
after the
|
||
|
.Va 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
|
||
|
.Va endsw
|
||
|
.PD
|
||
|
.TP 8
|
||
|
.B telltc \fR(+)
|
||
|
Lists the values of all terminal capabilities (see
|
||
|
.Va termcap
|
||
|
(5)).
|
||
|
.TP 8
|
||
|
.B termname \fR[
|
||
|
.Va terminal type
|
||
|
] \fR(+)
|
||
|
Tests if
|
||
|
.Va terminal type
|
||
|
(or the current value of
|
||
|
.Va TERM
|
||
|
if no
|
||
|
.Va terminal type
|
||
|
is given) has an entry in the hosts termcap(5) or
|
||
|
terminfo(5) database. Prints the terminal type to stdout and returns 0
|
||
|
if an entry is present otherwise returns 1.
|
||
|
.TP 8
|
||
|
.B time \fR[
|
||
|
.Va command
|
||
|
]
|
||
|
Executes
|
||
|
.Va command
|
||
|
(which must be a simple command, not an alias,
|
||
|
a pipeline, a command list or a parenthesized command list)
|
||
|
and prints a time summary as described under the
|
||
|
.Va time
|
||
|
variable.
|
||
|
If necessary, an extra shell is created to print the time statistic when
|
||
|
the command completes.
|
||
|
Without
|
||
|
.Va command
|
||
|
, prints a time summary for the current shell and its
|
||
|
children.
|
||
|
.TP 8
|
||
|
.B umask \fR[
|
||
|
.Va value
|
||
|
]
|
||
|
Sets the file creation mask to
|
||
|
.Va value
|
||
|
, which is given in octal.
|
||
|
Common values for the mask are
|
||
|
002, giving all access to the group and read and execute access to others, and
|
||
|
022, giving read and execute access to the group and others.
|
||
|
Without
|
||
|
.Va value
|
||
|
, prints the current file creation mask.
|
||
|
.TP 8
|
||
|
.B unalias
|
||
|
.Va pattern
|
||
|
.br
|
||
|
Removes all aliases whose names match
|
||
|
.Va pattern
|
||
|
`unalias *' thus removes all aliases.
|
||
|
It is not an error for nothing to be
|
||
|
.Va unalias
|
||
|
ed.
|
||
|
.TP 8
|
||
|
.B uncomplete
|
||
|
.Va pattern
|
||
|
(+)
|
||
|
Removes all completions whose names match
|
||
|
.Va pattern
|
||
|
`uncomplete *' thus removes all completions.
|
||
|
It is not an error for nothing to be
|
||
|
.Va uncomplete
|
||
|
d.
|
||
|
.TP 8
|
||
|
.B unhash
|
||
|
Disables use of the internal hash table to speed location of
|
||
|
executed programs.
|
||
|
.TP 8
|
||
|
.B universe
|
||
|
.Va universe
|
||
|
(+)
|
||
|
Sets the universe to
|
||
|
.Va universe
|
||
|
(Masscomp/RTU only)
|
||
|
.TP 8
|
||
|
.B unlimit \fR[
|
||
|
.Fl hf\fR] [
|
||
|
.Va resource
|
||
|
]
|
||
|
Removes the limitation on
|
||
|
.Va resource
|
||
|
or, if no
|
||
|
.Va resource
|
||
|
is
|
||
|
specified, all
|
||
|
.Va resource
|
||
|
limitations.
|
||
|
With
|
||
|
.Fl h\fR, the corresponding hard limits are removed.
|
||
|
Only the super-user may do this.
|
||
|
Note that
|
||
|
.Va unlimit
|
||
|
may not exit successful, since most systems
|
||
|
do not allow
|
||
|
.Va descriptors
|
||
|
to be unlimited.
|
||
|
With
|
||
|
.Fl f\fR errors are ignored.
|
||
|
.TP 8
|
||
|
.B unset \fIpattern
|
||
|
Removes all variables whose names match
|
||
|
.Va pattern
|
||
|
, unless they are read-only.
|
||
|
`unset *' thus removes all variables unless they are read-only;
|
||
|
this is a bad idea.
|
||
|
It is not an error for nothing to be
|
||
|
.Va unset
|
||
|
.TP 8
|
||
|
.B unsetenv \fIpattern
|
||
|
Removes all environment variables whose names match
|
||
|
.Va pattern
|
||
|
`unsetenv *' thus removes all environment variables;
|
||
|
this is a bad idea.
|
||
|
It is not an error for nothing to be
|
||
|
.Va unsetenv
|
||
|
ed.
|
||
|
.TP 8
|
||
|
.B ver \fR[
|
||
|
.Va systype
|
||
|
[
|
||
|
.Va command
|
||
|
]] (+)
|
||
|
Without arguments, prints
|
||
|
.Va SYSTYPE
|
||
|
With
|
||
|
.Va systype
|
||
|
, sets
|
||
|
.Va SYSTYPE
|
||
|
to
|
||
|
.Va systype
|
||
|
With
|
||
|
.Va systype
|
||
|
and
|
||
|
.Va command
|
||
|
, executes
|
||
|
.Va command
|
||
|
under
|
||
|
.Va systype
|
||
|
.Va systype
|
||
|
may be
|
||
|
.Sq bsd4.3
|
||
|
or
|
||
|
.Sq sys5.3
|
||
|
(Domain/OS only)
|
||
|
.TP 8
|
||
|
.B wait
|
||
|
The shell waits for all background jobs.
|
||
|
If the shell is interactive, an
|
||
|
interrupt will disrupt the wait and cause the shell to print the names and job
|
||
|
numbers of all outstanding jobs.
|
||
|
.TP 8
|
||
|
.B warp
|
||
|
.Va universe
|
||
|
(+)
|
||
|
Sets the universe to
|
||
|
.Va universe
|
||
|
(Convex/OS only)
|
||
|
.TP 8
|
||
|
.B watchlog \fR(+)
|
||
|
An alternate name for the
|
||
|
.Va log
|
||
|
builtin command (q.v.).
|
||
|
Available only if the shell was so compiled;
|
||
|
see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B where
|
||
|
.Va command
|
||
|
(+)
|
||
|
Reports all known instances of
|
||
|
.Va command
|
||
|
, including aliases, builtins and
|
||
|
executables in
|
||
|
.Va path
|
||
|
.TP 8
|
||
|
.B which\fR
|
||
|
.Va command
|
||
|
(+)
|
||
|
Displays the command that will be executed by the shell after substitutions,
|
||
|
.Va path
|
||
|
searching, etc.
|
||
|
The builtin command is just like
|
||
|
.Va which
|
||
|
(1), but it correctly reports
|
||
|
.Nm
|
||
|
aliases and builtins and is 10 to 100 times faster.
|
||
|
See also the
|
||
|
.Va which-command
|
||
|
editor command.
|
||
|
.Pp
|
||
|
.B while (\fIexpr
|
||
|
.Va )
|
||
|
.br
|
||
|
\&...
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
.B end
|
||
|
Executes the commands between the
|
||
|
.Va while
|
||
|
and the matching
|
||
|
.Va end
|
||
|
while
|
||
|
.Va expr
|
||
|
(an expression, as described under
|
||
|
.Va Expressions
|
||
|
)
|
||
|
evaluates non-zero.
|
||
|
.Va while
|
||
|
and
|
||
|
.Va end
|
||
|
must appear alone on their input lines.
|
||
|
.Va break
|
||
|
and
|
||
|
.Va continue
|
||
|
may be used to terminate or continue the
|
||
|
loop prematurely.
|
||
|
If the input is a terminal, the user is prompted the first time
|
||
|
through the loop as with
|
||
|
.Va foreach
|
||
|
.PD
|
||
|
.Ss "Special aliases (+)"
|
||
|
If set, each of these aliases executes automatically at the indicated time.
|
||
|
They are all initially undefined.
|
||
|
.TP 8
|
||
|
.B beepcmd
|
||
|
Runs when the shell wants to ring the terminal bell.
|
||
|
.TP 8
|
||
|
.B cwdcmd
|
||
|
Runs after every change of working directory.
|
||
|
For example, if the user is
|
||
|
working on an X window system using
|
||
|
.Va xterm
|
||
|
(1) and a re-parenting window
|
||
|
manager that supports title bars such as
|
||
|
.Va twm
|
||
|
(1) and does
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd ^G"'
|
||
|
.Pp
|
||
|
then the shell will change the title of the running
|
||
|
.Va xterm
|
||
|
(1)
|
||
|
to be the name of the host, a colon, and the full current working directory.
|
||
|
A fancier way to do that is
|
||
|
.IP "" 4
|
||
|
> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
|
||
|
.Pp
|
||
|
This will put the hostname and working directory on the title bar but
|
||
|
only the hostname in the icon manager menu.
|
||
|
.Pp
|
||
|
Note that putting a
|
||
|
.Va cd
|
||
|
,
|
||
|
.Va pushd
|
||
|
or
|
||
|
.Va popd
|
||
|
in
|
||
|
.Va cwdcmd
|
||
|
may cause an infinite loop.
|
||
|
It is the author's opinion that anyone doing
|
||
|
so will get what they deserve.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B jobcmd
|
||
|
Runs before each command gets executed, or when the command changes state.
|
||
|
This is similar to
|
||
|
.Va postcmd
|
||
|
, but it does not print builtins.
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> alias jobcmd 'echo \-n "^[]2\e;\e!#:q^G"'
|
||
|
.Pp
|
||
|
then executing
|
||
|
.Va vi foo.c
|
||
|
will put the command string in the xterm title bar.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B helpcommand
|
||
|
Invoked by the
|
||
|
.Va run-help
|
||
|
editor command.
|
||
|
The command name for which help
|
||
|
is sought is passed as sole argument.
|
||
|
For example, if one does
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> alias helpcommand '\e!:1 --help'
|
||
|
.Pp
|
||
|
then the help display of the command itself will be invoked, using the GNU
|
||
|
help calling convention.
|
||
|
Currently there is no easy way to account for various calling conventions (e.g.,
|
||
|
the customary Unix
|
||
|
.Sq -h
|
||
|
), except by using a table of many commands.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B periodic
|
||
|
Runs every
|
||
|
.Va tperiod
|
||
|
minutes.
|
||
|
This provides a convenient means for
|
||
|
checking on common but infrequent changes such as new mail.
|
||
|
For example,
|
||
|
if one does
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> set tperiod = 30
|
||
|
.br
|
||
|
> alias periodic checknews
|
||
|
.Pp
|
||
|
then the
|
||
|
.Va checknews
|
||
|
(1) program runs every 30 minutes.
|
||
|
If
|
||
|
.Va periodic
|
||
|
is set but
|
||
|
.Va tperiod
|
||
|
is unset or set to 0,
|
||
|
.Va periodic
|
||
|
behaves like
|
||
|
.Va precmd
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B precmd
|
||
|
Runs just before each prompt is printed.
|
||
|
For example, if one does
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> alias precmd date
|
||
|
.Pp
|
||
|
then
|
||
|
.Va date
|
||
|
(1) runs just before the shell prompts for each command.
|
||
|
There are no limits on what
|
||
|
.Va precmd
|
||
|
can be set to do, but discretion
|
||
|
should be used.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B postcmd
|
||
|
Runs before each command gets executed.
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> alias postcmd 'echo \-n "^[]2\e;\e!#:q^G"'
|
||
|
.Pp
|
||
|
then executing
|
||
|
.Va vi foo.c
|
||
|
will put the command string in the xterm title bar.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B shell
|
||
|
Specifies the interpreter for executable scripts which do not themselves
|
||
|
specify an interpreter.
|
||
|
The first word should be a full path name to the
|
||
|
desired interpreter (e.g.,
|
||
|
.Sq /bin/csh
|
||
|
or
|
||
|
.Sq /usr/local/bin/tcsh
|
||
|
).
|
||
|
.Ss "Special shell variables"
|
||
|
The variables described in this section have special meaning to the shell.
|
||
|
.Pp
|
||
|
The shell sets
|
||
|
.Va addsuffix ,
|
||
|
.Va argv ,
|
||
|
.Va autologout ,
|
||
|
.Va csubstnonl ,
|
||
|
.Va command ,
|
||
|
.Va echo_style ,
|
||
|
.Va edit ,
|
||
|
.Va gid ,
|
||
|
.Va group ,
|
||
|
.Va home ,
|
||
|
.Va loginsh ,
|
||
|
.Va oid ,
|
||
|
.Va path ,
|
||
|
.Va prompt ,
|
||
|
.Va prompt2 ,
|
||
|
.Va prompt3 ,
|
||
|
.Va shell ,
|
||
|
.Va shlvl ,
|
||
|
.Va tcsh ,
|
||
|
.Va term ,
|
||
|
.Va tty ,
|
||
|
.Va uid ,
|
||
|
.Va user
|
||
|
and
|
||
|
.Va version
|
||
|
at
|
||
|
startup; they do not change thereafter unless changed by the user.
|
||
|
The shell updates
|
||
|
.Va cwd ,
|
||
|
.Va dirstack ,
|
||
|
.Va owd
|
||
|
and
|
||
|
.Va status
|
||
|
when necessary,
|
||
|
and sets
|
||
|
.Va logout
|
||
|
on logout.
|
||
|
.Pp
|
||
|
The shell synchronizes
|
||
|
.Va group ,
|
||
|
.Va home ,
|
||
|
.Va path ,
|
||
|
.Va shlvl ,
|
||
|
.Va term and
|
||
|
.Va user
|
||
|
with the environment variables of the same names:
|
||
|
whenever the environment variable changes the shell changes the corresponding
|
||
|
shell variable to match (unless the shell variable is read-only) and vice
|
||
|
versa.
|
||
|
Note that although
|
||
|
.Va cwd
|
||
|
and
|
||
|
.Va PWD
|
||
|
have identical meanings, they
|
||
|
are not synchronized in this manner, and that the shell automatically
|
||
|
converts between the different formats of
|
||
|
.Va path
|
||
|
and
|
||
|
.Va PATH
|
||
|
.TP 8
|
||
|
.B addsuffix \fR(+)
|
||
|
If set, filename completion adds
|
||
|
.Sq /
|
||
|
to the end of directories and a space
|
||
|
to the end of normal files when they are matched exactly.
|
||
|
Set by default.
|
||
|
.TP 8
|
||
|
.B afsuser \fR(+)
|
||
|
If set,
|
||
|
.Va autologout
|
||
|
's autolock feature uses its value instead of
|
||
|
the local username for kerberos authentication.
|
||
|
.TP 8
|
||
|
.B ampm \fR(+)
|
||
|
If set, all times are shown in 12-hour AM/PM format.
|
||
|
.TP 8
|
||
|
.B anyerror \fR(+)
|
||
|
This variable selects what is propagated to the value of the
|
||
|
.Va status
|
||
|
variable. For more information see the description of the
|
||
|
.Va status
|
||
|
variable below.
|
||
|
.TP 8
|
||
|
.B argv
|
||
|
The arguments to the shell.
|
||
|
Positional parameters are taken from
|
||
|
.Va argv
|
||
|
,
|
||
|
i.e.,
|
||
|
.Sq $1
|
||
|
is replaced by
|
||
|
.Sq $argv[1]
|
||
|
, etc.
|
||
|
Set by default, but usually empty in interactive shells.
|
||
|
.TP 8
|
||
|
.B autocorrect \fR(+)
|
||
|
If set, the
|
||
|
.Va spell-word
|
||
|
editor command is invoked automatically before
|
||
|
each completion attempt.
|
||
|
.TP 8
|
||
|
.B autoexpand \fR(+)
|
||
|
If set, the
|
||
|
.Va expand-history
|
||
|
editor command is invoked automatically
|
||
|
before each completion attempt. If this is set to
|
||
|
.Va onlyhistory
|
||
|
, then
|
||
|
only history will be expanded and a second completion will expand filenames.
|
||
|
.TP 8
|
||
|
.B autolist \fR(+)
|
||
|
If set, possibilities are listed after an ambiguous completion.
|
||
|
If set to
|
||
|
.Sq ambiguous
|
||
|
, possibilities are listed only when no new
|
||
|
characters are added by completion.
|
||
|
.TP 8
|
||
|
.B autologout \fR(+)
|
||
|
The first word is the number of minutes of inactivity before automatic
|
||
|
logout.
|
||
|
The optional second word is the number of minutes of inactivity
|
||
|
before automatic locking.
|
||
|
When the shell automatically logs out, it prints
|
||
|
.Sq auto-logout
|
||
|
, sets the
|
||
|
variable
|
||
|
.Va logout
|
||
|
to
|
||
|
.Sq automatic
|
||
|
and exits.
|
||
|
When the shell automatically locks, the user is required to enter his password
|
||
|
to continue working.
|
||
|
Five incorrect attempts result in automatic logout.
|
||
|
Set to
|
||
|
.Sq 60
|
||
|
(automatic logout after 60 minutes, and no locking) by default
|
||
|
in login and superuser shells, but not if the shell thinks it is running
|
||
|
under a window system (i.e., the
|
||
|
.Va DISPLAY
|
||
|
environment variable is set),
|
||
|
the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
|
||
|
.Va version
|
||
|
shell variable).
|
||
|
See also the
|
||
|
.Va afsuser
|
||
|
and
|
||
|
.Va logout
|
||
|
shell variables.
|
||
|
.TP 8
|
||
|
.B autorehash \fR(+)
|
||
|
If set, the internal hash table of the contents of the directories in the
|
||
|
.Va path
|
||
|
variable will be recomputed if a command is not found in the hash
|
||
|
table.
|
||
|
In addition, the list of available commands will be rebuilt for each
|
||
|
command completion or spelling correction attempt if set to
|
||
|
.Sq complete
|
||
|
or
|
||
|
`correct' respectively; if set to
|
||
|
.Sq always
|
||
|
, this will be done for both
|
||
|
cases.
|
||
|
.TP 8
|
||
|
.B backslash_quote \fR(+)
|
||
|
.\" TODO
|
||
|
If set, backslashes (`\e') always quote
|
||
|
.Sq \e
|
||
|
,
|
||
|
.Sq \&' ,
|
||
|
and
|
||
|
.Sq \&"
|
||
|
This may make
|
||
|
complex quoting tasks easier, but it can cause syntax errors in
|
||
|
.Xr csh 1
|
||
|
scripts.
|
||
|
.TP 8
|
||
|
.B catalog
|
||
|
The file name of the message catalog.
|
||
|
If set, tcsh use
|
||
|
.Sq tcsh.${catalog}
|
||
|
as a message catalog instead of
|
||
|
default
|
||
|
.Sq tcsh
|
||
|
.TP 8
|
||
|
.B cdpath
|
||
|
A list of directories in which
|
||
|
.Va cd
|
||
|
should search for
|
||
|
subdirectories if they aren't found in the current directory.
|
||
|
.TP 8
|
||
|
.B cdtohome \fR(+)
|
||
|
If not set,
|
||
|
.Va cd
|
||
|
requires a directory
|
||
|
.Va name
|
||
|
, and will not go to the
|
||
|
.Va home
|
||
|
directory if it's omitted.
|
||
|
This is set by default.
|
||
|
.TP 8
|
||
|
.B color
|
||
|
If set, it enables color display for the builtin \fBls\-F\fR and it passes
|
||
|
.Fl \-color=auto\fR to
|
||
|
.Va ls
|
||
|
Alternatively, it can be set to only
|
||
|
\fBls\-F\fR or only
|
||
|
.Va ls
|
||
|
to enable color to only one command.
|
||
|
Setting
|
||
|
it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
|
||
|
.TP 8
|
||
|
.B colorcat
|
||
|
If set, it enables color escape sequence for NLS message files.
|
||
|
And display colorful NLS messages.
|
||
|
.TP 8
|
||
|
.B command \fR(+)
|
||
|
If set, the command which was passed to the shell with the
|
||
|
.Va -c
|
||
|
flag (q.v.).
|
||
|
.TP 8
|
||
|
.B compat_expr \fR(+)
|
||
|
If set, the shell will evaluate expressions right to left, like the original
|
||
|
.Xr csh 1
|
||
|
.TP 8
|
||
|
.B complete \fR(+)
|
||
|
If set to
|
||
|
.Sq igncase
|
||
|
, the completion becomes case insensitive.
|
||
|
If set to
|
||
|
.Sq enhance
|
||
|
, completion ignores case and considers
|
||
|
hyphens and underscores to be equivalent; it will also treat
|
||
|
periods, hyphens and underscores (`.',
|
||
|
.Sq \-
|
||
|
and
|
||
|
.Sq _
|
||
|
) as word
|
||
|
separators.
|
||
|
If set to
|
||
|
.Sq Enhance
|
||
|
, completion matches uppercase and underscore
|
||
|
characters explicitly and matches lowercase and hyphens in a
|
||
|
case-insensitive manner; it will treat periods, hyphens and underscores
|
||
|
as word separators.
|
||
|
.TP 8
|
||
|
.B continue \fR(+)
|
||
|
If set to a list of commands, the shell will continue the listed
|
||
|
commands, instead of starting a new one.
|
||
|
.TP 8
|
||
|
.B continue_args \fR(+)
|
||
|
Same as continue, but the shell will execute:
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B correct \fR(+)
|
||
|
If set to
|
||
|
.Sq cmd
|
||
|
, commands are automatically spelling-corrected.
|
||
|
If set to
|
||
|
.Sq complete
|
||
|
, commands are automatically completed.
|
||
|
If set to
|
||
|
.Sq all
|
||
|
, the entire command line is corrected.
|
||
|
.TP 8
|
||
|
.B csubstnonl \fR(+)
|
||
|
If set, newlines and carriage returns in command substitution are
|
||
|
replaced by spaces.
|
||
|
Set by default.
|
||
|
.TP 8
|
||
|
.B cwd
|
||
|
The full pathname of the current directory.
|
||
|
See also the
|
||
|
.Va dirstack
|
||
|
and
|
||
|
.Va owd
|
||
|
shell variables.
|
||
|
.TP 8
|
||
|
.B dextract \fR(+)
|
||
|
If set,
|
||
|
.Sq pushd +
|
||
|
.Va n
|
||
|
extracts the
|
||
|
.Va n
|
||
|
th directory from the directory
|
||
|
stack rather than rotating it to the top.
|
||
|
.TP 8
|
||
|
.B dirsfile \fR(+)
|
||
|
The default location in which
|
||
|
.Sq dirs \-S
|
||
|
and
|
||
|
.Sq dirs \-L
|
||
|
look for
|
||
|
a history file.
|
||
|
If unset,
|
||
|
.Va ~/.cshdirs
|
||
|
is used.
|
||
|
Because only
|
||
|
.Va ~/.tcshrc
|
||
|
is normally sourced before
|
||
|
.Va ~/.cshdirs
|
||
|
,
|
||
|
.Va dirsfile
|
||
|
should be set in
|
||
|
.Va ~/.tcshrc
|
||
|
rather than
|
||
|
.Va ~/.login
|
||
|
.TP 8
|
||
|
.B dirstack \fR(+)
|
||
|
An array of all the directories on the directory stack.
|
||
|
`$dirstack[1]' is the current working directory,
|
||
|
.Sq $dirstack[2]
|
||
|
the first directory on the stack, etc.
|
||
|
Note that the current working directory is
|
||
|
.Sq $dirstack[1]
|
||
|
but
|
||
|
.Sq =0
|
||
|
in
|
||
|
directory stack substitutions, etc.
|
||
|
One can change the stack arbitrarily by setting
|
||
|
.Va dirstack
|
||
|
,
|
||
|
but the first element (the current working directory) is always correct.
|
||
|
See also the
|
||
|
.Va cwd
|
||
|
and
|
||
|
.Va owd
|
||
|
shell variables.
|
||
|
.TP 8
|
||
|
.B dspmbyte \fR(+)
|
||
|
Has an effect iff 'dspm' is listed as part of the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
If set to
|
||
|
.Sq euc
|
||
|
, it enables display and editing EUC-kanji(Japanese) code.
|
||
|
If set to
|
||
|
.Sq sjis
|
||
|
, it enables display and editing Shift-JIS(Japanese) code.
|
||
|
If set to
|
||
|
.Sq big5
|
||
|
, it enables display and editing Big5(Chinese) code.
|
||
|
If set to
|
||
|
.Sq utf8
|
||
|
, it enables display and editing Utf8(Unicode) code.
|
||
|
If set to the following format, it enables display and editing of original
|
||
|
multi-byte code format:
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
> set dspmbyte = 0000....(256 bytes)....0000
|
||
|
.Pp
|
||
|
The table requires
|
||
|
.Va just
|
||
|
256 bytes.
|
||
|
Each character of 256 characters
|
||
|
corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
|
||
|
Each
|
||
|
character
|
||
|
.\" (position in this table?)
|
||
|
is set to number 0,1,2 and 3.
|
||
|
Each number has the following meaning:
|
||
|
.br
|
||
|
0 ... not used for multi-byte characters.
|
||
|
.br
|
||
|
1 ... used for the first byte of a multi-byte character.
|
||
|
.br
|
||
|
2 ... used for the second byte of a multi-byte character.
|
||
|
.br
|
||
|
3 ... used for both the first byte and second byte of a multi-byte character.
|
||
|
.\" SHK: I tried my best to get the following to be grammatically correct.
|
||
|
.\" However, I still don't understand what's going on here.
|
||
|
In the
|
||
|
.\" following example, there are three bytes, but the text seems to refer to
|
||
|
.\" each nybble as a character.
|
||
|
What's going on here? It this 3-byte code
|
||
|
.\" in the table? The text above seems to imply that there are 256
|
||
|
.\" characters/bytes in the table.
|
||
|
If I get some more info on this (perhaps
|
||
|
.\" a complete example), I could fix the text to be grammatically correct.
|
||
|
.\" (steve.kelem@xilinx.com 1999/09/13)
|
||
|
.Pp
|
||
|
Example:
|
||
|
.br
|
||
|
If set to
|
||
|
.Sq 001322
|
||
|
, the first character (means 0x00 of the ASCII code) and
|
||
|
second character (means 0x01 of ASCII code) are set to
|
||
|
.Sq 0
|
||
|
Then, it is not
|
||
|
used for multi-byte characters.
|
||
|
The 3rd character (0x02) is set to '1',
|
||
|
indicating that it is used for the first byte of a multi-byte character.
|
||
|
The 4th character(0x03) is set '3'.
|
||
|
It is used for both the first byte and
|
||
|
the second byte of a multi-byte character.
|
||
|
The 5th and 6th characters
|
||
|
(0x04,0x05) are set to '2', indicating that they are used for the second
|
||
|
byte of a multi-byte character.
|
||
|
.Pp
|
||
|
The GNU fileutils version of ls cannot display multi-byte
|
||
|
filenames without the -N ( --literal ) option.
|
||
|
If you are using
|
||
|
this version, set the second word of dspmbyte to "ls".
|
||
|
If not, for
|
||
|
example, "ls-F -l" cannot display multi-byte filenames.
|
||
|
.Pp
|
||
|
Note:
|
||
|
.br
|
||
|
This variable can only be used if KANJI and DSPMBYTE has been defined at
|
||
|
compile time.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B dunique \fR(+)
|
||
|
If set,
|
||
|
.Va pushd
|
||
|
removes any instances of
|
||
|
.Va name
|
||
|
from the stack before pushing it onto the stack.
|
||
|
.TP 8
|
||
|
.B echo
|
||
|
If set, each command with its arguments is echoed just before it is
|
||
|
executed.
|
||
|
For non-builtin commands all expansions occur before
|
||
|
echoing.
|
||
|
Builtin commands are echoed before command and filename
|
||
|
substitution, because these substitutions are then done selectively.
|
||
|
Set by the
|
||
|
.Fl x\fR command line option.
|
||
|
.TP 8
|
||
|
.B echo_style \fR(+)
|
||
|
The style of the
|
||
|
.Va echo
|
||
|
builtin.
|
||
|
May be set to
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 8
|
||
|
bsd
|
||
|
Don't echo a newline if the first argument is
|
||
|
.Sq \-n ;
|
||
|
the default for
|
||
|
.Xr csh 1
|
||
|
.TP 8
|
||
|
sysv
|
||
|
Recognize backslashed escape sequences in echo strings.
|
||
|
.TP 8
|
||
|
both
|
||
|
Recognize both the
|
||
|
.Sq \-n
|
||
|
flag and backslashed escape sequences; the default
|
||
|
for
|
||
|
.Nm
|
||
|
.TP 8
|
||
|
none
|
||
|
Recognize neither.
|
||
|
.PD
|
||
|
.Pp
|
||
|
Set by default to the local system default.
|
||
|
The BSD and System V
|
||
|
options are described in the
|
||
|
.Va echo
|
||
|
(1) man pages on the appropriate
|
||
|
systems.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B edit \fR(+)
|
||
|
If set, the command-line editor is used.
|
||
|
Set by default in interactive
|
||
|
shells.
|
||
|
.TP 8
|
||
|
.B editors \fR(+)
|
||
|
A list of command names for the
|
||
|
.Va run-fg-editor
|
||
|
editor command to match.
|
||
|
If not set, the
|
||
|
.Va EDITOR
|
||
|
(`ed' if unset) and
|
||
|
.Va VISUAL
|
||
|
(`vi' if unset)
|
||
|
environment variables will be used instead.
|
||
|
.TP 8
|
||
|
.B ellipsis \fR(+)
|
||
|
If set, the
|
||
|
.Sq %c
|
||
|
/`%.' and
|
||
|
.Sq %C
|
||
|
prompt sequences (see the
|
||
|
.Va prompt
|
||
|
shell variable) indicate skipped directories with an ellipsis (`...')
|
||
|
instead of
|
||
|
.Sq /<skipped>
|
||
|
.TP 8
|
||
|
.B euid \fR(+)
|
||
|
The user's effective user ID.
|
||
|
.TP 8
|
||
|
.B euser \fR(+)
|
||
|
The first matching passwd entry name corresponding to the effective user ID.
|
||
|
.TP 8
|
||
|
.B fignore \fR(+)
|
||
|
Lists file name suffixes to be ignored by completion.
|
||
|
.TP 8
|
||
|
.B filec
|
||
|
In
|
||
|
.Nm
|
||
|
, completion is always used and this variable is ignored
|
||
|
by default. If
|
||
|
.B edit
|
||
|
is unset, then the traditional
|
||
|
.Xr csh 1
|
||
|
completion is used.
|
||
|
If set in
|
||
|
.Xr csh 1
|
||
|
, filename completion is used.
|
||
|
.TP 8
|
||
|
.B gid \fR(+)
|
||
|
The user's real group ID.
|
||
|
.TP 8
|
||
|
.B globdot \fR(+)
|
||
|
If set, wild-card glob patterns will match files and directories beginning
|
||
|
with
|
||
|
.Sq .
|
||
|
except for
|
||
|
.Sq .
|
||
|
and
|
||
|
.Sq ..
|
||
|
.TP 8
|
||
|
.B globstar \fR(+)
|
||
|
If set, the
|
||
|
.Sq **
|
||
|
and
|
||
|
.Sq ***
|
||
|
file glob patterns will match any string of
|
||
|
characters including
|
||
|
.Sq /
|
||
|
traversing any existing sub-directories.
|
||
|
(e.g.
|
||
|
`ls **.c' will list all the .c files in the current directory tree).
|
||
|
If used by itself, it will match zero or more sub-directories
|
||
|
(e.g.
|
||
|
.Sq ls /usr/include/**/time.h
|
||
|
will list any file named
|
||
|
.Sq time.h
|
||
|
in the /usr/include directory tree; whereas
|
||
|
.Sq ls /usr/include/**time.h
|
||
|
will match any file in the /usr/include directory tree ending in
|
||
|
.Sq time.h
|
||
|
).
|
||
|
To prevent problems with recursion, the
|
||
|
.Sq **
|
||
|
glob-pattern will not
|
||
|
descend into a symbolic link containing a directory.
|
||
|
To override this,
|
||
|
use
|
||
|
.Sq ***
|
||
|
.TP 8
|
||
|
.B group \fR(+)
|
||
|
The user's group name.
|
||
|
.TP 8
|
||
|
.B highlight
|
||
|
If set, the incremental search match (in
|
||
|
.Va i-search-back
|
||
|
and
|
||
|
.Va i-search-fwd
|
||
|
) and the region between the mark and the cursor are
|
||
|
highlighted in reverse video.
|
||
|
.IP "" 8
|
||
|
Highlighting requires more frequent terminal writes, which introduces extra
|
||
|
overhead. If you care about terminal performance, you may want to leave this
|
||
|
unset.
|
||
|
.TP 8
|
||
|
.B histchars
|
||
|
A string value determining the characters used in \fBHistory
|
||
|
substitution\fR (q.v.).
|
||
|
The first character of its value is used as
|
||
|
the history substitution character, replacing the default character
|
||
|
`!'.
|
||
|
The second character of its value replaces the character
|
||
|
.Sq ^
|
||
|
in
|
||
|
quick substitutions.
|
||
|
.TP 8
|
||
|
.B histdup \fR(+)
|
||
|
Controls handling of duplicate entries in the history list.
|
||
|
If set to
|
||
|
`all' only unique history events are entered in the history list.
|
||
|
If
|
||
|
set to
|
||
|
.Sq prev
|
||
|
and the last history event is the same as the current
|
||
|
command, then the current command is not entered in the history.
|
||
|
If
|
||
|
set to
|
||
|
.Sq erase
|
||
|
and the same event is found in the history list, that
|
||
|
old event gets erased and the current one gets inserted.
|
||
|
Note that the
|
||
|
`prev' and
|
||
|
.Sq all
|
||
|
options renumber history events so there are no gaps.
|
||
|
.TP 8
|
||
|
.B histfile \fR(+)
|
||
|
The default location in which
|
||
|
.Sq history \-S
|
||
|
and
|
||
|
.Sq history \-L
|
||
|
look for
|
||
|
a history file.
|
||
|
If unset,
|
||
|
.Va ~/.history
|
||
|
is used.
|
||
|
.Va histfile
|
||
|
is
|
||
|
useful when sharing the same home directory between different machines,
|
||
|
or when saving separate histories on different terminals.
|
||
|
Because only
|
||
|
.Va ~/.tcshrc
|
||
|
is normally sourced before
|
||
|
.Va ~/.history
|
||
|
,
|
||
|
.Va histfile
|
||
|
should be set in
|
||
|
.Va ~/.tcshrc
|
||
|
rather than
|
||
|
.Va ~/.login
|
||
|
.TP 8
|
||
|
.B histlit \fR(+)
|
||
|
If set, builtin and editor commands and the
|
||
|
.Va savehist
|
||
|
mechanism
|
||
|
use the literal (unexpanded) form of lines in the history list.
|
||
|
See
|
||
|
also the
|
||
|
.Va toggle-literal-history
|
||
|
editor command.
|
||
|
.TP 8
|
||
|
.B history
|
||
|
The first word indicates the number of history events to save.
|
||
|
The
|
||
|
optional second word (+) indicates the format in which history is
|
||
|
printed; if not given,
|
||
|
.Sq %h\et%T\et%R\en
|
||
|
is used.
|
||
|
The format sequences
|
||
|
are described below under
|
||
|
.Va prompt
|
||
|
; note the variable meaning of
|
||
|
`%R'.
|
||
|
Set to
|
||
|
.Sq 100
|
||
|
by default.
|
||
|
.TP 8
|
||
|
.B home
|
||
|
Initialized to the home directory of the invoker.
|
||
|
The filename
|
||
|
expansion of
|
||
|
.Sq
|
||
|
.Va ~
|
||
|
refers to this variable.
|
||
|
.TP 8
|
||
|
.B ignoreeof
|
||
|
If set to the empty string or
|
||
|
.Sq 0
|
||
|
and the input device is a terminal,
|
||
|
the
|
||
|
.Va end-of-file
|
||
|
command (usually generated by the user by typing
|
||
|
`^D' on an empty line) causes the shell to print `Use "exit" to leave
|
||
|
tcsh.' instead of exiting.
|
||
|
This prevents the shell from accidentally
|
||
|
being killed.
|
||
|
Historically this setting exited after 26 successive
|
||
|
EOF's to avoid infinite loops.
|
||
|
If set to a number
|
||
|
.Va n
|
||
|
, the shell
|
||
|
ignores
|
||
|
.Va n - 1
|
||
|
consecutive
|
||
|
.Va end-of-file
|
||
|
s and exits on the
|
||
|
.Va n
|
||
|
th.
|
||
|
(+) If unset,
|
||
|
.Sq 1
|
||
|
is used, i.e., the shell exits on a
|
||
|
single
|
||
|
.Sq ^D
|
||
|
.TP 8
|
||
|
.B implicitcd \fR(+)
|
||
|
If set, the shell treats a directory name typed as a command as though
|
||
|
it were a request to change to that directory.
|
||
|
If set to
|
||
|
.Va verbose
|
||
|
,
|
||
|
the change of directory is echoed to the standard output.
|
||
|
This behavior
|
||
|
is inhibited in non-interactive shell scripts, or for command strings
|
||
|
with more than one word.
|
||
|
Changing directory takes precedence over
|
||
|
executing a like-named command, but it is done after alias
|
||
|
substitutions.
|
||
|
Tilde and variable expansions work as expected.
|
||
|
.TP 8
|
||
|
.B inputmode \fR(+)
|
||
|
If set to
|
||
|
.Sq insert
|
||
|
or
|
||
|
.Sq overwrite
|
||
|
, puts the editor into that input mode
|
||
|
at the beginning of each line.
|
||
|
.TP 8
|
||
|
.B killdup \fR(+)
|
||
|
Controls handling of duplicate entries in the kill ring.
|
||
|
If set to
|
||
|
`all' only unique strings are entered in the kill ring.
|
||
|
If set to
|
||
|
`prev' and the last killed string is the same as the current killed
|
||
|
string, then the current string is not entered in the ring.
|
||
|
If set
|
||
|
to
|
||
|
.Sq erase
|
||
|
and the same string is found in the kill ring, the old
|
||
|
string is erased and the current one is inserted.
|
||
|
.TP 8
|
||
|
.B killring \fR(+)
|
||
|
Indicates the number of killed strings to keep in memory.
|
||
|
Set to
|
||
|
.Sq 30
|
||
|
by default.
|
||
|
If unset or set to less than
|
||
|
.Sq 2
|
||
|
, the shell will only
|
||
|
keep the most recently killed string.
|
||
|
Strings are put in the killring by the editor commands that delete
|
||
|
(kill) strings of text, e.g.
|
||
|
.Va backward-delete-word
|
||
|
,
|
||
|
.Va kill-line
|
||
|
, etc, as well as the
|
||
|
.Va copy-region-as-kill
|
||
|
command.
|
||
|
The
|
||
|
.Va yank
|
||
|
editor command will yank the most recently killed string
|
||
|
into the command-line, while
|
||
|
.Va yank-pop
|
||
|
(see
|
||
|
.Va Editor commands
|
||
|
)
|
||
|
can be used to yank earlier killed strings.
|
||
|
.TP 8
|
||
|
.B listflags \fR(+)
|
||
|
If set to
|
||
|
.Sq x
|
||
|
,
|
||
|
.Sq a
|
||
|
or
|
||
|
.Sq A
|
||
|
, or any combination thereof (e.g.,
|
||
|
.Sq xA
|
||
|
), they
|
||
|
are used as flags to \fIls\-F\fR, making it act like
|
||
|
.Sq ls \-xF
|
||
|
, `ls
|
||
|
\-Fa',
|
||
|
.Sq ls \-FA
|
||
|
or a combination (e.g.,
|
||
|
.Sq ls \-FxA
|
||
|
):
|
||
|
.Sq a
|
||
|
shows all
|
||
|
files (even if they start with a
|
||
|
.Sq .
|
||
|
),
|
||
|
.Sq A
|
||
|
shows all files but
|
||
|
.Sq .
|
||
|
and
|
||
|
`..', and
|
||
|
.Sq x
|
||
|
sorts across instead of down.
|
||
|
If the second word of
|
||
|
.Va listflags
|
||
|
is set, it is used as the path to
|
||
|
.Sq ls(1)
|
||
|
.TP 8
|
||
|
.B listjobs \fR(+)
|
||
|
If set, all jobs are listed when a job is suspended.
|
||
|
If set to
|
||
|
.Sq long
|
||
|
,
|
||
|
the listing is in long format.
|
||
|
.TP 8
|
||
|
.B listlinks \fR(+)
|
||
|
If set, the \fIls\-F\fR builtin command shows the type of file to which
|
||
|
each symbolic link points.
|
||
|
.TP 8
|
||
|
.B listmax \fR(+)
|
||
|
The maximum number of items which the
|
||
|
.Va list-choices
|
||
|
editor command
|
||
|
will list without asking first.
|
||
|
.TP 8
|
||
|
.B listmaxrows \fR(+)
|
||
|
The maximum number of rows of items which the
|
||
|
.Va list-choices
|
||
|
editor
|
||
|
command will list without asking first.
|
||
|
.TP 8
|
||
|
.B loginsh \fR(+)
|
||
|
Set by the shell if it is a login shell.
|
||
|
Setting or unsetting it
|
||
|
within a shell has no effect.
|
||
|
See also
|
||
|
.Va shlvl
|
||
|
.TP 8
|
||
|
.B logout \fR(+)
|
||
|
Set by the shell to
|
||
|
.Sq normal
|
||
|
before a normal logout,
|
||
|
.Sq automatic
|
||
|
before
|
||
|
an automatic logout, and
|
||
|
.Sq hangup
|
||
|
if the shell was killed by a hangup
|
||
|
signal (see
|
||
|
.Va Signal handling
|
||
|
).
|
||
|
See also the
|
||
|
.Va autologout
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B mail
|
||
|
A list of files and directories to check for incoming mail, optionally
|
||
|
preceded by a numeric word.
|
||
|
Before each prompt, if 10 minutes have
|
||
|
passed since the last check, the shell checks each file and says `You
|
||
|
have new mail.' (or, if
|
||
|
.Va mail
|
||
|
contains multiple files, `You have
|
||
|
new mail in
|
||
|
.Va name
|
||
|
.') if the filesize is greater than zero in size
|
||
|
and has a modification time greater than its access time.
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD
|
||
|
.Pp
|
||
|
If you are in a login shell, then no mail file is reported unless it has
|
||
|
been modified after the time the shell has started up, to prevent
|
||
|
redundant notifications.
|
||
|
Most login programs will tell you whether or not
|
||
|
you have mail when you log in.
|
||
|
.Pp
|
||
|
If a file specified in
|
||
|
.Va mail
|
||
|
is a directory, the shell will count each
|
||
|
file within that directory as a separate message, and will report `You have
|
||
|
.Va n
|
||
|
mails.' or
|
||
|
.Sq You have
|
||
|
.Va n
|
||
|
mails in
|
||
|
.Va name
|
||
|
as appropriate.
|
||
|
This functionality is provided primarily for those systems which store mail
|
||
|
in this manner, such as the Andrew Mail System.
|
||
|
.Pp
|
||
|
If the first word of
|
||
|
.Va mail
|
||
|
is numeric it is taken as a different mail
|
||
|
checking interval, in seconds.
|
||
|
.Pp
|
||
|
Under very rare circumstances, the shell may report
|
||
|
.Sq You have mail.
|
||
|
instead
|
||
|
of
|
||
|
.Sq You have new mail.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B matchbeep \fR(+)
|
||
|
If set to
|
||
|
.Sq never
|
||
|
, completion never beeps.
|
||
|
If set to
|
||
|
.Sq nomatch
|
||
|
, it beeps only when there is no match.
|
||
|
If set to
|
||
|
.Sq ambiguous
|
||
|
, it beeps when there are multiple matches.
|
||
|
If set to
|
||
|
.Sq notunique
|
||
|
, it beeps when there is one exact and other longer matches.
|
||
|
If unset,
|
||
|
.Sq ambiguous
|
||
|
is used.
|
||
|
.TP 8
|
||
|
.B nobeep \fR(+)
|
||
|
If set, beeping is completely disabled.
|
||
|
See also
|
||
|
.Va visiblebell
|
||
|
.TP 8
|
||
|
.B noclobber
|
||
|
If set, restrictions are placed on output redirection to insure that files
|
||
|
are not accidentally destroyed and that
|
||
|
.Sq >>
|
||
|
redirections refer to existing
|
||
|
files, as described in the
|
||
|
.Va Input/output
|
||
|
section.
|
||
|
.TP 8
|
||
|
.B noding
|
||
|
If set, disable the printing of
|
||
|
.Sq DING!
|
||
|
in the
|
||
|
.Va prompt
|
||
|
time
|
||
|
specifiers at the change of hour.
|
||
|
.TP 8
|
||
|
.B noglob
|
||
|
If set,
|
||
|
.Va Filename substitution
|
||
|
and
|
||
|
.Va Directory stack substitution
|
||
|
(q.v.) are inhibited.
|
||
|
This is most useful in shell scripts which do not deal
|
||
|
with filenames, or after a list of filenames has been obtained and further
|
||
|
expansions are not desirable.
|
||
|
.TP 8
|
||
|
.B nokanji \fR(+)
|
||
|
If set and the shell supports Kanji (see the
|
||
|
.Va version
|
||
|
shell variable),
|
||
|
it is disabled so that the meta key can be used.
|
||
|
.TP 8
|
||
|
.B nonomatch
|
||
|
If set, a
|
||
|
.Va Filename substitution
|
||
|
or
|
||
|
.Va Directory stack substitution
|
||
|
(q.v.) which does not match any
|
||
|
existing files is left untouched rather than causing an error.
|
||
|
It is still an error for the substitution to be
|
||
|
malformed, e.g.,
|
||
|
.Sq echo [
|
||
|
still gives an error.
|
||
|
.TP 8
|
||
|
.B nostat \fR(+)
|
||
|
A list of directories (or glob-patterns which match directories; see
|
||
|
.Va Filename substitution
|
||
|
) that should not be
|
||
|
.Va stat
|
||
|
(2)ed during a
|
||
|
completion operation.
|
||
|
This is usually used to exclude directories which
|
||
|
take too much time to
|
||
|
.Va stat
|
||
|
(2), for example
|
||
|
.Va /afs
|
||
|
.TP 8
|
||
|
.B notify
|
||
|
If set, the shell announces job completions asynchronously.
|
||
|
The default is to present job completions just before printing a prompt.
|
||
|
.TP 8
|
||
|
.B oid \fR(+)
|
||
|
The user's real organization ID.
|
||
|
(Domain/OS only)
|
||
|
.TP 8
|
||
|
.B owd \fR(+)
|
||
|
The old working directory, equivalent to the
|
||
|
.Sq \-
|
||
|
used by
|
||
|
.Va cd
|
||
|
and
|
||
|
.Va pushd
|
||
|
See also the
|
||
|
.Va cwd
|
||
|
and
|
||
|
.Va dirstack
|
||
|
shell variables.
|
||
|
.TP 8
|
||
|
.B padhour
|
||
|
If set, enable the printing of padding '0' for hours, in 24 and 12 hour
|
||
|
formats.
|
||
|
E.G.: 07:45:42 vs. 7:45:42.
|
||
|
.TP 8
|
||
|
.B parseoctal
|
||
|
To retain compatibily with older versions numeric variables starting with
|
||
|
0 are not interpreted as octal. Setting this variable enables proper octal
|
||
|
parsing.
|
||
|
.TP 8
|
||
|
.B path
|
||
|
A list of directories in which to look for executable commands.
|
||
|
A null word specifies the current directory.
|
||
|
If there is no
|
||
|
.Va path
|
||
|
variable then only full path names will execute.
|
||
|
.Va path
|
||
|
is set by the shell at startup from the
|
||
|
.Va PATH
|
||
|
environment
|
||
|
variable or, if
|
||
|
.Va PATH
|
||
|
does not exist, to a system-dependent default
|
||
|
something like
|
||
|
.Sq (/usr/local/bin /usr/bsd /bin /usr/bin .)
|
||
|
The shell may put
|
||
|
.Sq .
|
||
|
first or last in
|
||
|
.Va path
|
||
|
or omit it entirely
|
||
|
depending on how it was compiled; see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
A shell which is given neither the
|
||
|
.Fl c\fR nor the
|
||
|
.Fl t\fR option
|
||
|
hashes the contents of the directories in
|
||
|
.Va path
|
||
|
after
|
||
|
reading
|
||
|
.Va ~/.tcshrc
|
||
|
and each time
|
||
|
.Va path
|
||
|
is reset.
|
||
|
If one adds a new command to a directory in
|
||
|
.Va path
|
||
|
while the shell
|
||
|
is active, one may need to do a
|
||
|
.Va rehash
|
||
|
for the shell to find it.
|
||
|
.TP 8
|
||
|
.B printexitvalue \fR(+)
|
||
|
If set and an interactive program exits with a non-zero status, the shell
|
||
|
prints
|
||
|
.Sq Exit
|
||
|
.Va status
|
||
|
.TP 8
|
||
|
.B prompt
|
||
|
The string which is printed before reading each command from the terminal.
|
||
|
.Va prompt
|
||
|
may include any of the following formatting sequences (+), which
|
||
|
are replaced by the given information:
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
%/
|
||
|
The current working directory.
|
||
|
.TP 4
|
||
|
%~
|
||
|
The current working directory, but with one's home directory
|
||
|
represented by
|
||
|
.Sq ~
|
||
|
and other users' home directories represented by
|
||
|
`~user' as per
|
||
|
.Va Filename substitution
|
||
|
`~user' substitution
|
||
|
happens only if the shell has already used
|
||
|
.Sq ~
|
||
|
.Va user
|
||
|
in a pathname
|
||
|
in the current session.
|
||
|
.TP 4
|
||
|
%c[[0]
|
||
|
.Va n
|
||
|
], %.[[0]
|
||
|
.Va n
|
||
|
]
|
||
|
The trailing component of the current working directory, or
|
||
|
.Va n
|
||
|
trailing components if a digit
|
||
|
.Va n
|
||
|
is given.
|
||
|
If
|
||
|
.Va n
|
||
|
begins with
|
||
|
.Sq 0
|
||
|
, the number of skipped components precede
|
||
|
the trailing component(s) in the format
|
||
|
.Sq /<
|
||
|
.Va skipped
|
||
|
>trailing
|
||
|
If the
|
||
|
.Va ellipsis
|
||
|
shell variable is set, skipped components
|
||
|
are represented by an ellipsis so the whole becomes
|
||
|
.Sq ...trailing
|
||
|
`~' substitution is done as in
|
||
|
.Sq %~
|
||
|
above, but the
|
||
|
.Sq ~
|
||
|
component
|
||
|
is ignored when counting trailing components.
|
||
|
.TP 4
|
||
|
%C
|
||
|
Like %c, but without
|
||
|
.Sq ~
|
||
|
substitution.
|
||
|
.TP 4
|
||
|
%h, %!, !
|
||
|
The current history event number.
|
||
|
.TP 4
|
||
|
%M
|
||
|
The full hostname.
|
||
|
.TP 4
|
||
|
%m
|
||
|
The hostname up to the first
|
||
|
.Sq .
|
||
|
.TP 4
|
||
|
%S (%s)
|
||
|
Start (stop) standout mode.
|
||
|
.TP 4
|
||
|
%B (%b)
|
||
|
Start (stop) boldfacing mode.
|
||
|
.TP 4
|
||
|
%U (%u)
|
||
|
Start (stop) underline mode.
|
||
|
.TP 4
|
||
|
%t, %@
|
||
|
The time of day in 12-hour AM/PM format.
|
||
|
.TP 4
|
||
|
%T
|
||
|
Like
|
||
|
.Sq %t
|
||
|
, but in 24-hour format (but see the
|
||
|
.Va ampm
|
||
|
shell variable).
|
||
|
.TP 4
|
||
|
%p
|
||
|
The
|
||
|
.Sq precise
|
||
|
time of day in 12-hour AM/PM format, with seconds.
|
||
|
.TP 4
|
||
|
%P
|
||
|
Like
|
||
|
.Sq %p
|
||
|
, but in 24-hour format (but see the
|
||
|
.Va ampm
|
||
|
shell variable).
|
||
|
.TP 4
|
||
|
\e
|
||
|
.Va c
|
||
|
.Va c
|
||
|
is parsed as in
|
||
|
.Va bindkey
|
||
|
.TP 4
|
||
|
^
|
||
|
.Va c
|
||
|
.Va c
|
||
|
is parsed as in
|
||
|
.Va bindkey
|
||
|
.TP 4
|
||
|
%%
|
||
|
A single
|
||
|
.Sq %
|
||
|
.TP 4
|
||
|
%n
|
||
|
The user name.
|
||
|
.TP 4
|
||
|
%N
|
||
|
The effective user name.
|
||
|
.TP 4
|
||
|
%j
|
||
|
The number of jobs.
|
||
|
.TP 4
|
||
|
%d
|
||
|
The weekday in
|
||
|
.Sq Day
|
||
|
format.
|
||
|
.TP 4
|
||
|
%D
|
||
|
The day in
|
||
|
.Sq dd
|
||
|
format.
|
||
|
.TP 4
|
||
|
%w
|
||
|
The month in
|
||
|
.Sq Mon
|
||
|
format.
|
||
|
.TP 4
|
||
|
%W
|
||
|
The month in
|
||
|
.Sq mm
|
||
|
format.
|
||
|
.TP 4
|
||
|
%y
|
||
|
The year in
|
||
|
.Sq yy
|
||
|
format.
|
||
|
.TP 4
|
||
|
%Y
|
||
|
The year in
|
||
|
.Sq yyyy
|
||
|
format.
|
||
|
.TP 4
|
||
|
%l
|
||
|
The shell's tty.
|
||
|
.TP 4
|
||
|
%L
|
||
|
Clears from the end of the prompt to end of the display or the end of the line.
|
||
|
.TP 4
|
||
|
%$
|
||
|
Expands the shell or environment variable name immediately after the
|
||
|
.Sq $
|
||
|
.TP 4
|
||
|
%#
|
||
|
`>' (or the first character of the
|
||
|
.Va promptchars
|
||
|
shell variable)
|
||
|
for normal users,
|
||
|
.Sq #
|
||
|
(or the second character of
|
||
|
.Va promptchars
|
||
|
)
|
||
|
for the superuser.
|
||
|
.TP 4
|
||
|
%{
|
||
|
.Va string
|
||
|
%}
|
||
|
Includes
|
||
|
.Va string
|
||
|
as a literal escape sequence.
|
||
|
It should be used only to change terminal attributes and
|
||
|
should not move the cursor location.
|
||
|
This
|
||
|
cannot be the last sequence in
|
||
|
.Va prompt
|
||
|
.TP 4
|
||
|
%?
|
||
|
The return code of the command executed just before the prompt.
|
||
|
.TP 4
|
||
|
%R
|
||
|
In
|
||
|
.Va prompt2
|
||
|
, the status of the parser.
|
||
|
In
|
||
|
.Va prompt3
|
||
|
, the corrected string.
|
||
|
In
|
||
|
.Va history
|
||
|
, the history string.
|
||
|
.PD
|
||
|
.Pp
|
||
|
`%B',
|
||
|
.Sq %S
|
||
|
,
|
||
|
.Sq %U
|
||
|
and
|
||
|
.Sq %{
|
||
|
.Va string
|
||
|
%}
|
||
|
are available in only
|
||
|
eight-bit-clean shells; see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.Pp
|
||
|
The bold, standout and underline sequences are often used to distinguish a
|
||
|
superuser shell.
|
||
|
For example,
|
||
|
.IP "" 4
|
||
|
> set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
|
||
|
.br
|
||
|
tut [37]
|
||
|
.Va [2:54pm]
|
||
|
[/usr/accts/sys] you rang? _
|
||
|
.Pp
|
||
|
If
|
||
|
.Sq %t
|
||
|
,
|
||
|
.Sq %@
|
||
|
,
|
||
|
.Sq %T
|
||
|
,
|
||
|
.Sq %p
|
||
|
, or
|
||
|
.Sq %P
|
||
|
is used, and
|
||
|
.Va noding
|
||
|
is not set,
|
||
|
then print
|
||
|
.Sq DING!
|
||
|
on the change of hour (i.e,
|
||
|
.Sq \&:00
|
||
|
minutes) instead of
|
||
|
the actual time.
|
||
|
.Pp
|
||
|
Set by default to
|
||
|
.Sq %#
|
||
|
in interactive shells.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B prompt2 \fR(+)
|
||
|
The string with which to prompt in
|
||
|
.Va while
|
||
|
and
|
||
|
.Va foreach
|
||
|
loops and
|
||
|
after lines ending in
|
||
|
.Sq \e
|
||
|
The same format sequences may be used as in
|
||
|
.Va prompt
|
||
|
(q.v.);
|
||
|
note the variable meaning of
|
||
|
.Sq %R
|
||
|
Set by default to
|
||
|
.Sq %R?
|
||
|
in interactive shells.
|
||
|
.TP 8
|
||
|
.B prompt3 \fR(+)
|
||
|
The string with which to prompt when confirming automatic spelling correction.
|
||
|
The same format sequences may be used as in
|
||
|
.Va prompt
|
||
|
(q.v.);
|
||
|
note the variable meaning of
|
||
|
.Sq %R
|
||
|
Set by default to
|
||
|
.Sq CORRECT>%R (y|n|e|a)?
|
||
|
in interactive shells.
|
||
|
.TP 8
|
||
|
.B promptchars \fR(+)
|
||
|
If set (to a two-character string), the
|
||
|
.Sq %#
|
||
|
formatting sequence in the
|
||
|
.Va prompt
|
||
|
shell variable is replaced with the first character for
|
||
|
normal users and the second character for the superuser.
|
||
|
.TP 8
|
||
|
.B pushdtohome \fR(+)
|
||
|
If set,
|
||
|
.Va pushd
|
||
|
without arguments does
|
||
|
.Sq pushd ~
|
||
|
, like
|
||
|
.Va cd
|
||
|
.TP 8
|
||
|
.B pushdsilent \fR(+)
|
||
|
If set,
|
||
|
.Va pushd
|
||
|
and
|
||
|
.Va popd
|
||
|
do not print the directory stack.
|
||
|
.TP 8
|
||
|
.B recexact \fR(+)
|
||
|
If set, completion completes on an exact match even if a longer match is
|
||
|
possible.
|
||
|
.TP 8
|
||
|
.B recognize_only_executables \fR(+)
|
||
|
If set, command listing displays only files in the path that are
|
||
|
executable.
|
||
|
Slow.
|
||
|
.TP 8
|
||
|
.B rmstar \fR(+)
|
||
|
If set, the user is prompted before
|
||
|
.Sq rm *
|
||
|
is executed.
|
||
|
.TP 8
|
||
|
.B rprompt \fR(+)
|
||
|
The string to print on the right-hand side of the screen (after
|
||
|
the command input) when the prompt is being displayed on the left.
|
||
|
It recognizes the same formatting characters as
|
||
|
.Va prompt
|
||
|
It will automatically disappear and reappear as necessary, to ensure that
|
||
|
command input isn't obscured, and will appear only if the prompt,
|
||
|
command input, and itself will fit together on the first line.
|
||
|
If
|
||
|
.Va edit
|
||
|
isn't set, then
|
||
|
.Va rprompt
|
||
|
will be printed after
|
||
|
the prompt and before the command input.
|
||
|
.TP 8
|
||
|
.B savedirs \fR(+)
|
||
|
If set, the shell does
|
||
|
.Sq dirs \-S
|
||
|
before exiting.
|
||
|
If the first word is set to a number, at most that many directory stack
|
||
|
entries are saved.
|
||
|
.TP 8
|
||
|
.B savehist
|
||
|
If set, the shell does
|
||
|
.Sq history \-S
|
||
|
before exiting.
|
||
|
If the first word is set to a number, at most that many lines are saved.
|
||
|
(The number should be less than or equal to the number
|
||
|
.Va history
|
||
|
entries;
|
||
|
if it is set to greater than the number of
|
||
|
.Va history
|
||
|
settings, only
|
||
|
.Va history
|
||
|
entries will be saved)
|
||
|
If the second word is set to
|
||
|
.Sq merge
|
||
|
, the history list is merged with
|
||
|
the existing history file instead of replacing it (if there is one) and
|
||
|
sorted by time stamp and the most recent events are retained.
|
||
|
If the second word of
|
||
|
.Va savehist
|
||
|
is
|
||
|
.Sq merge
|
||
|
and the third word is set to
|
||
|
`lock', the history file update will be serialized with other shell sessions
|
||
|
that would possibly like to merge history at exactly the same time. (+)
|
||
|
.TP 8
|
||
|
.B sched \fR(+)
|
||
|
The format in which the
|
||
|
.Va sched
|
||
|
builtin command prints scheduled events;
|
||
|
if not given,
|
||
|
.Sq %h\et%T\et%R\en
|
||
|
is used.
|
||
|
The format sequences are described above under
|
||
|
.Va prompt
|
||
|
;
|
||
|
note the variable meaning of
|
||
|
.Sq %R
|
||
|
.TP 8
|
||
|
.B shell
|
||
|
The file in which the shell resides.
|
||
|
This is used in forking
|
||
|
shells to interpret files which have execute bits set, but
|
||
|
which are not executable by the system.
|
||
|
(See the description
|
||
|
of
|
||
|
.Va Builtin and non-builtin command execution
|
||
|
.) Initialized to the
|
||
|
(system-dependent) home of the shell.
|
||
|
.TP 8
|
||
|
.B shlvl \fR(+)
|
||
|
The number of nested shells.
|
||
|
Reset to 1 in login shells.
|
||
|
See also
|
||
|
.Va loginsh
|
||
|
.TP 8
|
||
|
.B status
|
||
|
The exit status from the last command or backquote expansion, or any
|
||
|
command in a pipeline is propagated to
|
||
|
.Va status
|
||
|
(This is also the
|
||
|
default
|
||
|
.Xr csh 1
|
||
|
behavior.)
|
||
|
This default does not match what POSIX mandates (to return the
|
||
|
status of the last command only). To match the POSIX behavior, you need
|
||
|
to unset
|
||
|
.Va anyerror
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
If the
|
||
|
.Va anyerror
|
||
|
variable is unset, the exit status of a pipeline
|
||
|
is determined only from the last command in the pipeline, and the exit
|
||
|
status of a backquote expansion is
|
||
|
.Va not
|
||
|
propagated to
|
||
|
.Va status
|
||
|
.Pp
|
||
|
If a command terminated abnormally, then 0200 is added to the status.
|
||
|
Builtin commands which fail return exit status
|
||
|
.Sq 1
|
||
|
, all other builtin
|
||
|
commands return status
|
||
|
.Sq 0
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B symlinks \fR(+)
|
||
|
Can be set to several different values to control symbolic link (`symlink')
|
||
|
resolution:
|
||
|
.RS +8
|
||
|
.Pp
|
||
|
If set to
|
||
|
.Sq chase
|
||
|
, whenever the current directory changes to a directory
|
||
|
containing a symbolic link, it is expanded to the real name of the directory
|
||
|
to which the link points.
|
||
|
This does not work for the user's home directory;
|
||
|
this is a bug.
|
||
|
.Pp
|
||
|
If set to
|
||
|
.Sq ignore
|
||
|
, the shell tries to construct a current directory
|
||
|
relative to the current directory before the link was crossed.
|
||
|
This means that
|
||
|
.Va cd
|
||
|
ing through a symbolic link and then
|
||
|
.Sq cd ..
|
||
|
ing
|
||
|
returns one to the original directory.
|
||
|
This affects only builtin commands
|
||
|
and filename completion.
|
||
|
.Pp
|
||
|
If set to
|
||
|
.Sq expand
|
||
|
, the shell tries to fix symbolic links by actually expanding
|
||
|
arguments which look like path names.
|
||
|
This affects any command, not just
|
||
|
builtins.
|
||
|
Unfortunately, this does not work for hard-to-recognize filenames,
|
||
|
such as those embedded in command options.
|
||
|
Expansion may be prevented by
|
||
|
quoting.
|
||
|
While this setting is usually the most convenient, it is sometimes
|
||
|
misleading and sometimes confusing when it fails to recognize an argument
|
||
|
which should be expanded.
|
||
|
A compromise is to use
|
||
|
.Sq ignore
|
||
|
and use the
|
||
|
editor command
|
||
|
.Va normalize-path
|
||
|
(bound by default to ^X-n) when necessary.
|
||
|
.Pp
|
||
|
Some examples are in order.
|
||
|
First, let's set up some play directories:
|
||
|
.IP "" 4
|
||
|
> cd /tmp
|
||
|
.br
|
||
|
> mkdir from from/src to
|
||
|
.br
|
||
|
> ln \-s from/src to/dst
|
||
|
.Pp
|
||
|
Here's the behavior with
|
||
|
.Va symlinks
|
||
|
unset,
|
||
|
.IP "" 4
|
||
|
> cd /tmp/to/dst; echo $cwd
|
||
|
.br
|
||
|
/tmp/to/dst
|
||
|
.br
|
||
|
> cd ..; echo $cwd
|
||
|
.br
|
||
|
/tmp/from
|
||
|
.Pp
|
||
|
here's the behavior with
|
||
|
.Va symlinks
|
||
|
set to
|
||
|
.Sq chase
|
||
|
,
|
||
|
.IP "" 4
|
||
|
> cd /tmp/to/dst; echo $cwd
|
||
|
.br
|
||
|
/tmp/from/src
|
||
|
.br
|
||
|
> cd ..; echo $cwd
|
||
|
.br
|
||
|
/tmp/from
|
||
|
.Pp
|
||
|
here's the behavior with
|
||
|
.Va symlinks
|
||
|
set to
|
||
|
.Sq ignore
|
||
|
,
|
||
|
.IP "" 4
|
||
|
> cd /tmp/to/dst; echo $cwd
|
||
|
.br
|
||
|
/tmp/to/dst
|
||
|
.br
|
||
|
> cd ..; echo $cwd
|
||
|
.br
|
||
|
/tmp/to
|
||
|
.Pp
|
||
|
and here's the behavior with
|
||
|
.Va symlinks
|
||
|
set to
|
||
|
.Sq expand
|
||
|
.IP "" 4
|
||
|
> cd /tmp/to/dst; echo $cwd
|
||
|
.br
|
||
|
/tmp/to/dst
|
||
|
.br
|
||
|
> cd ..; echo $cwd
|
||
|
.br
|
||
|
/tmp/to
|
||
|
.br
|
||
|
> cd /tmp/to/dst; echo $cwd
|
||
|
.br
|
||
|
/tmp/to/dst
|
||
|
.br
|
||
|
> cd ".."; echo $cwd
|
||
|
.br
|
||
|
/tmp/from
|
||
|
.br
|
||
|
> /bin/echo ..
|
||
|
.br
|
||
|
/tmp/to
|
||
|
.br
|
||
|
> /bin/echo ".."
|
||
|
.br
|
||
|
\&..
|
||
|
.Pp
|
||
|
Note that
|
||
|
.Sq expand
|
||
|
expansion 1) works just like
|
||
|
.Sq ignore
|
||
|
for builtins
|
||
|
like
|
||
|
.Va cd
|
||
|
, 2) is prevented by quoting, and 3) happens before
|
||
|
filenames are passed to non-builtin commands.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B tcsh \fR(+)
|
||
|
The version number of the shell in the format
|
||
|
.Sq R.VV.Pp
|
||
|
,
|
||
|
where
|
||
|
.Sq R
|
||
|
is the major release number,
|
||
|
.Sq VV
|
||
|
the current version
|
||
|
and
|
||
|
.Sq PP
|
||
|
the patchlevel.
|
||
|
.TP 8
|
||
|
.B term
|
||
|
The terminal type.
|
||
|
Usually set in
|
||
|
.Va ~/.login
|
||
|
as described under
|
||
|
.Va Startup and shutdown
|
||
|
.TP 8
|
||
|
.B time
|
||
|
If set to a number, then the
|
||
|
.Va time
|
||
|
builtin (q.v.) executes automatically
|
||
|
after each command which takes more than that many CPU seconds.
|
||
|
If there is a second word, it is used as a format string for the output
|
||
|
of the
|
||
|
.Va time
|
||
|
builtin.
|
||
|
(u) The following sequences may be used in the
|
||
|
format string:
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
%U
|
||
|
The time the process spent in user mode in cpu seconds.
|
||
|
.TP 4
|
||
|
%S
|
||
|
The time the process spent in kernel mode in cpu seconds.
|
||
|
.TP 4
|
||
|
%E
|
||
|
The elapsed (wall clock) time in seconds.
|
||
|
.TP 4
|
||
|
%P
|
||
|
The CPU percentage computed as (%U + %S) / %E.
|
||
|
.TP 4
|
||
|
%W
|
||
|
Number of times the process was swapped.
|
||
|
.TP 4
|
||
|
%X
|
||
|
The average amount in (shared) text space used in Kbytes.
|
||
|
.TP 4
|
||
|
%D
|
||
|
The average amount in (unshared) data/stack space used in Kbytes.
|
||
|
.TP 4
|
||
|
%K
|
||
|
The total space used (%X + %D) in Kbytes.
|
||
|
.TP 4
|
||
|
%M
|
||
|
The maximum memory the process had in use at any time in Kbytes.
|
||
|
.TP 4
|
||
|
%F
|
||
|
The number of major page faults (page needed to be brought from disk).
|
||
|
.TP 4
|
||
|
%R
|
||
|
The number of minor page faults.
|
||
|
.TP 4
|
||
|
%I
|
||
|
The number of input operations.
|
||
|
.TP 4
|
||
|
%O
|
||
|
The number of output operations.
|
||
|
.TP 4
|
||
|
%r
|
||
|
The number of socket messages received.
|
||
|
.TP 4
|
||
|
%s
|
||
|
The number of socket messages sent.
|
||
|
.TP 4
|
||
|
%k
|
||
|
The number of signals received.
|
||
|
.TP 4
|
||
|
%w
|
||
|
The number of voluntary context switches (waits).
|
||
|
.TP 4
|
||
|
%c
|
||
|
The number of involuntary context switches.
|
||
|
.PD
|
||
|
.Pp
|
||
|
Only the first four sequences are supported on systems without BSD resource
|
||
|
limit functions.
|
||
|
The default time format is
|
||
|
.Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww
|
||
|
for
|
||
|
systems that support resource usage reporting and
|
||
|
.Sq %Uu %Ss %E %P
|
||
|
for
|
||
|
systems that do not.
|
||
|
.Pp
|
||
|
Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
|
||
|
available, but the following additional sequences are:
|
||
|
.Pp
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
%Y
|
||
|
The number of system calls performed.
|
||
|
.TP 4
|
||
|
%Z
|
||
|
The number of pages which are zero-filled on demand.
|
||
|
.TP 4
|
||
|
%i
|
||
|
The number of times a process's resident set size was increased by the kernel.
|
||
|
.TP 4
|
||
|
%d
|
||
|
The number of times a process's resident set size was decreased by the kernel.
|
||
|
.TP 4
|
||
|
%l
|
||
|
The number of read system calls performed.
|
||
|
.TP 4
|
||
|
%m
|
||
|
The number of write system calls performed.
|
||
|
.TP 4
|
||
|
%p
|
||
|
The number of reads from raw disk devices.
|
||
|
.TP 4
|
||
|
%q
|
||
|
The number of writes to raw disk devices.
|
||
|
.PD
|
||
|
.Pp
|
||
|
and the default time format is
|
||
|
.Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww
|
||
|
Note that the CPU percentage can be higher than 100% on multi-processors.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B tperiod \fR(+)
|
||
|
The period, in minutes, between executions of the
|
||
|
.Va periodic
|
||
|
special alias.
|
||
|
.TP 8
|
||
|
.B tty \fR(+)
|
||
|
The name of the tty, or empty if not attached to one.
|
||
|
.TP 8
|
||
|
.B uid \fR(+)
|
||
|
The user's real user ID.
|
||
|
.TP 8
|
||
|
.B user
|
||
|
The user's login name.
|
||
|
.TP 8
|
||
|
.B verbose
|
||
|
If set, causes the words of each
|
||
|
command to be printed, after history substitution (if any).
|
||
|
Set by the
|
||
|
.Fl v\fR command line option.
|
||
|
.TP 8
|
||
|
.B version \fR(+)
|
||
|
The version ID stamp.
|
||
|
It contains the shell's version number (see
|
||
|
.Va tcsh
|
||
|
),
|
||
|
origin, release date, vendor, operating system and machine (see
|
||
|
.Va VENDOR
|
||
|
,
|
||
|
.Va OSTYPE
|
||
|
and
|
||
|
.Va MACHTYPE
|
||
|
) and a comma-separated
|
||
|
list of options which were set at compile time.
|
||
|
Options which are set by default in the distribution are noted.
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 6
|
||
|
8b
|
||
|
The shell is eight bit clean; default
|
||
|
.TP 6
|
||
|
7b
|
||
|
The shell is not eight bit clean
|
||
|
.TP 6
|
||
|
wide
|
||
|
The shell is multibyte encoding clean (like UTF-8)
|
||
|
.TP 6
|
||
|
nls
|
||
|
The system's NLS is used; default for systems with NLS
|
||
|
.TP 6
|
||
|
lf
|
||
|
Login shells execute
|
||
|
.Va /etc/csh.login
|
||
|
before instead of after
|
||
|
.Va /etc/csh.cshrc
|
||
|
and
|
||
|
.Va ~/.login
|
||
|
before instead of after
|
||
|
.Va ~/.tcshrc
|
||
|
and
|
||
|
.Va ~/.history
|
||
|
.TP 6
|
||
|
dl
|
||
|
`.' is put last in
|
||
|
.Va path
|
||
|
for security; default
|
||
|
.TP 6
|
||
|
nd
|
||
|
`.' is omitted from
|
||
|
.Va path
|
||
|
for security
|
||
|
.TP 6
|
||
|
vi
|
||
|
.Va vi
|
||
|
(1)\-style editing is the default rather than
|
||
|
.Va emacs
|
||
|
(1)\-style
|
||
|
.TP 6
|
||
|
dtr
|
||
|
Login shells drop DTR when exiting
|
||
|
.TP 6
|
||
|
bye
|
||
|
.Va bye
|
||
|
is a synonym for
|
||
|
.Va logout
|
||
|
and
|
||
|
.Va log
|
||
|
is an alternate name for
|
||
|
.Va watchlog
|
||
|
.TP 6
|
||
|
al
|
||
|
.Va autologout
|
||
|
is enabled; default
|
||
|
.TP 6
|
||
|
kan
|
||
|
Kanji is used if appropriate according to locale settings,
|
||
|
unless the
|
||
|
.Va nokanji
|
||
|
shell variable is set
|
||
|
.TP 6
|
||
|
sm
|
||
|
The system's
|
||
|
.Va malloc
|
||
|
(3) is used
|
||
|
.TP 6
|
||
|
hb
|
||
|
The
|
||
|
.Sq #!<program> <args>
|
||
|
convention is emulated when executing shell scripts
|
||
|
.TP 6
|
||
|
ng
|
||
|
The
|
||
|
.Va newgrp
|
||
|
builtin is available
|
||
|
.TP 6
|
||
|
rh
|
||
|
The shell attempts to set the
|
||
|
.Va REMOTEHOST
|
||
|
environment variable
|
||
|
.TP 6
|
||
|
afs
|
||
|
The shell verifies your password with the kerberos server if local
|
||
|
authentication fails.
|
||
|
The
|
||
|
.Va afsuser
|
||
|
shell variable or the
|
||
|
.Va AFSUSER
|
||
|
environment variable override your local username if set.
|
||
|
.PD
|
||
|
.Pp
|
||
|
An administrator may enter additional strings to indicate differences
|
||
|
in the local version.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B vimode \fR(+)
|
||
|
.RS +8
|
||
|
If unset, various key bindings change behavior to be more
|
||
|
.Va emacs
|
||
|
(1)\-style:
|
||
|
word boundaries are determined by
|
||
|
.Va wordchars
|
||
|
versus other characters.
|
||
|
.Pp
|
||
|
If set, various key bindings change behavior to be more
|
||
|
.Va vi
|
||
|
(1)\-style:
|
||
|
word boundaries are determined by
|
||
|
.Va wordchars
|
||
|
versus whitespace
|
||
|
versus other characters;
|
||
|
cursor behavior depends upon current vi mode (command, delete, insert, replace).
|
||
|
.Pp
|
||
|
This variable is unset by
|
||
|
.Va bindkey
|
||
|
|
||
|
.Va -e
|
||
|
and
|
||
|
set by
|
||
|
.Va bindkey
|
||
|
|
||
|
.Va -v
|
||
|
.B vimode
|
||
|
may be explicitly set or unset by the user after those
|
||
|
.Va bindkey
|
||
|
operations if required.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B visiblebell \fR(+)
|
||
|
If set, a screen flash is used rather than the audible bell.
|
||
|
See also
|
||
|
.Va nobeep
|
||
|
.TP 8
|
||
|
.B watch \fR(+)
|
||
|
A list of user/terminal pairs to watch for logins and logouts.
|
||
|
If either the user is
|
||
|
.Sq any
|
||
|
all terminals are watched for the given user
|
||
|
and vice versa.
|
||
|
Setting
|
||
|
.Va watch
|
||
|
to
|
||
|
.Sq (any any)
|
||
|
watches all users and terminals.
|
||
|
For example,
|
||
|
.RS +8
|
||
|
.IP "" 4
|
||
|
set watch = (george ttyd1 any console $user any)
|
||
|
.Pp
|
||
|
reports activity of the user
|
||
|
.Sq george
|
||
|
on ttyd1, any user on the console, and
|
||
|
oneself (or a trespasser) on any terminal.
|
||
|
.Pp
|
||
|
Logins and logouts are checked every 10 minutes by default, but the first
|
||
|
word of
|
||
|
.Va watch
|
||
|
can be set to a number to check every so many minutes.
|
||
|
For example,
|
||
|
.IP "" 4
|
||
|
set watch = (1 any any)
|
||
|
.Pp
|
||
|
reports any login/logout once every minute.
|
||
|
For the impatient, the
|
||
|
.Va log
|
||
|
builtin command triggers a
|
||
|
.Va watch
|
||
|
report at any time.
|
||
|
All current logins
|
||
|
are reported (as with the
|
||
|
.Va log
|
||
|
builtin) when
|
||
|
.Va watch
|
||
|
is first set.
|
||
|
.Pp
|
||
|
The
|
||
|
.Va who
|
||
|
shell variable controls the format of
|
||
|
.Va watch
|
||
|
reports.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B who \fR(+)
|
||
|
The format string for
|
||
|
.Va watch
|
||
|
messages.
|
||
|
The following sequences
|
||
|
are replaced by the given information:
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
%n
|
||
|
The name of the user who logged in/out.
|
||
|
.TP 4
|
||
|
%a
|
||
|
The observed action, i.e.,
|
||
|
.Sq logged on
|
||
|
,
|
||
|
.Sq logged off
|
||
|
or
|
||
|
.Sq replaced
|
||
|
.Va olduser
|
||
|
on
|
||
|
.TP 4
|
||
|
%l
|
||
|
The terminal (tty) on which the user logged in/out.
|
||
|
.TP 4
|
||
|
%M
|
||
|
The full hostname of the remote host, or
|
||
|
.Sq local
|
||
|
if the login/logout was
|
||
|
from the local host.
|
||
|
.TP 4
|
||
|
%m
|
||
|
The hostname of the remote host up to the first
|
||
|
.Sq .
|
||
|
The full name is printed if it is an IP address or an X Window System display.
|
||
|
.PD
|
||
|
.Pp
|
||
|
%M and %m are available on only systems that store the remote hostname in
|
||
|
.Va /etc/utmp
|
||
|
If unset,
|
||
|
.Sq %n has %a %l from %m.
|
||
|
is used, or
|
||
|
.Sq %n has %a %l.
|
||
|
on systems
|
||
|
which don't store the remote hostname.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B wordchars \fR(+)
|
||
|
A list of non-alphanumeric characters to be considered part of a word by the
|
||
|
.Va forward-word
|
||
|
,
|
||
|
.Va backward-word
|
||
|
etc., editor commands.
|
||
|
If unset, the default value is determined based on the state of
|
||
|
.Va vimode
|
||
|
:
|
||
|
if
|
||
|
.Va vimode
|
||
|
is unset,
|
||
|
.Sq *?_\-.[]~=
|
||
|
is used as the default;
|
||
|
if
|
||
|
.Va vimode
|
||
|
is set,
|
||
|
.Sq _
|
||
|
is used as the default.
|
||
|
.Sh ENVIRONMENT
|
||
|
.TP 8
|
||
|
.B AFSUSER \fR(+)
|
||
|
Equivalent to the
|
||
|
.Va afsuser
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B COLUMNS
|
||
|
The number of columns in the terminal.
|
||
|
See
|
||
|
.Va Terminal management
|
||
|
.TP 8
|
||
|
.B DISPLAY
|
||
|
Used by X Window System (see
|
||
|
.Va X
|
||
|
(1)).
|
||
|
If set, the shell does not set
|
||
|
.Va autologout
|
||
|
(q.v.).
|
||
|
.TP 8
|
||
|
.B EDITOR
|
||
|
The pathname to a default editor.
|
||
|
Used by the
|
||
|
.Va run-fg-editor
|
||
|
editor command if the
|
||
|
the
|
||
|
.Va editors
|
||
|
shell variable is unset.
|
||
|
See also the
|
||
|
.Va VISUAL
|
||
|
environment variable.
|
||
|
.TP 8
|
||
|
.B GROUP \fR(+)
|
||
|
Equivalent to the
|
||
|
.Va group
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B HOME
|
||
|
Equivalent to the
|
||
|
.Va home
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B HOST \fR(+)
|
||
|
Initialized to the name of the machine on which the shell
|
||
|
is running, as determined by the
|
||
|
.Va gethostname
|
||
|
(2) system call.
|
||
|
.TP 8
|
||
|
.B HOSTTYPE \fR(+)
|
||
|
Initialized to the type of machine on which the shell
|
||
|
is running, as determined at compile time.
|
||
|
This variable is obsolete and
|
||
|
will be removed in a future version.
|
||
|
.TP 8
|
||
|
.B HPATH \fR(+)
|
||
|
A colon-separated list of directories in which the
|
||
|
.Va run-help
|
||
|
editor
|
||
|
command looks for command documentation.
|
||
|
.TP 8
|
||
|
.B LANG
|
||
|
Gives the preferred character environment.
|
||
|
See
|
||
|
.Va Native Language System support
|
||
|
.TP 8
|
||
|
.B LC_CTYPE
|
||
|
If set, only ctype character handling is changed.
|
||
|
See
|
||
|
.Va Native Language System support
|
||
|
.TP 8
|
||
|
.B LINES
|
||
|
The number of lines in the terminal.
|
||
|
See
|
||
|
.Va Terminal management
|
||
|
.TP 8
|
||
|
.B LS_COLORS
|
||
|
The format of this variable is reminiscent of the
|
||
|
.Va termcap(5)
|
||
|
file format; a colon-separated list of expressions of the form
|
||
|
"
|
||
|
.Va xx=string
|
||
|
", where "
|
||
|
.Va xx
|
||
|
" is a two-character variable name.
|
||
|
The
|
||
|
variables with their associated defaults are:
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.RS +4
|
||
|
.PD 0
|
||
|
.TP 12
|
||
|
no 0
|
||
|
Normal (non-filename) text
|
||
|
.TP 12
|
||
|
fi 0
|
||
|
Regular file
|
||
|
.TP 12
|
||
|
di 01;34
|
||
|
Directory
|
||
|
.TP 12
|
||
|
ln 01;36
|
||
|
Symbolic link
|
||
|
.TP 12
|
||
|
pi 33
|
||
|
Named pipe (FIFO)
|
||
|
.TP 12
|
||
|
so 01;35
|
||
|
Socket
|
||
|
.TP 12
|
||
|
do 01;35
|
||
|
Door
|
||
|
.TP 12
|
||
|
bd 01;33
|
||
|
Block device
|
||
|
.TP 12
|
||
|
cd 01;32
|
||
|
Character device
|
||
|
.TP 12
|
||
|
ex 01;32
|
||
|
Executable file
|
||
|
.TP 12
|
||
|
mi (none)
|
||
|
Missing file (defaults to fi)
|
||
|
.TP 12
|
||
|
or (none)
|
||
|
Orphaned symbolic link (defaults to ln)
|
||
|
.TP 12
|
||
|
lc ^[[
|
||
|
Left code
|
||
|
.TP 12
|
||
|
rc m
|
||
|
Right code
|
||
|
.TP 12
|
||
|
ec (none)
|
||
|
End code (replaces lc+no+rc)
|
||
|
.PD
|
||
|
.RE
|
||
|
.Pp
|
||
|
You need to include only the variables you want to change from
|
||
|
the default.
|
||
|
.Pp
|
||
|
File names can also be colorized based on filename extension.
|
||
|
This is specified in the
|
||
|
.Va LS_COLORS
|
||
|
variable using the syntax
|
||
|
.Va "*ext=string"
|
||
|
For example, using ISO 6429 codes, to color
|
||
|
all C\-language source files blue you would specify
|
||
|
.Va "*.c=34"
|
||
|
This would color all files ending in
|
||
|
.Va .c
|
||
|
in blue (34) color.
|
||
|
.Pp
|
||
|
Control characters can be written either in C\-style\-escaped
|
||
|
notation, or in stty\-like ^\-notation.
|
||
|
The C\-style notation
|
||
|
adds
|
||
|
.Va ^[
|
||
|
for Escape, \fB\_\fR for a normal space character,
|
||
|
and
|
||
|
.Va ?
|
||
|
for Delete.
|
||
|
In addition, the
|
||
|
.Va ^[
|
||
|
escape character
|
||
|
can be used to override the default interpretation of
|
||
|
.Va ^[
|
||
|
,
|
||
|
.Va ^
|
||
|
,
|
||
|
.Va :
|
||
|
and
|
||
|
.Va =
|
||
|
.Pp
|
||
|
Each file will be written as
|
||
|
.Va <lc>
|
||
|
|
||
|
.Va <color-code>
|
||
|
.Va <rc>
|
||
|
|
||
|
.Va <filename>
|
||
|
|
||
|
.Va <ec>
|
||
|
If the
|
||
|
.Va <ec>
|
||
|
code is undefined, the sequence
|
||
|
.Va <lc>
|
||
|
\fB<no>
|
||
|
.Va <rc>
|
||
|
will be used instead.
|
||
|
This is generally more convenient
|
||
|
to use, but less general.
|
||
|
The left, right and end codes are
|
||
|
provided so you don't have to type common parts over and over
|
||
|
again and to support weird terminals; you will generally not
|
||
|
need to change them at all unless your terminal does not use
|
||
|
ISO 6429 color sequences but a different system.
|
||
|
.Pp
|
||
|
If your terminal does use ISO 6429 color codes, you can
|
||
|
compose the type codes (i.e., all except the
|
||
|
.Va lc
|
||
|
,
|
||
|
.Va rc
|
||
|
,
|
||
|
and
|
||
|
.Va ec
|
||
|
codes) from numerical commands separated by semicolons.
|
||
|
The
|
||
|
most common commands are:
|
||
|
.Pp
|
||
|
.RS +8
|
||
|
.PD 0
|
||
|
.TP 4
|
||
|
0
|
||
|
to restore default color
|
||
|
.TP 4
|
||
|
1
|
||
|
for brighter colors
|
||
|
.TP 4
|
||
|
4
|
||
|
for underlined text
|
||
|
.TP 4
|
||
|
5
|
||
|
for flashing text
|
||
|
.TP 4
|
||
|
30
|
||
|
for black foreground
|
||
|
.TP 4
|
||
|
31
|
||
|
for red foreground
|
||
|
.TP 4
|
||
|
32
|
||
|
for green foreground
|
||
|
.TP 4
|
||
|
33
|
||
|
for yellow (or brown) foreground
|
||
|
.TP 4
|
||
|
34
|
||
|
for blue foreground
|
||
|
.TP 4
|
||
|
35
|
||
|
for purple foreground
|
||
|
.TP 4
|
||
|
36
|
||
|
for cyan foreground
|
||
|
.TP 4
|
||
|
37
|
||
|
for white (or gray) foreground
|
||
|
.TP 4
|
||
|
40
|
||
|
for black background
|
||
|
.TP 4
|
||
|
41
|
||
|
for red background
|
||
|
.TP 4
|
||
|
42
|
||
|
for green background
|
||
|
.TP 4
|
||
|
43
|
||
|
for yellow (or brown) background
|
||
|
.TP 4
|
||
|
44
|
||
|
for blue background
|
||
|
.TP 4
|
||
|
45
|
||
|
for purple background
|
||
|
.TP 4
|
||
|
46
|
||
|
for cyan background
|
||
|
.TP 4
|
||
|
47
|
||
|
for white (or gray) background
|
||
|
.PD
|
||
|
.RE
|
||
|
.Pp
|
||
|
Not all commands will work on all systems or display devices.
|
||
|
.Pp
|
||
|
A few terminal programs do not recognize the default end code
|
||
|
properly.
|
||
|
If all text gets colorized after you do a directory
|
||
|
listing, try changing the
|
||
|
.Va no
|
||
|
and
|
||
|
.Va fi
|
||
|
codes from 0 to the
|
||
|
numerical codes for your standard fore- and background colors.
|
||
|
.RE
|
||
|
.TP 8
|
||
|
.B MACHTYPE \fR(+)
|
||
|
The machine type (microprocessor class or machine model), as determined at compile time.
|
||
|
.TP 8
|
||
|
.B NOREBIND \fR(+)
|
||
|
If set, printable characters are not rebound to
|
||
|
.Va self-insert-command
|
||
|
See
|
||
|
.Va Native Language System support
|
||
|
.TP 8
|
||
|
.B OSTYPE \fR(+)
|
||
|
The operating system, as determined at compile time.
|
||
|
.TP 8
|
||
|
.B PATH
|
||
|
A colon-separated list of directories in which to look for executables.
|
||
|
Equivalent to the
|
||
|
.Va path
|
||
|
shell variable, but in a different format.
|
||
|
.TP 8
|
||
|
.B PWD \fR(+)
|
||
|
Equivalent to the
|
||
|
.Va cwd
|
||
|
shell variable, but not synchronized to it;
|
||
|
updated only after an actual directory change.
|
||
|
.TP 8
|
||
|
.B REMOTEHOST \fR(+)
|
||
|
The host from which the user has logged in remotely, if this is the case and
|
||
|
the shell is able to determine it.
|
||
|
Set only if the shell was so compiled;
|
||
|
see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B SHLVL \fR(+)
|
||
|
Equivalent to the
|
||
|
.Va shlvl
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B SYSTYPE \fR(+)
|
||
|
The current system type.
|
||
|
(Domain/OS only)
|
||
|
.TP 8
|
||
|
.B TERM
|
||
|
Equivalent to the
|
||
|
.Va term
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B TERMCAP
|
||
|
The terminal capability string.
|
||
|
See
|
||
|
.Va Terminal management
|
||
|
.TP 8
|
||
|
.B USER
|
||
|
Equivalent to the
|
||
|
.Va user
|
||
|
shell variable.
|
||
|
.TP 8
|
||
|
.B VENDOR \fR(+)
|
||
|
The vendor, as determined at compile time.
|
||
|
.TP 8
|
||
|
.B VISUAL
|
||
|
The pathname to a default full-screen editor.
|
||
|
Used by the
|
||
|
.Va run-fg-editor
|
||
|
editor command if the
|
||
|
the
|
||
|
.Va editors
|
||
|
shell variable is unset.
|
||
|
See also the
|
||
|
.Va EDITOR
|
||
|
environment variable.
|
||
|
.Sh FILES
|
||
|
.PD 0
|
||
|
.TP 16
|
||
|
.I /etc/csh.cshrc
|
||
|
Read first by every shell.
|
||
|
ConvexOS, Stellix and Intel use
|
||
|
.Va /etc/cshrc
|
||
|
and
|
||
|
NeXTs use
|
||
|
.Va /etc/cshrc.std
|
||
|
A/UX, AMIX, Cray and IRIX have no equivalent in
|
||
|
.Xr csh 1
|
||
|
,
|
||
|
but read this file in
|
||
|
.Nm
|
||
|
anyway.
|
||
|
Solaris 2.x does not have it either, but
|
||
|
.Nm
|
||
|
reads
|
||
|
.Va /etc/.cshrc
|
||
|
(+)
|
||
|
.TP 16
|
||
|
.I /etc/csh.login
|
||
|
Read by login shells after
|
||
|
.Va /etc/csh.cshrc
|
||
|
ConvexOS, Stellix and Intel use
|
||
|
.Va /etc/login
|
||
|
,
|
||
|
NeXTs use
|
||
|
.Va /etc/login.std
|
||
|
, Solaris 2.x uses
|
||
|
.Va /etc/.login
|
||
|
and
|
||
|
A/UX, AMIX, Cray and IRIX use
|
||
|
.Va /etc/cshrc
|
||
|
.TP 16
|
||
|
.I ~/.tcshrc \fR(+)
|
||
|
Read by every shell after
|
||
|
.Va /etc/csh.cshrc
|
||
|
or its equivalent.
|
||
|
.TP 16
|
||
|
.I ~/.cshrc
|
||
|
Read by every shell, if
|
||
|
.Va ~/.tcshrc
|
||
|
doesn't exist,
|
||
|
after
|
||
|
.Va /etc/csh.cshrc
|
||
|
or its equivalent.
|
||
|
This manual uses
|
||
|
.Sq
|
||
|
.Va ~/.tcshrc
|
||
|
to mean `
|
||
|
.Va ~/.tcshrc
|
||
|
or,
|
||
|
if
|
||
|
.Va ~/.tcshrc
|
||
|
is not found,
|
||
|
.Va ~/.cshrc
|
||
|
'.
|
||
|
.TP 16
|
||
|
.I ~/.history
|
||
|
Read by login shells after
|
||
|
.Va ~/.tcshrc
|
||
|
if
|
||
|
.Va savehist
|
||
|
is set, but see also
|
||
|
.Va histfile
|
||
|
.TP 16
|
||
|
.I ~/.login
|
||
|
Read by login shells after
|
||
|
.Va ~/.tcshrc
|
||
|
or
|
||
|
.Va ~/.history
|
||
|
The shell may be compiled to read
|
||
|
.Va ~/.login
|
||
|
before instead of after
|
||
|
.Va ~/.tcshrc
|
||
|
and
|
||
|
.Va ~/.history
|
||
|
; see the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.TP 16
|
||
|
.I ~/.cshdirs \fR(+)
|
||
|
Read by login shells after
|
||
|
.Va ~/.login
|
||
|
if
|
||
|
.Va savedirs
|
||
|
is set, but see also
|
||
|
.Va dirsfile
|
||
|
.TP 16
|
||
|
.I /etc/csh.logout
|
||
|
Read by login shells at logout.
|
||
|
ConvexOS, Stellix and Intel use
|
||
|
.Va /etc/logout
|
||
|
and
|
||
|
NeXTs use
|
||
|
.Va /etc/logout.std
|
||
|
A/UX, AMIX, Cray and IRIX have no equivalent in
|
||
|
.Xr csh 1
|
||
|
,
|
||
|
but read this file in
|
||
|
.Nm
|
||
|
anyway.
|
||
|
Solaris 2.x does not have it either, but
|
||
|
.Nm
|
||
|
reads
|
||
|
.Va /etc/.logout
|
||
|
(+)
|
||
|
.TP 16
|
||
|
.I ~/.logout
|
||
|
Read by login shells at logout after
|
||
|
.Va /etc/csh.logout
|
||
|
or its equivalent.
|
||
|
.TP 16
|
||
|
.I /bin/sh
|
||
|
Used to interpret shell scripts not starting with a
|
||
|
.Sq #
|
||
|
.TP 16
|
||
|
.I /tmp/sh*
|
||
|
Temporary file for
|
||
|
.Sq <<
|
||
|
.TP 16
|
||
|
.I /etc/passwd
|
||
|
Source of home directories for
|
||
|
.Sq ~name
|
||
|
substitutions.
|
||
|
.PD
|
||
|
.Pp
|
||
|
The order in which startup files are read may differ if the shell was so
|
||
|
compiled; see
|
||
|
.Va Startup and shutdown
|
||
|
and the
|
||
|
.Va version
|
||
|
shell variable.
|
||
|
.Sh "NEW FEATURES (+)"
|
||
|
This manual describes
|
||
|
.Nm
|
||
|
as a single entity,
|
||
|
but experienced
|
||
|
.Xr csh 1
|
||
|
users will want to pay special attention to
|
||
|
.Nm
|
||
|
's new features.
|
||
|
.Pp
|
||
|
A command-line editor, which supports
|
||
|
.Va emacs
|
||
|
(1)\-style
|
||
|
or
|
||
|
.Va vi
|
||
|
(1)\-style key bindings.
|
||
|
See
|
||
|
.Va The command-line editor
|
||
|
and
|
||
|
.Va Editor commands
|
||
|
.Pp
|
||
|
Programmable, interactive word completion and listing.
|
||
|
See
|
||
|
.Sx Completion and listing
|
||
|
and the
|
||
|
.Va complete
|
||
|
and
|
||
|
.Va uncomplete
|
||
|
builtin commands.
|
||
|
.Pp
|
||
|
.Va Spelling correction
|
||
|
(q.v.) of filenames, commands and variables.
|
||
|
.Pp
|
||
|
.Va Editor commands
|
||
|
(q.v.) which perform other useful functions in the middle of
|
||
|
typed commands, including documentation lookup
|
||
|
.Va ( run-help ),
|
||
|
quick editor restarting
|
||
|
.Va ( run-fg-editor )
|
||
|
and
|
||
|
command resolution
|
||
|
.Va ( which-command ).
|
||
|
.Pp
|
||
|
An enhanced history mechanism.
|
||
|
Events in the history list are time-stamped.
|
||
|
See also the
|
||
|
.Va history
|
||
|
command and its associated shell variables,
|
||
|
the previously undocumented
|
||
|
.Sq #
|
||
|
event specifier and new modifiers
|
||
|
under
|
||
|
.Va History substitution
|
||
|
,
|
||
|
the
|
||
|
.Va *-history
|
||
|
,
|
||
|
.Va history-search-*
|
||
|
,
|
||
|
.Va i-search-*
|
||
|
,
|
||
|
.Va vi-search-*
|
||
|
and
|
||
|
.Va toggle-literal-history
|
||
|
editor commands
|
||
|
and the
|
||
|
.Va histlit
|
||
|
shell variable.
|
||
|
.Pp
|
||
|
Enhanced directory parsing and directory stack handling.
|
||
|
See the
|
||
|
.Va cd
|
||
|
,
|
||
|
.Va pushd
|
||
|
,
|
||
|
.Va popd
|
||
|
and
|
||
|
.Va dirs
|
||
|
commands and their associated
|
||
|
shell variables, the description of
|
||
|
.Va Directory stack substitution
|
||
|
,
|
||
|
the
|
||
|
.Va dirstack
|
||
|
,
|
||
|
.Va owd
|
||
|
and
|
||
|
.Va symlinks
|
||
|
shell variables and
|
||
|
the
|
||
|
.Va normalize-command
|
||
|
and
|
||
|
.Va normalize-path
|
||
|
editor commands.
|
||
|
.Pp
|
||
|
Negation in glob-patterns.
|
||
|
See
|
||
|
.Va Filename substitution
|
||
|
.Pp
|
||
|
New
|
||
|
.Va File inquiry operators
|
||
|
(q.v.) and a
|
||
|
.Va filetest
|
||
|
builtin which uses them.
|
||
|
.Pp
|
||
|
A variety of
|
||
|
.Va Automatic, periodic and timed events
|
||
|
(q.v.) including
|
||
|
scheduled events, special aliases, automatic logout and terminal locking,
|
||
|
command timing and watching for logins and logouts.
|
||
|
.Pp
|
||
|
Support for the Native Language System
|
||
|
(see
|
||
|
.Va Native Language System support
|
||
|
),
|
||
|
OS variant features
|
||
|
(see
|
||
|
.Va OS variant support
|
||
|
and the
|
||
|
.Va echo_style
|
||
|
shell variable)
|
||
|
and system-dependent file locations (see
|
||
|
.Va FILES
|
||
|
).
|
||
|
.Pp
|
||
|
Extensive terminal-management capabilities.
|
||
|
See
|
||
|
.Va Terminal management
|
||
|
.Pp
|
||
|
New builtin commands including
|
||
|
.Va builtins
|
||
|
,
|
||
|
.Va hup
|
||
|
, \fIls\-F\fR,
|
||
|
.Va newgrp
|
||
|
,
|
||
|
.Va printenv
|
||
|
,
|
||
|
.Va which
|
||
|
and
|
||
|
.Va where
|
||
|
(q.v.).
|
||
|
.Pp
|
||
|
New variables that make useful information easily available to the shell.
|
||
|
See the
|
||
|
.Va gid
|
||
|
,
|
||
|
.Va loginsh
|
||
|
,
|
||
|
.Va oid
|
||
|
,
|
||
|
.Va shlvl
|
||
|
,
|
||
|
.Va tcsh
|
||
|
,
|
||
|
.Va tty
|
||
|
,
|
||
|
.Va uid
|
||
|
and
|
||
|
.Va version
|
||
|
shell variables and the
|
||
|
.Va HOST
|
||
|
,
|
||
|
.Va REMOTEHOST
|
||
|
,
|
||
|
.Va VENDOR
|
||
|
,
|
||
|
.Va OSTYPE
|
||
|
and
|
||
|
.Va MACHTYPE
|
||
|
environment
|
||
|
variables.
|
||
|
.Pp
|
||
|
A new syntax for including useful information in the prompt string
|
||
|
(see
|
||
|
.Va prompt
|
||
|
),
|
||
|
and special prompts for loops and spelling correction
|
||
|
(see
|
||
|
.Va prompt2
|
||
|
and
|
||
|
.Va prompt3
|
||
|
).
|
||
|
.Pp
|
||
|
Read-only variables.
|
||
|
See
|
||
|
.Va Variable substitution
|
||
|
.Sh BUGS
|
||
|
When a suspended command is restarted, the shell prints the directory
|
||
|
it started in if this is different from the current directory.
|
||
|
This can
|
||
|
be misleading (i.e., wrong) as the job may have changed directories internally.
|
||
|
.Pp
|
||
|
Shell builtin functions are not stoppable/restartable.
|
||
|
Command sequences
|
||
|
of the form
|
||
|
.Sq a ; b ; c
|
||
|
are also not handled gracefully when stopping is
|
||
|
attempted.
|
||
|
If you suspend
|
||
|
.Sq b
|
||
|
, the shell will then immediately execute
|
||
|
`c'.
|
||
|
This is especially noticeable if this expansion results from an
|
||
|
.Va alias
|
||
|
It suffices to place the sequence of commands in ()'s to force it
|
||
|
to a subshell, i.e.,
|
||
|
.Sq ( a ; b ; c )
|
||
|
.Pp
|
||
|
Control over tty output after processes are started is primitive; perhaps
|
||
|
this will inspire someone to work on a good virtual terminal interface.
|
||
|
In a virtual terminal interface much more interesting things could be
|
||
|
done with output control.
|
||
|
.Pp
|
||
|
Alias substitution is most often used to clumsily simulate shell procedures;
|
||
|
shell procedures should be provided rather than aliases.
|
||
|
.Pp
|
||
|
Control structures should be parsed rather than being recognized as
|
||
|
built-in commands.
|
||
|
This would allow control commands to be placed anywhere,
|
||
|
to be combined with
|
||
|
.Sq |
|
||
|
, and to be used with
|
||
|
.Sq &
|
||
|
and
|
||
|
.Sq ;
|
||
|
metasyntax.
|
||
|
.Pp
|
||
|
.Va foreach
|
||
|
doesn't ignore here documents when looking for its
|
||
|
.Va end
|
||
|
.Pp
|
||
|
It should be possible to use the
|
||
|
.Sq \&:
|
||
|
modifiers on the output of command
|
||
|
substitutions.
|
||
|
.Pp
|
||
|
The screen update for lines longer than the screen width is very poor
|
||
|
if the terminal cannot move the cursor up (i.e., terminal type
|
||
|
.Sq dumb
|
||
|
).
|
||
|
.Pp
|
||
|
.Va HPATH
|
||
|
and
|
||
|
.Va NOREBIND
|
||
|
don't need to be environment variables.
|
||
|
.Pp
|
||
|
Glob-patterns which do not use
|
||
|
.Sq \&?
|
||
|
,
|
||
|
.Sq *
|
||
|
or
|
||
|
.Sq []
|
||
|
or which use
|
||
|
.Sq {}
|
||
|
or
|
||
|
.Sq ~
|
||
|
are not negated correctly.
|
||
|
.Pp
|
||
|
The single-command form of
|
||
|
.Va if
|
||
|
does output redirection even if
|
||
|
the expression is false and the command is not executed.
|
||
|
.Pp
|
||
|
\fIls\-F\fR includes file identification characters when sorting filenames
|
||
|
and does not handle control characters in filenames well.
|
||
|
It cannot be
|
||
|
interrupted.
|
||
|
.Pp
|
||
|
Command substitution supports multiple commands and conditions, but not
|
||
|
cycles or backward
|
||
|
.Va goto
|
||
|
s.
|
||
|
.Pp
|
||
|
Report bugs at http://bugs.gw.com/, preferably with fixes.
|
||
|
If you want to
|
||
|
help maintain and test tcsh, send mail to tcsh-request@mx.gw.com with the
|
||
|
text
|
||
|
.Sq subscribe tcsh
|
||
|
on a line by itself in the body.
|
||
|
.Sh THE T IN TCSH
|
||
|
In 1964, DEC produced the PDP-6.
|
||
|
The PDP-10 was a later re-implementation.
|
||
|
It
|
||
|
was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
|
||
|
second model, the KI10.
|
||
|
.Pp
|
||
|
TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
|
||
|
think tank) in
|
||
|
1972 as an experiment in demand-paged virtual memory operating systems.
|
||
|
They
|
||
|
built a new pager for the DEC PDP-10 and created the OS to go with it.
|
||
|
It was
|
||
|
extremely successful in academia.
|
||
|
.Pp
|
||
|
In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
|
||
|
have only a version of TENEX, which they had licensed from BBN, for the new
|
||
|
box.
|
||
|
They called their version TOPS-20 (their capitalization is trademarked).
|
||
|
A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
|
||
|
found themselves supporting two incompatible systems on the same hardware--but
|
||
|
then there were 6 on the PDP-11!
|
||
|
.Pp
|
||
|
TENEX, and TOPS-20 to version 3, had command completion
|
||
|
via a user-code-level subroutine library called ULTCMD.
|
||
|
With version 3, DEC
|
||
|
moved all that capability and more into the monitor (`kernel' for you Unix
|
||
|
types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
|
||
|
supervisor call mechanism [are my IBM roots also showing?]).
|
||
|
.Pp
|
||
|
The creator of tcsh was impressed by this feature and several others of TENEX
|
||
|
and TOPS-20, and created a version of csh which mimicked them.
|
||
|
.Sh LIMITATIONS
|
||
|
The system limits argument lists to ARG_MAX characters.
|
||
|
.Pp
|
||
|
The number of arguments to a command which involves filename expansion is
|
||
|
limited to 1/6th the number of characters allowed in an argument list.
|
||
|
.Pp
|
||
|
Command substitutions may substitute no more characters than are allowed in
|
||
|
an argument list.
|
||
|
.Pp
|
||
|
To detect looping, the shell restricts the number of
|
||
|
.Va alias
|
||
|
substitutions on a single line to 20.
|
||
|
.Sh "SEE ALSO"
|
||
|
csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
|
||
|
tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
|
||
|
pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
|
||
|
malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
|
||
|
termio(7), Introduction to the C Shell
|
||
|
.Sh VERSION
|
||
|
This manual documents tcsh 6.20.00 (Astron) 2016-11-24.
|
||
|
.Sh AUTHORS
|
||
|
.PD 0
|
||
|
.TP 2
|
||
|
William Joy
|
||
|
Original author of
|
||
|
.Xr csh 1
|
||
|
.TP 2
|
||
|
J.E. Kulp, IIASA, Laxenburg, Austria
|
||
|
Job control and directory stack features
|
||
|
.TP 2
|
||
|
Ken Greer, HP Labs, 1981
|
||
|
File name completion
|
||
|
.TP 2
|
||
|
Mike Ellis, Fairchild, 1983
|
||
|
Command name recognition/completion
|
||
|
.TP 2
|
||
|
Paul Placeway, Ohio State CIS Dept., 1983-1993
|
||
|
Command line editor, prompt routines, new glob syntax and numerous fixes
|
||
|
and speedups
|
||
|
.TP 2
|
||
|
Karl Kleinpaste, CCI 1983-4
|
||
|
Special aliases, directory stack extraction stuff, login/logout watch,
|
||
|
scheduled events, and the idea of the new prompt format
|
||
|
.TP 2
|
||
|
Rayan Zachariassen, University of Toronto, 1984
|
||
|
\fIls\-F\fR and
|
||
|
.Va which
|
||
|
builtins and numerous bug fixes, modifications
|
||
|
and speedups
|
||
|
.TP 2
|
||
|
Chris Kingsley, Caltech
|
||
|
Fast storage allocator routines
|
||
|
.TP 2
|
||
|
Chris Grevstad, TRW, 1987
|
||
|
Incorporated 4.3BSD
|
||
|
.Xr csh 1
|
||
|
into
|
||
|
.Nm
|
||
|
.TP 2
|
||
|
Christos S. Zoulas, Cornell U. EE Dept., 1987-94
|
||
|
Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
|
||
|
and a new version of sh.glob.c
|
||
|
.TP 2
|
||
|
James J Dempsey, BBN, and Paul Placeway, OSU, 1988
|
||
|
A/UX port
|
||
|
.TP 2
|
||
|
Daniel Long, NNSC, 1988
|
||
|
.Va wordchars
|
||
|
.TP 2
|
||
|
Patrick Wolfe, Kuck and Associates, Inc., 1988
|
||
|
.Va vi
|
||
|
mode cleanup
|
||
|
.TP 2
|
||
|
David C Lawrence, Rensselaer Polytechnic Institute, 1989
|
||
|
.Va autolist
|
||
|
and ambiguous completion listing
|
||
|
.TP 2
|
||
|
Alec Wolman, DEC, 1989
|
||
|
Newlines in the prompt
|
||
|
.TP 2
|
||
|
Matt Landau, BBN, 1989
|
||
|
.Va ~/.tcshrc
|
||
|
.TP 2
|
||
|
Ray Moody, Purdue Physics, 1989
|
||
|
Magic space bar history expansion
|
||
|
.TP 2
|
||
|
Mordechai ????, Intel, 1989
|
||
|
printprompt() fixes and additions
|
||
|
.TP 2
|
||
|
Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
|
||
|
Automatic spelling correction and
|
||
|
.Va prompt3
|
||
|
.TP 2
|
||
|
Per Hedeland, Ellemtel, Sweden, 1990-
|
||
|
Various bugfixes, improvements and manual updates
|
||
|
.TP 2
|
||
|
Hans J. Albertsson (Sun Sweden)
|
||
|
.Va ampm
|
||
|
,
|
||
|
.Va settc
|
||
|
and
|
||
|
.Va telltc
|
||
|
.TP 2
|
||
|
Michael Bloom
|
||
|
Interrupt handling fixes
|
||
|
.TP 2
|
||
|
Michael Fine, Digital Equipment Corp
|
||
|
Extended key support
|
||
|
.TP 2
|
||
|
Eric Schnoebelen, Convex, 1990
|
||
|
Convex support, lots of
|
||
|
.Xr csh 1
|
||
|
bug fixes,
|
||
|
save and restore of directory stack
|
||
|
.TP 2
|
||
|
Ron Flax, Apple, 1990
|
||
|
A/UX 2.0 (re)port
|
||
|
.TP 2
|
||
|
Dan Oscarsson, LTH Sweden, 1990
|
||
|
NLS support and simulated NLS support for non NLS sites, fixes
|
||
|
.TP 2
|
||
|
Johan Widen, SICS Sweden, 1990
|
||
|
.Va shlvl
|
||
|
, Mach support,
|
||
|
.Va correct-line
|
||
|
, 8-bit printing
|
||
|
.TP 2
|
||
|
Matt Day, Sanyo Icon, 1990
|
||
|
POSIX termio support, SysV limit fixes
|
||
|
.TP 2
|
||
|
Jaap Vermeulen, Sequent, 1990-91
|
||
|
Vi mode fixes, expand-line, window change fixes, Symmetry port
|
||
|
.TP 2
|
||
|
Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
|
||
|
.Va autolist
|
||
|
beeping options, modified the history search to search for
|
||
|
the whole string from the beginning of the line to the cursor.
|
||
|
.TP 2
|
||
|
Scott Krotz, Motorola, 1991
|
||
|
Minix port
|
||
|
.TP 2
|
||
|
David Dawes, Sydney U. Australia, Physics Dept., 1991
|
||
|
SVR4 job control fixes
|
||
|
.TP 2
|
||
|
Jose Sousa, Interactive Systems Corp., 1991
|
||
|
Extended
|
||
|
.Va vi
|
||
|
fixes and
|
||
|
.Va vi
|
||
|
delete command
|
||
|
.TP 2
|
||
|
Marc Horowitz, MIT, 1991
|
||
|
ANSIfication fixes, new exec hashing code, imake fixes,
|
||
|
.Va where
|
||
|
.TP 2
|
||
|
Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995
|
||
|
ETA and Pyramid port, Makefile and lint fixes,
|
||
|
.Va ignoreeof
|
||
|
=n addition, and
|
||
|
various other portability changes and bug fixes
|
||
|
.TP 2
|
||
|
Jeff Fink, 1992
|
||
|
.Va complete-word-fwd
|
||
|
and
|
||
|
.Va complete-word-back
|
||
|
.TP 2
|
||
|
Harry C. Pulley, 1992
|
||
|
Coherent port
|
||
|
.TP 2
|
||
|
Andy Phillips, Mullard Space Science Lab U.K., 1992
|
||
|
VMS-POSIX port
|
||
|
.TP 2
|
||
|
Beto Appleton, IBM Corp., 1992
|
||
|
Walking process group fixes,
|
||
|
.Xr csh 1
|
||
|
bug fixes,
|
||
|
POSIX file tests, POSIX SIGHUP
|
||
|
.TP 2
|
||
|
Scott Bolte, Cray Computer Corp., 1992
|
||
|
CSOS port
|
||
|
.TP 2
|
||
|
Kaveh R. Ghazi, Rutgers University, 1992
|
||
|
Tek, m88k, Titan and Masscomp ports and fixes.
|
||
|
Added autoconf support.
|
||
|
.TP 2
|
||
|
Mark Linderman, Cornell University, 1992
|
||
|
OS/2 port
|
||
|
.TP 2
|
||
|
Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
|
||
|
Linux port
|
||
|
.TP 2
|
||
|
Tim P. Starrin, NASA Langley Research Center Operations, 1993
|
||
|
Read-only variables
|
||
|
.TP 2
|
||
|
Dave Schweisguth, Yale University, 1993-4
|
||
|
New man page and tcsh.man2html
|
||
|
.TP 2
|
||
|
Larry Schwimmer, Stanford University, 1993
|
||
|
AFS and HESIOD patches
|
||
|
.TP 2
|
||
|
Luke Mewburn, RMIT University, 1994-6
|
||
|
Enhanced directory printing in prompt,
|
||
|
added
|
||
|
.Va ellipsis
|
||
|
and
|
||
|
.Va rprompt
|
||
|
.TP 2
|
||
|
Edward Hutchins, Silicon Graphics Inc., 1996
|
||
|
Added implicit cd.
|
||
|
.TP 2
|
||
|
Martin Kraemer, 1997
|
||
|
Ported to Siemens Nixdorf EBCDIC machine
|
||
|
.TP 2
|
||
|
Amol Deshpande, Microsoft, 1997
|
||
|
Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
|
||
|
and message catalog code to interface to Windows.
|
||
|
.TP 2
|
||
|
Taga Nayuta, 1998
|
||
|
Color ls additions.
|
||
|
.PD
|
||
|
.Pp
|
||
|
.Sh "THANKS TO"
|
||
|
Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
|
||
|
Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
|
||
|
the other people at Ohio State for suggestions and encouragement
|
||
|
.Pp
|
||
|
All the people on the net, for putting up with,
|
||
|
reporting bugs in, and suggesting new additions to each and every version
|
||
|
.Pp
|
||
|
Richard M. Alderson III, for writing the
|
||
|
.Sq T in tcsh
|
||
|
section
|