xref: /freebsd/contrib/tcsh/tcsh.man.new (revision 5224c2a3bc95b431f729f3692f264395248d8acc)
1cc698b49SBrooks Davis.\"
219d2e3deSDmitry Chagin.\" Copyright (c) 1980, 1990, 1993
319d2e3deSDmitry Chagin.\"	The Regents of the University of California.  All rights reserved.
419d2e3deSDmitry Chagin.\"
519d2e3deSDmitry Chagin.\" Redistribution and use in source and binary forms, with or without
619d2e3deSDmitry Chagin.\" modification, are permitted provided that the following conditions
719d2e3deSDmitry Chagin.\" are met:
819d2e3deSDmitry Chagin.\" 1. Redistributions of source code must retain the above copyright
919d2e3deSDmitry Chagin.\"    notice, this list of conditions and the following disclaimer.
1019d2e3deSDmitry Chagin.\" 2. Redistributions in binary form must reproduce the above copyright
1119d2e3deSDmitry Chagin.\"    notice, this list of conditions and the following disclaimer in the
1219d2e3deSDmitry Chagin.\"    documentation and/or other materials provided with the distribution.
1319d2e3deSDmitry Chagin.\" 3. Neither the name of the University nor the names of its contributors
1419d2e3deSDmitry Chagin.\"    may be used to endorse or promote products derived from this software
1519d2e3deSDmitry Chagin.\"    without specific prior written permission.
1619d2e3deSDmitry Chagin.\"
1719d2e3deSDmitry Chagin.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
1819d2e3deSDmitry Chagin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1919d2e3deSDmitry Chagin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2019d2e3deSDmitry Chagin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2119d2e3deSDmitry Chagin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2219d2e3deSDmitry Chagin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2319d2e3deSDmitry Chagin.\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2419d2e3deSDmitry Chagin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2519d2e3deSDmitry Chagin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2619d2e3deSDmitry Chagin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2719d2e3deSDmitry Chagin.\" SUCH DAMAGE.
2819d2e3deSDmitry Chagin.\"
2919d2e3deSDmitry Chagin.\" - Indent in multiples of 4, usually 8.
3019d2e3deSDmitry Chagin.\"
3119d2e3deSDmitry Chagin.\" - Use \` for literal back-quote (`).
3219d2e3deSDmitry Chagin.\"
3319d2e3deSDmitry Chagin.\" - Use \e for literal backslash (\).
3419d2e3deSDmitry Chagin.\"
3519d2e3deSDmitry Chagin.\" - Use \-, not -.
3619d2e3deSDmitry Chagin.\"
3719d2e3deSDmitry Chagin.\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
3819d2e3deSDmitry Chagin.\"
3919d2e3deSDmitry Chagin.\" - Refer to external commands in man page format, e.g., .Xr csh 1
4019d2e3deSDmitry Chagin.\" However, tcsh is .Nm , because this is the tcsh man page (and
4119d2e3deSDmitry Chagin.\" see the next note anyway).
4219d2e3deSDmitry Chagin.\"
4319d2e3deSDmitry Chagin.\" - Say .Sq the shell , not .Sq tcsh ,
4419d2e3deSDmitry Chagin.\" unless distinguishing between tcsh and csh.
4519d2e3deSDmitry Chagin.\"
4619d2e3deSDmitry Chagin.\" - Say .Sq shell variable / .Sq environment variable instead of
4719d2e3deSDmitry Chagin.\" .Sq variable and .Sq builtin command / .Sq editor command instead of
4819d2e3deSDmitry Chagin.\" .Sq builtin or .Sq command
4919d2e3deSDmitry Chagin.\"   unless the distinction is absolutely clear from context.
5019d2e3deSDmitry Chagin.\"
5119d2e3deSDmitry Chagin.\" - Use the simple present tense.
5219d2e3deSDmitry Chagin.\" .Sq The shell uses , not .Sq The shell will use
5319d2e3deSDmitry Chagin.\"
5419d2e3deSDmitry Chagin.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
5519d2e3deSDmitry Chagin.\"   etc. in the reference section should be mentioned in the appropriate
5619d2e3deSDmitry Chagin.\"   descriptive section, or at least in the reference-section description
5719d2e3deSDmitry Chagin.\"   of another command (or whatever) which is mentioned in a description
5819d2e3deSDmitry Chagin.\"   section. Remember to note OS-specific things in "OS variant support",
5919d2e3deSDmitry Chagin.\"   new features in NEW FEATURES and referenced external commands in SEE
6019d2e3deSDmitry Chagin.\"   ALSO.
6119d2e3deSDmitry Chagin.\"
6219d2e3deSDmitry Chagin.\" - tcsh.man2html depends heavily on the specific nroff commands used in the
6319d2e3deSDmitry Chagin.\"   man page when the script was written. Please stick closely to the style
6419d2e3deSDmitry Chagin.\"   used here if you can. In particular, please don't use nroff commands
6519d2e3deSDmitry Chagin.\"   which aren't already used herein.
6619d2e3deSDmitry Chagin.\"
67*5224c2a3SDmitry Chagin.Dd Noverber 18, 2020
6819d2e3deSDmitry Chagin.Dt TCSH 1
69*5224c2a3SDmitry Chagin.Os Astron 6.22.02
7019d2e3deSDmitry Chagin.Sh NAME
7119d2e3deSDmitry Chagin.Nm tcsh
7219d2e3deSDmitry Chagin.Nd C shell with file name completion and command line editing
7319d2e3deSDmitry Chagin.Sh SYNOPSIS
7419d2e3deSDmitry Chagin.Nm
7519d2e3deSDmitry Chagin.Op Fl bcdefFimnqstvVxX
7619d2e3deSDmitry Chagin.Op Fl Dname Ns Op =value
7719d2e3deSDmitry Chagin.Op Ar arg ...
7819d2e3deSDmitry Chagin.Nm
7919d2e3deSDmitry Chagin.Fl l
8019d2e3deSDmitry Chagin.Ek
8119d2e3deSDmitry Chagin.Sh DESCRIPTION
8219d2e3deSDmitry Chagin.Nm
8319d2e3deSDmitry Chaginis an enhanced but completely compatible version of the Berkeley
8419d2e3deSDmitry ChaginUNIX C shell,
8519d2e3deSDmitry Chagin.Xr csh 1 .
8619d2e3deSDmitry ChaginIt is a command language interpreter usable both as an interactive login
8719d2e3deSDmitry Chaginshell and a shell script command processor.
8819d2e3deSDmitry ChaginIt includes a command-line editor (see
8919d2e3deSDmitry Chagin.Sx The command-line editor )
9019d2e3deSDmitry Chaginprogrammable word completion (see
9119d2e3deSDmitry Chagin.Sx Completion and listing )
9219d2e3deSDmitry Chaginspelling correction (see
9319d2e3deSDmitry Chagin.Sx Spelling correction ) ,
9419d2e3deSDmitry Chagina history mechanism (see
9519d2e3deSDmitry Chagin.Sx History substitution ) ,
9619d2e3deSDmitry Chaginjob control (see
9719d2e3deSDmitry Chagin.Sx Jobs )
9819d2e3deSDmitry Chaginand a C-like syntax.
9919d2e3deSDmitry ChaginThe
10019d2e3deSDmitry Chagin.Sx NEW FEATURES
10119d2e3deSDmitry Chaginsection describes major enhancements of
10219d2e3deSDmitry Chagin.Nm
10319d2e3deSDmitry Chaginover
10419d2e3deSDmitry Chagin.Xr csh 1 .
10519d2e3deSDmitry ChaginThroughout this manual, features of
10619d2e3deSDmitry Chagin.Nm
10719d2e3deSDmitry Chaginnot found in most
10819d2e3deSDmitry Chagin.Xr csh 1
10919d2e3deSDmitry Chaginimplementations
11019d2e3deSDmitry Chagin(specifically, the 4.4BSD one)
11119d2e3deSDmitry Chaginare labeled with
11219d2e3deSDmitry Chagin.Sq (+) ,
11319d2e3deSDmitry Chaginand features which are present in
11419d2e3deSDmitry Chagin.Xr csh 1
11519d2e3deSDmitry Chaginbut not usually documented are labeled with
11619d2e3deSDmitry Chagin.Sq (u) .
11719d2e3deSDmitry Chagin.Bl -tag
11819d2e3deSDmitry Chagin.Ss Argument list processing
11919d2e3deSDmitry ChaginIf the first argument (argument 0) to the shell is
12019d2e3deSDmitry Chagin.Sq \-
12119d2e3deSDmitry Chaginthen it is a login shell.
12219d2e3deSDmitry ChaginA login shell can be also specified by invoking the shell with
12319d2e3deSDmitry Chaginthe
12419d2e3deSDmitry Chagin.Fl l
12519d2e3deSDmitry Chaginflag as the only argument.
12619d2e3deSDmitry Chagin.Pp
12719d2e3deSDmitry ChaginThe rest of the flag arguments are interpreted as follows:
12819d2e3deSDmitry Chagin.Bl -tag -width indent
12919d2e3deSDmitry Chagin.It Fl b
13019d2e3deSDmitry ChaginForces a
13119d2e3deSDmitry Chagin.Dq break
13219d2e3deSDmitry Chaginfrom option processing, causing any
13319d2e3deSDmitry Chaginfurther shell arguments to be treated as non-option arguments.
13419d2e3deSDmitry ChaginThe remaining arguments will not be interpreted as shell options.
13519d2e3deSDmitry ChaginThis may be used to pass options to a shell script without confusion
13619d2e3deSDmitry Chaginor possible subterfuge.
13719d2e3deSDmitry ChaginThe shell will not run a set-user ID script without this option.
13819d2e3deSDmitry Chagin.It Fl c
13919d2e3deSDmitry ChaginCommands are read from the following argument (which must be present, and
14019d2e3deSDmitry Chaginmust be a single argument),
14119d2e3deSDmitry Chaginstored in the
14219d2e3deSDmitry Chagin.Va command
14319d2e3deSDmitry Chaginshell variable for reference, and executed.
14419d2e3deSDmitry ChaginAny remaining arguments are placed in the
14519d2e3deSDmitry Chagin.Va argv
14619d2e3deSDmitry Chaginshell variable.
14719d2e3deSDmitry Chagin.It Fl d
14819d2e3deSDmitry ChaginThe shell loads the directory stack from
14919d2e3deSDmitry Chagin.Pa ~/.cshdirs
15019d2e3deSDmitry Chaginas described under
15119d2e3deSDmitry Chagin.Sx Startup and shutdown ,
15219d2e3deSDmitry Chaginwhether or not it is a login shell. (+)
15319d2e3deSDmitry Chagin.It Fl Dname Ns Op =value
15419d2e3deSDmitry ChaginSets the environment variable
15519d2e3deSDmitry Chagin.Va name
15619d2e3deSDmitry Chagin.Dv value .
15719d2e3deSDmitry Chagin(Domain/OS only) (+)
15819d2e3deSDmitry Chagin.It Fl e
15919d2e3deSDmitry ChaginThe shell exits if any invoked command terminates abnormally or
16019d2e3deSDmitry Chaginyields a non-zero exit status.
16119d2e3deSDmitry Chagin.It Fl f
16219d2e3deSDmitry ChaginThe shell does not load any resource or startup files, or perform any
16319d2e3deSDmitry Chagincommand hashing, and thus starts faster.
16419d2e3deSDmitry Chagin.It Fl F
16519d2e3deSDmitry ChaginThe shell uses
16619d2e3deSDmitry Chagin.Xr fork 2
16719d2e3deSDmitry Chagininstead of
16819d2e3deSDmitry Chagin.Xr vfork 2
16919d2e3deSDmitry Chaginto spawn processes. (+)
17019d2e3deSDmitry Chagin.It Fl i
17119d2e3deSDmitry ChaginThe shell is interactive and prompts for its top-level input, even if
17219d2e3deSDmitry Chaginit appears to not be a terminal.
17319d2e3deSDmitry ChaginShells are interactive without this option if
17419d2e3deSDmitry Chagintheir inputs and outputs are terminals.
17519d2e3deSDmitry Chagin.It Fl l
17619d2e3deSDmitry ChaginThe shell is a login shell.
17719d2e3deSDmitry ChaginApplicable only if
17819d2e3deSDmitry Chagin.Fl l
17919d2e3deSDmitry Chaginis the only
18019d2e3deSDmitry Chaginflag specified.
18119d2e3deSDmitry Chagin.It Fl m
18219d2e3deSDmitry ChaginThe shell loads
18319d2e3deSDmitry Chagin.Pa ~/.tcshrc
18419d2e3deSDmitry Chagineven if it does not belong to the effective user.
18519d2e3deSDmitry ChaginNewer versions of
18619d2e3deSDmitry Chagin.Xr su 1
18719d2e3deSDmitry Chagincan pass
18819d2e3deSDmitry Chagin.Fl m
18919d2e3deSDmitry Chaginto the shell. (+)
19019d2e3deSDmitry Chagin.It Fl n
19119d2e3deSDmitry ChaginThe shell parses commands but does not execute them.
19219d2e3deSDmitry ChaginThis aids in debugging shell scripts.
19319d2e3deSDmitry Chagin.It Fl q
19419d2e3deSDmitry ChaginThe shell accepts SIGQUIT (see
19519d2e3deSDmitry Chagin.Sx Signal handling )
19619d2e3deSDmitry Chaginand behaves when it is used under a debugger.
19719d2e3deSDmitry ChaginJob control is disabled. (u)
19819d2e3deSDmitry Chagin.It Fl s
19919d2e3deSDmitry ChaginCommand input is taken from the standard input.
20019d2e3deSDmitry Chagin.It Fl t
20119d2e3deSDmitry ChaginThe shell reads and executes a single line of input.
20219d2e3deSDmitry ChaginA
20319d2e3deSDmitry Chagin.Sq \e
20419d2e3deSDmitry Chaginmay be used to
20519d2e3deSDmitry Chaginescape the newline at the end of this line and continue onto another line.
20619d2e3deSDmitry Chagin.It Fl v
20719d2e3deSDmitry ChaginSets the
20819d2e3deSDmitry Chagin.Va verbose
20919d2e3deSDmitry Chaginshell variable, so that
21019d2e3deSDmitry Chagincommand input is echoed after history substitution.
21119d2e3deSDmitry Chagin.It Fl x
21219d2e3deSDmitry ChaginSets the
21319d2e3deSDmitry Chagin.Va echo
21419d2e3deSDmitry Chaginshell variable, so that commands are echoed
21519d2e3deSDmitry Chaginimmediately before execution.
21619d2e3deSDmitry Chagin.It Fl V
21719d2e3deSDmitry ChaginSets the
21819d2e3deSDmitry Chagin.Va verbose
21919d2e3deSDmitry Chaginshell variable even before executing
22019d2e3deSDmitry Chagin.Pa ~/.tcshrc .
22119d2e3deSDmitry Chagin.It Fl X
22219d2e3deSDmitry ChaginIs to
22319d2e3deSDmitry Chagin.Fl x
22419d2e3deSDmitry Chaginas
22519d2e3deSDmitry Chagin.Fl V
22619d2e3deSDmitry Chaginis to
22719d2e3deSDmitry Chagin.Fl v .
22819d2e3deSDmitry Chagin.TP 4
22919d2e3deSDmitry Chagin.It Fl \-help
23019d2e3deSDmitry ChaginPrint a help message on the standard output and exit. (+)
23119d2e3deSDmitry Chagin.It Fl \-version
23219d2e3deSDmitry ChaginPrint the version/platform/compilation options on the standard output and exit.
23319d2e3deSDmitry ChaginThis information is also contained in the
23419d2e3deSDmitry Chagin.Va version
23519d2e3deSDmitry Chaginshell variable. (+)
23619d2e3deSDmitry Chagin.El
23719d2e3deSDmitry Chagin.Pp
23819d2e3deSDmitry ChaginAfter processing of flag arguments, if arguments remain but none of the
23919d2e3deSDmitry Chagin.Fl c ,
24019d2e3deSDmitry Chagin.Fl i ,
24119d2e3deSDmitry Chagin.Fl s ,
24219d2e3deSDmitry Chaginor
24319d2e3deSDmitry Chagin.Fl t
24419d2e3deSDmitry Chaginoptions were given, the first argument is taken as the name of a file of
24519d2e3deSDmitry Chagincommands, or
24619d2e3deSDmitry Chagin.Dq script ,
24719d2e3deSDmitry Chaginto be executed.
24819d2e3deSDmitry ChaginThe shell opens this file and saves its name for possible
24919d2e3deSDmitry Chaginresubstitution by
25019d2e3deSDmitry Chagin.Sq $0 .
25119d2e3deSDmitry ChaginBecause many systems use either the standard
25219d2e3deSDmitry Chaginversion 6 or version 7 shells whose shell scripts are not compatible
25319d2e3deSDmitry Chaginwith this shell, the shell uses such a
25419d2e3deSDmitry Chagin.Sq standard
25519d2e3deSDmitry Chaginshell to execute a script
25619d2e3deSDmitry Chaginwhose first character is not a
25719d2e3deSDmitry Chagin.Sq # ,
25819d2e3deSDmitry Chagini.e., that does not start with a
25919d2e3deSDmitry Chagincomment.
26019d2e3deSDmitry Chagin.Pp
26119d2e3deSDmitry ChaginRemaining arguments are placed in the
26219d2e3deSDmitry Chagin.Va argv
26319d2e3deSDmitry Chaginshell variable.
26419d2e3deSDmitry Chagin.Ss Startup and shutdown
26519d2e3deSDmitry ChaginA login shell begins by executing commands from the system files
26619d2e3deSDmitry Chagin.Pa /etc/csh.cshrc
26719d2e3deSDmitry Chaginand
26819d2e3deSDmitry Chagin.Pa /etc/csh.login .
26919d2e3deSDmitry ChaginIt then executes commands from files in the user's
27019d2e3deSDmitry Chagin.Pa home
27119d2e3deSDmitry Chagindirectory:
27219d2e3deSDmitry Chaginfirst
27319d2e3deSDmitry Chagin.Pa ~/.tcshrc (+)
27419d2e3deSDmitry Chaginor, if
27519d2e3deSDmitry Chagin.Pa ~/.tcshrc
27619d2e3deSDmitry Chaginis not found,
27719d2e3deSDmitry Chagin.Pa ~/.cshrc ,
27819d2e3deSDmitry Chaginthen
27919d2e3deSDmitry Chagin.Pa ~/.history
28019d2e3deSDmitry Chagin(or the value of the
28119d2e3deSDmitry Chagin.Va histfile
28219d2e3deSDmitry Chaginshell variable), then
28319d2e3deSDmitry Chagin.Pa ~/.login ,
28419d2e3deSDmitry Chaginand finally
28519d2e3deSDmitry Chagin.Pa ~/.cshdirs
28619d2e3deSDmitry Chagin(or the value of the
28719d2e3deSDmitry Chagin.Va dirsfile
28819d2e3deSDmitry Chaginshell variable) (+).
28919d2e3deSDmitry ChaginThe shell may read
29019d2e3deSDmitry Chagin.Pa /etc/csh.login
29119d2e3deSDmitry Chaginbefore instead of after
29219d2e3deSDmitry Chagin.Pa /etc/csh.cshrc ,
29319d2e3deSDmitry Chaginand
29419d2e3deSDmitry Chagin.Pa ~/.login
29519d2e3deSDmitry Chaginbefore instead of after
29619d2e3deSDmitry Chagin.Pa ~/.tcshrc
29719d2e3deSDmitry Chaginor
29819d2e3deSDmitry Chagin.Pa ~/.cshrc
29919d2e3deSDmitry Chaginand
30019d2e3deSDmitry Chagin.Pa ~/.history ,
30119d2e3deSDmitry Chaginif so compiled;
30219d2e3deSDmitry Chaginsee the
30319d2e3deSDmitry Chagin.Va version
30419d2e3deSDmitry Chaginshell variable. (+)
30519d2e3deSDmitry Chagin.Pp
30619d2e3deSDmitry ChaginNon-login shells read only
30719d2e3deSDmitry Chagin.Pa /etc/csh.cshrc
30819d2e3deSDmitry Chaginand
30919d2e3deSDmitry Chagin.Pa ~/.tcshrc
31019d2e3deSDmitry Chaginor
31119d2e3deSDmitry Chagin.Pa ~/.cshrc
31219d2e3deSDmitry Chaginon startup.
31319d2e3deSDmitry Chagin.Pp
31419d2e3deSDmitry ChaginFor examples of startup files, please consult:
31519d2e3deSDmitry Chagin.Lk http://tcshrc.sourceforge.net
31619d2e3deSDmitry Chagin.Pp
31719d2e3deSDmitry ChaginCommands like
31819d2e3deSDmitry Chagin.Xr stty 1
31919d2e3deSDmitry Chaginand
32019d2e3deSDmitry Chagin.Xr tset 1 ,
32119d2e3deSDmitry Chaginwhich need be run only once per login, usually go in one's
32219d2e3deSDmitry Chagin.Pa ~/.login
32319d2e3deSDmitry Chaginfile.
32419d2e3deSDmitry ChaginUsers who need to use the same set of files with both
32519d2e3deSDmitry Chagin.Xr csh 1
32619d2e3deSDmitry Chaginand
32719d2e3deSDmitry Chagin.Nm
32819d2e3deSDmitry Chagincan have only a
32919d2e3deSDmitry Chagin.Pa ~/.cshrc
33019d2e3deSDmitry Chaginwhich checks for the existence of the
33119d2e3deSDmitry Chagin.Va tcsh
33219d2e3deSDmitry Chaginshell variable (q.v.) before using
33319d2e3deSDmitry Chagin.Nm \-
33419d2e3deSDmitry Chaginspecific commands,
33519d2e3deSDmitry Chaginor can have both a
33619d2e3deSDmitry Chagin.Pa ~/.cshrc
33719d2e3deSDmitry Chaginand a
33819d2e3deSDmitry Chagin.Pa ~/.tcshrc
33919d2e3deSDmitry Chaginwhich
34019d2e3deSDmitry Chagin.Ic sources
34119d2e3deSDmitry Chagin(see the builtin command)
34219d2e3deSDmitry Chagin.Pa ~/.cshrc .
34319d2e3deSDmitry ChaginThe rest of this manual uses
34419d2e3deSDmitry Chagin.Pa ~/.tcshrc
34519d2e3deSDmitry Chaginto mean
34619d2e3deSDmitry Chagin.Pa ~/.tcshrc
34719d2e3deSDmitry Chaginor,
34819d2e3deSDmitry Chaginif
34919d2e3deSDmitry Chagin.Pa ~/.tcshrc
35019d2e3deSDmitry Chaginis not found,
35119d2e3deSDmitry Chagin.Pa ~/.cshrc .
35219d2e3deSDmitry Chagin.Pp
35319d2e3deSDmitry ChaginIn the normal case, the shell begins reading commands from the terminal,
35419d2e3deSDmitry Chaginprompting with
35519d2e3deSDmitry Chagin.Sq >\~ .
35619d2e3deSDmitry Chagin(Processing of arguments and the use of the shell to
35719d2e3deSDmitry Chaginprocess files containing command scripts are described later.)
35819d2e3deSDmitry ChaginThe shell repeatedly reads a line of command input, breaks it into words,
35919d2e3deSDmitry Chaginplaces it on the command history list, parses it and executes each command
36019d2e3deSDmitry Chaginin the line.
36119d2e3deSDmitry Chagin.Pp
36219d2e3deSDmitry ChaginOne can log out by typing
36319d2e3deSDmitry Chagin.Sq ^D
36419d2e3deSDmitry Chaginon an empty line,
36519d2e3deSDmitry Chagin.Sq logout
36619d2e3deSDmitry Chaginor
36719d2e3deSDmitry Chagin.Sq login
36819d2e3deSDmitry Chaginor
36919d2e3deSDmitry Chaginvia the shell's autologout mechanism (see the
37019d2e3deSDmitry Chagin.Va autologout
37119d2e3deSDmitry Chaginshell variable).
37219d2e3deSDmitry ChaginWhen a login shell terminates it sets the
37319d2e3deSDmitry Chagin.Va logout
37419d2e3deSDmitry Chaginshell variable to
37519d2e3deSDmitry Chagin.Sq normal
37619d2e3deSDmitry Chaginor
37719d2e3deSDmitry Chagin.Sq automatic
37819d2e3deSDmitry Chaginas appropriate, then executes commands from the files
37919d2e3deSDmitry Chagin.Pa /etc/csh.logout
38019d2e3deSDmitry Chaginand
38119d2e3deSDmitry Chagin.Pa ~/.logout .
38219d2e3deSDmitry ChaginThe shell may drop DTR on logout
38319d2e3deSDmitry Chaginif so compiled; see the
38419d2e3deSDmitry Chagin.Va version
38519d2e3deSDmitry Chaginshell variable.
38619d2e3deSDmitry Chagin.Pp
38719d2e3deSDmitry ChaginThe names of the system login and logout files vary from system to system for
38819d2e3deSDmitry Chagincompatibility with different
38919d2e3deSDmitry Chagin.Xr csh 1
39019d2e3deSDmitry Chaginvariants; see
39119d2e3deSDmitry Chagin.Sx FILES .
39219d2e3deSDmitry Chagin.Ss Editing
39319d2e3deSDmitry ChaginWe first describe
394d803a9d0SBrooks Davis.Sx The command-line editor
39519d2e3deSDmitry ChaginThe
39619d2e3deSDmitry Chagin.Sx Completion and listing
39719d2e3deSDmitry Chaginand
39819d2e3deSDmitry Chagin.Sx Spelling correction
39919d2e3deSDmitry Chaginsections describe two sets of functionality that are implemented as editor
40019d2e3deSDmitry Chagincommands but which deserve their own treatment.
40119d2e3deSDmitry ChaginFinally,
40219d2e3deSDmitry Chagin.Sx Editor commands
40319d2e3deSDmitry Chaginlists and describes
40419d2e3deSDmitry Chaginthe editor commands specific to the shell and their default bindings.
405d803a9d0SBrooks Davis.Ss The command-line editor (+)
40619d2e3deSDmitry ChaginCommand-line input can be edited using key sequences much like those used in
40719d2e3deSDmitry Chagin.Xr emacs 1
40819d2e3deSDmitry Chaginor
40919d2e3deSDmitry Chagin.Xr vi 1 .
41019d2e3deSDmitry ChaginThe editor is active only when the
41119d2e3deSDmitry Chagin.Va edit
41219d2e3deSDmitry Chaginshell variable is set, which it is by default in interactive shells.
41319d2e3deSDmitry ChaginThe
41419d2e3deSDmitry Chagin.Ic bindkey
41519d2e3deSDmitry Chaginbuiltin can display and change key bindings.
41619d2e3deSDmitry Chagin.Xr emacs 1
41719d2e3deSDmitry Chaginstyle key bindings are used by default
41819d2e3deSDmitry Chagin(unless the shell was compiled otherwise; see the
41919d2e3deSDmitry Chagin.Va version
42019d2e3deSDmitry Chaginshell variable),
42119d2e3deSDmitry Chaginbut
42219d2e3deSDmitry Chagin.Ic bindkey
42319d2e3deSDmitry Chagincan change the key bindings to
42419d2e3deSDmitry Chagin.Xr vi 1
42519d2e3deSDmitry Chaginstyle bindings en masse.
42619d2e3deSDmitry Chagin.Pp
42719d2e3deSDmitry ChaginThe shell always binds the arrow keys (as defined in the
42819d2e3deSDmitry Chagin.Va TERMCAP
42919d2e3deSDmitry Chaginenvironment variable) to:
43019d2e3deSDmitry Chagin.Pp
43119d2e3deSDmitry Chagin.Bl -tag -width right -compact -offset indent
43219d2e3deSDmitry Chagin.It down
43319d2e3deSDmitry Chagin.Ic down-history
43419d2e3deSDmitry Chagin.It up
43519d2e3deSDmitry Chagin.Ic up-history
43619d2e3deSDmitry Chagin.It left
43719d2e3deSDmitry Chagin.Ic backward-char
43819d2e3deSDmitry Chagin.It right
43919d2e3deSDmitry Chagin.Ic forward-char
44019d2e3deSDmitry Chagin.El
44119d2e3deSDmitry Chagin.Pp
44219d2e3deSDmitry Chaginunless doing so would alter another single-character binding.
44319d2e3deSDmitry ChaginOne can set the arrow key escape sequences to the empty string with
44419d2e3deSDmitry Chagin.Va settc
44519d2e3deSDmitry Chaginto prevent these bindings.
44619d2e3deSDmitry ChaginThe ANSI/VT100 sequences for arrow keys are always bound.
44719d2e3deSDmitry Chagin.Pp
44819d2e3deSDmitry ChaginOther key bindings are, for the most part, what
44919d2e3deSDmitry Chagin.Xr emacs 1
45019d2e3deSDmitry Chaginand
45119d2e3deSDmitry Chagin.Xr vi 1
45219d2e3deSDmitry Chaginusers would expect and can easily be displayed by
45319d2e3deSDmitry Chagin.Ic bindkey ,
45419d2e3deSDmitry Chaginso there
45519d2e3deSDmitry Chaginis no need to list them here.
45619d2e3deSDmitry ChaginLikewise,
45719d2e3deSDmitry Chagin.Ic bindkey
45819d2e3deSDmitry Chagincan list the editor
45919d2e3deSDmitry Chagincommands with a short description of each.
46019d2e3deSDmitry ChaginCertain key bindings have different behavior depending if
46119d2e3deSDmitry Chagin.Xr emacs 1
46219d2e3deSDmitry Chaginor
46319d2e3deSDmitry Chagin.Xr vi 1
46419d2e3deSDmitry Chaginstyle bindings are being used; see
46519d2e3deSDmitry Chagin.Va vimode
46619d2e3deSDmitry Chaginfor more information.
46719d2e3deSDmitry Chagin.Pp
46819d2e3deSDmitry ChaginNote that editor commands do not have the same notion of a
46919d2e3deSDmitry Chagin.Dq word
47019d2e3deSDmitry Chaginas does the shell.
47119d2e3deSDmitry ChaginThe editor delimits words with any non-alphanumeric characters not in
47219d2e3deSDmitry Chaginthe shell variable
47319d2e3deSDmitry Chagin.Va wordchars ,
47419d2e3deSDmitry Chaginwhile the shell recognizes only whitespace
47519d2e3deSDmitry Chaginand some of the characters with special meanings to it, listed under
47619d2e3deSDmitry Chagin.Sx Lexical structure .
47719d2e3deSDmitry Chagin.Ss Completion and listing (+)
47819d2e3deSDmitry ChaginThe shell is often able to complete words when given a unique abbreviation.
47919d2e3deSDmitry ChaginType part of a word (for example
48019d2e3deSDmitry Chagin.Ic ls
48119d2e3deSDmitry Chagin.Pa /usr/lost )
48219d2e3deSDmitry Chaginand hit the tab key to run the
48319d2e3deSDmitry Chagin.Ic complete-word
48419d2e3deSDmitry Chagineditor command.
48519d2e3deSDmitry ChaginThe shell completes the filename
48619d2e3deSDmitry Chagin.Pa /usr/lost
48719d2e3deSDmitry Chaginto
48819d2e3deSDmitry Chagin.Pa /usr/lost+found/ ,
48919d2e3deSDmitry Chaginreplacing the incomplete word with the complete word in the input buffer.
49019d2e3deSDmitry Chagin(Note the terminal
49119d2e3deSDmitry Chagin.Sq / ;
49219d2e3deSDmitry Chagincompletion adds a
49319d2e3deSDmitry Chagin.Sq /
49419d2e3deSDmitry Chaginto the end of completed directories and a space to the end of other completed
49519d2e3deSDmitry Chaginwords, to speed typing and provide a visual indicator of successful completion.
49619d2e3deSDmitry ChaginThe
49719d2e3deSDmitry Chagin.Va addsuffix
49819d2e3deSDmitry Chaginshell variable can be unset to prevent this.)
49919d2e3deSDmitry ChaginIf no match is found (perhaps
50019d2e3deSDmitry Chagin.Pa /usr/lost+found
50119d2e3deSDmitry Chagindoesn't exist), the terminal bell rings.
50219d2e3deSDmitry ChaginIf the word is already complete (perhaps there is a
50319d2e3deSDmitry Chagin.Pa /usr/lost
50419d2e3deSDmitry Chaginon your
50519d2e3deSDmitry Chaginsystem, or perhaps you were thinking too far ahead and typed the whole thing)
50619d2e3deSDmitry Chagina
50719d2e3deSDmitry Chagin.Sq /
50819d2e3deSDmitry Chaginor space is added to the end if it isn't already there.
50919d2e3deSDmitry Chagin.Pp
51019d2e3deSDmitry ChaginCompletion works anywhere in the line, not at just the end; completed
51119d2e3deSDmitry Chagintext pushes the rest of the line to the right.
51219d2e3deSDmitry ChaginCompletion in the middle of a word
51319d2e3deSDmitry Chaginoften results in leftover characters to the right of the cursor that need
51419d2e3deSDmitry Chaginto be deleted.
51519d2e3deSDmitry Chagin.Pp
51619d2e3deSDmitry ChaginCommands and variables can be completed in much the same way.
51719d2e3deSDmitry ChaginFor example, typing
51819d2e3deSDmitry Chagin.Sq em[tab]
51919d2e3deSDmitry Chaginwould complete
52019d2e3deSDmitry Chagin.Sq em
52119d2e3deSDmitry Chaginto
52219d2e3deSDmitry Chagin.Sq emacs
52319d2e3deSDmitry Chaginif
52419d2e3deSDmitry Chagin.Pa emacs
52519d2e3deSDmitry Chaginwere the only command on your system beginning with
52619d2e3deSDmitry Chagin.Sq em .
52719d2e3deSDmitry ChaginCompletion can find a command in any directory in
52819d2e3deSDmitry Chagin.Pa path
52919d2e3deSDmitry Chaginor if given a full pathname.
53019d2e3deSDmitry ChaginTyping
53119d2e3deSDmitry Chagin.Sq echo $ar[tab]
53219d2e3deSDmitry Chaginwould complete
53319d2e3deSDmitry Chagin.Sq $ar
53419d2e3deSDmitry Chaginto
53519d2e3deSDmitry Chagin.Sq $argv
53619d2e3deSDmitry Chaginif no other variable began with
53719d2e3deSDmitry Chagin.Sq ar .
53819d2e3deSDmitry Chagin.Pp
53919d2e3deSDmitry ChaginThe shell parses the input buffer to determine whether the word you want to
54019d2e3deSDmitry Chagincomplete should be completed as a filename, command or variable.
54119d2e3deSDmitry ChaginThe first word in the buffer and the first word following
54219d2e3deSDmitry Chagin.Sq \&; ,
54319d2e3deSDmitry Chagin.Sq | ,
54419d2e3deSDmitry Chagin.Sq |& ,
54519d2e3deSDmitry Chagin.Sq &&
54619d2e3deSDmitry Chaginor
54719d2e3deSDmitry Chagin.Sq ||
54819d2e3deSDmitry Chaginis considered to be a command.
54919d2e3deSDmitry ChaginA word beginning with
55019d2e3deSDmitry Chagin.Sq $
55119d2e3deSDmitry Chaginis considered to be a variable.
55219d2e3deSDmitry ChaginAnything else is a filename.
55319d2e3deSDmitry ChaginAn empty line is
55419d2e3deSDmitry Chagin.Sq completed
55519d2e3deSDmitry Chaginas a filename.
55619d2e3deSDmitry Chagin.Pp
55719d2e3deSDmitry ChaginYou can list the possible completions of a word at any time by typing
55819d2e3deSDmitry Chagin.Sq ^D
55919d2e3deSDmitry Chaginto run the
56019d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
56119d2e3deSDmitry Chagineditor command.
56219d2e3deSDmitry ChaginThe shell lists the possible completions using the
56319d2e3deSDmitry Chagin.Ic ls\-F
56419d2e3deSDmitry Chaginbuiltin (q.v.)
56519d2e3deSDmitry Chaginand reprints the prompt and unfinished command line, for example:
56619d2e3deSDmitry Chagin.Bd -literal -offset indent
56719d2e3deSDmitry Chagin> ls /usr/l[^D]
56819d2e3deSDmitry Chaginlbin/       lib/        local/      lost+found/
56919d2e3deSDmitry Chagin> ls /usr/l
57019d2e3deSDmitry Chagin.Ed
57119d2e3deSDmitry Chagin.Pp
57219d2e3deSDmitry ChaginIf the
57319d2e3deSDmitry Chagin.Va autolist
57419d2e3deSDmitry Chaginshell variable is set, the shell lists the remaining
57519d2e3deSDmitry Chaginchoices (if any) whenever completion fails:
57619d2e3deSDmitry Chagin.Bd -literal -offset indent
57719d2e3deSDmitry Chagin> set autolist
57819d2e3deSDmitry Chagin> nm /usr/lib/libt[tab]
57919d2e3deSDmitry Chaginlibtermcap.a@ libtermlib.a@
58019d2e3deSDmitry Chagin> nm /usr/lib/libterm
58119d2e3deSDmitry Chagin.Ed
58219d2e3deSDmitry Chagin.Pp
58319d2e3deSDmitry ChaginIf
58419d2e3deSDmitry Chagin.Va autolist
58519d2e3deSDmitry Chaginshell variable is set to
58619d2e3deSDmitry Chagin.Sq ambiguous ,
58719d2e3deSDmitry Chaginchoices are listed only when
58819d2e3deSDmitry Chagincompletion fails and adds no new characters to the word being completed.
58919d2e3deSDmitry Chagin.Pp
59019d2e3deSDmitry ChaginA filename to be completed can contain variables, your own or others' home
59119d2e3deSDmitry Chagindirectories abbreviated with
59219d2e3deSDmitry Chagin.Sq ~
59319d2e3deSDmitry Chagin(see
59419d2e3deSDmitry Chagin.Sx Filename substitution )
59519d2e3deSDmitry Chaginand directory stack entries abbreviated with
59619d2e3deSDmitry Chagin.Sq =
59719d2e3deSDmitry Chagin(see
59819d2e3deSDmitry Chagin.Sx Directory stack substitution ) .
59919d2e3deSDmitry ChaginFor example,
60019d2e3deSDmitry Chagin.Bd -literal -offset indent
60119d2e3deSDmitry Chagin> ls ~k[^D]
60219d2e3deSDmitry Chaginkahn    kas     kellogg
60319d2e3deSDmitry Chagin> ls ~ke[tab]
60419d2e3deSDmitry Chagin> ls ~kellogg/
60519d2e3deSDmitry Chagin.Ed
60619d2e3deSDmitry Chaginor
60719d2e3deSDmitry Chagin.Bd -literal -offset indent
60819d2e3deSDmitry Chagin> set local = /usr/local
60919d2e3deSDmitry Chagin> ls $lo[tab]
61019d2e3deSDmitry Chagin> ls $local/[^D]
61119d2e3deSDmitry Chaginbin/ etc/ lib/ man/ src/
61219d2e3deSDmitry Chagin> ls $local/
61319d2e3deSDmitry Chagin.Ed
61419d2e3deSDmitry Chagin.Pp
61519d2e3deSDmitry ChaginNote that variables can also be expanded explicitly with the
61619d2e3deSDmitry Chagin.Ic expand-variables
61719d2e3deSDmitry Chagineditor command.
61819d2e3deSDmitry Chagin.Pp
61919d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
62019d2e3deSDmitry Chaginlists at only the end of the line;
62119d2e3deSDmitry Chaginin the middle of a line it deletes the character under the cursor and
62219d2e3deSDmitry Chaginon an empty line it logs one out or, if then
62319d2e3deSDmitry Chagin.Va ignoreeof
62419d2e3deSDmitry Chaginvariable is set, does nothing.
62519d2e3deSDmitry Chagin.Sq M-^D ,
62619d2e3deSDmitry Chaginbound to the editor command
62719d2e3deSDmitry Chagin.Ic list-choices ,
62819d2e3deSDmitry Chaginlists completion
62919d2e3deSDmitry Chaginpossibilities anywhere on a line, and
63019d2e3deSDmitry Chagin.Ic list-choices
63119d2e3deSDmitry Chagin(or any one of the
63219d2e3deSDmitry Chaginrelated editor commands that do or don't delete, list and/or log out,
63319d2e3deSDmitry Chaginlisted under
63419d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof )
63519d2e3deSDmitry Chagincan be bound to
63619d2e3deSDmitry Chagin.Sq ^D
63719d2e3deSDmitry Chaginwith the
63819d2e3deSDmitry Chagin.Ic bindkey
63919d2e3deSDmitry Chaginbuiltin command if so desired.
64019d2e3deSDmitry Chagin.Pp
64119d2e3deSDmitry ChaginThe
64219d2e3deSDmitry Chagin.Ic complete-word-fwd
64319d2e3deSDmitry Chaginand
64419d2e3deSDmitry Chagin.Ic complete-word-back
64519d2e3deSDmitry Chagineditor commands
64619d2e3deSDmitry Chagin(not bound to any keys by default) can be used to cycle up and down through
64719d2e3deSDmitry Chaginthe list of possible completions, replacing the current word with the next or
64819d2e3deSDmitry Chaginprevious word in the list.
64919d2e3deSDmitry Chagin.Pp
65019d2e3deSDmitry ChaginThe shell variable
65119d2e3deSDmitry Chagin.Va fignore
65219d2e3deSDmitry Chagincan be set to a list of suffixes to be ignored by completion.
65319d2e3deSDmitry ChaginConsider the following:
65419d2e3deSDmitry Chagin.Bd -literal -offset indent
65519d2e3deSDmitry Chagin> ls
65619d2e3deSDmitry ChaginMakefile        condiments.h~   main.o          side.c
65719d2e3deSDmitry ChaginREADME          main.c          meal            side.o
65819d2e3deSDmitry Chagincondiments.h    main.c~
65919d2e3deSDmitry Chagin> set fignore = (.o \e~)
66019d2e3deSDmitry Chagin> emacs ma[^D]
66119d2e3deSDmitry Chaginmain.c   main.c~  main.o
66219d2e3deSDmitry Chagin> emacs ma[tab]
66319d2e3deSDmitry Chagin> emacs main.c
66419d2e3deSDmitry Chagin.Ed
66519d2e3deSDmitry Chagin.Pp
66619d2e3deSDmitry Chagin.Sq main.c~
66719d2e3deSDmitry Chaginand
66819d2e3deSDmitry Chagin.Sq main.o
66919d2e3deSDmitry Chaginare ignored by completion (but not listing),
67019d2e3deSDmitry Chaginbecause they end in suffixes in
67119d2e3deSDmitry Chagin.Va fignore .
67219d2e3deSDmitry ChaginNote that a
67319d2e3deSDmitry Chagin.Sq \e
67419d2e3deSDmitry Chaginwas needed in front of
67519d2e3deSDmitry Chagin.Sq ~
67619d2e3deSDmitry Chaginto prevent it from being expanded to
67719d2e3deSDmitry Chagin.Va home
67819d2e3deSDmitry Chaginas described under
67919d2e3deSDmitry Chagin.Sx Filename substitution .
68019d2e3deSDmitry Chagin.Va fignore
68119d2e3deSDmitry Chaginis ignored if only one completion is possible.
68219d2e3deSDmitry Chagin.Pp
68319d2e3deSDmitry ChaginIf the
68419d2e3deSDmitry Chagin.Va complete
68519d2e3deSDmitry Chaginshell variable is set to
68619d2e3deSDmitry Chagin.Sq enhance ,
687d803a9d0SBrooks Daviscompletion 1) ignores case and 2) considers periods, hyphens and underscores
688d803a9d0SBrooks Davis.Sq ( \&. ,
68919d2e3deSDmitry Chagin.Sq \&-
69019d2e3deSDmitry Chaginand
69119d2e3deSDmitry Chagin.Sq _ )
69219d2e3deSDmitry Chaginto be word separators and hyphens and underscores to be equivalent.
69319d2e3deSDmitry ChaginIf you had the following files
69419d2e3deSDmitry Chagin.Bd -literal -offset indent
69519d2e3deSDmitry Chagincomp.lang.c      comp.lang.perl   comp.std.c++
69619d2e3deSDmitry Chagincomp.lang.c++    comp.std.c
69719d2e3deSDmitry Chagin.Ed
69819d2e3deSDmitry Chagin.Pp
69919d2e3deSDmitry Chaginand typed
70019d2e3deSDmitry Chagin.Sq mail \-f c.l.c[tab] ,
70119d2e3deSDmitry Chaginit would be completed to
70219d2e3deSDmitry Chagin.Sq mail \-f comp.lang.c ,
70319d2e3deSDmitry Chaginand
70419d2e3deSDmitry Chagin.Sq ^D
70519d2e3deSDmitry Chaginwould list
70619d2e3deSDmitry Chagin.Sq comp.lang.c
70719d2e3deSDmitry Chaginand
70819d2e3deSDmitry Chagin.Sq comp.lang.c++ .
70919d2e3deSDmitry Chagin.Sq mail \-f c..c++[^D]
71019d2e3deSDmitry Chaginwould list
71119d2e3deSDmitry Chagin.Sq comp.lang.c++
71219d2e3deSDmitry Chaginand
71319d2e3deSDmitry Chagin.Sq comp.std.c++ .
71419d2e3deSDmitry ChaginTyping
71519d2e3deSDmitry Chagin.Sq rm a\-\-file[^D]
71619d2e3deSDmitry Chaginin the following directory
71719d2e3deSDmitry Chagin.Bd -literal -offset indent
71819d2e3deSDmitry ChaginA_silly_file    a-hyphenated-file    another_silly_file
71919d2e3deSDmitry Chagin.Ed
72019d2e3deSDmitry Chagin.Pp
72119d2e3deSDmitry Chaginwould list all three files, because case is ignored and hyphens and
72219d2e3deSDmitry Chaginunderscores are equivalent.
72319d2e3deSDmitry ChaginPeriods, however, are not equivalent to
72419d2e3deSDmitry Chaginhyphens or underscores.
72519d2e3deSDmitry Chagin.Pp
72619d2e3deSDmitry ChaginIf the
72719d2e3deSDmitry Chagin.Va complete
72819d2e3deSDmitry Chaginshell variable is set to
729d803a9d0SBrooks Davis.Sq Enhance ,
73019d2e3deSDmitry Chagincompletion
73119d2e3deSDmitry Chaginignores case and differences between a hyphen and an underscore word
73219d2e3deSDmitry Chaginseparator only when the user types a lowercase character or a hyphen.
73319d2e3deSDmitry ChaginEntering an uppercase character or an underscore will not match the
73419d2e3deSDmitry Chagincorresponding lowercase character or hyphen word separator.
73519d2e3deSDmitry ChaginTyping
73619d2e3deSDmitry Chagin.Sq rm a\-\-file[^D]
73719d2e3deSDmitry Chaginin the directory of the previous example would
73819d2e3deSDmitry Chaginstill list all three files, but typing
73919d2e3deSDmitry Chagin.Sq rm A\-\-file
74019d2e3deSDmitry Chaginwould match only
74119d2e3deSDmitry Chagin.Sq A_silly_file
74219d2e3deSDmitry Chaginand typing
74319d2e3deSDmitry Chagin.Sq rm a__file[^D]
74419d2e3deSDmitry Chaginwould match just
74519d2e3deSDmitry Chagin.Sq A_silly_file
74619d2e3deSDmitry Chaginand
74719d2e3deSDmitry Chagin.Sq another_silly_file
74819d2e3deSDmitry Chaginbecause the user explicitly used an uppercase
74919d2e3deSDmitry Chaginor an underscore character.
75019d2e3deSDmitry Chagin.Pp
75119d2e3deSDmitry ChaginCompletion and listing are affected by several other shell variables:
75219d2e3deSDmitry Chagin.Va recexact
75319d2e3deSDmitry Chagincan be set to complete on the shortest possible unique
75419d2e3deSDmitry Chaginmatch, even if more typing might result in a longer match:
75519d2e3deSDmitry Chagin.Bd -literal -offset indent
75619d2e3deSDmitry Chagin> ls
75719d2e3deSDmitry Chaginfodder   foo      food     foonly
75819d2e3deSDmitry Chagin> set recexact
75919d2e3deSDmitry Chagin> rm fo[tab]
76019d2e3deSDmitry Chagin.Ed
76119d2e3deSDmitry Chagin.Pp
76219d2e3deSDmitry Chaginjust beeps, because
76319d2e3deSDmitry Chagin.Sq fo
76419d2e3deSDmitry Chagincould expand to
76519d2e3deSDmitry Chagin.Sq fod
76619d2e3deSDmitry Chaginor
76719d2e3deSDmitry Chagin.Sq foo ,
76819d2e3deSDmitry Chaginbut if we type another
76919d2e3deSDmitry Chagin.Sq o ,
77019d2e3deSDmitry Chagin.Bd -literal -offset indent
77119d2e3deSDmitry Chagin> rm foo[tab]
77219d2e3deSDmitry Chagin> rm foo
77319d2e3deSDmitry Chagin.Ed
77419d2e3deSDmitry Chagin.Pp
77519d2e3deSDmitry Chaginthe completion completes on
77619d2e3deSDmitry Chagin.Sq foo ,
77719d2e3deSDmitry Chagineven though
77819d2e3deSDmitry Chagin.Sq food
77919d2e3deSDmitry Chaginand
78019d2e3deSDmitry Chagin.Sq foonly
78119d2e3deSDmitry Chaginalso match.
78219d2e3deSDmitry Chagin.Va autoexpand
78319d2e3deSDmitry Chagincan be set to run the
78419d2e3deSDmitry Chagin.Ic expand-history
78519d2e3deSDmitry Chagineditor command
78619d2e3deSDmitry Chaginbefore each completion attempt,
78719d2e3deSDmitry Chagin.Va autocorrect
78819d2e3deSDmitry Chagincan be set to
78919d2e3deSDmitry Chaginspelling-correct the word to be completed (see
79019d2e3deSDmitry Chagin.Sx Spelling correction )
79119d2e3deSDmitry Chaginbefore each completion attempt and
79219d2e3deSDmitry Chagin.Va correct
79319d2e3deSDmitry Chagincan be set to complete commands automatically after one hits
79419d2e3deSDmitry Chagin.Sq return .
79519d2e3deSDmitry Chagin.Va matchbeep
79619d2e3deSDmitry Chagincan be set to make completion beep or not beep in a variety
79719d2e3deSDmitry Chaginof situations, and
79819d2e3deSDmitry Chagin.Va nobeep
79919d2e3deSDmitry Chagincan be set to never beep at all.
80019d2e3deSDmitry Chagin.Va nostat
80119d2e3deSDmitry Chagincan be set to a list of directories and/or patterns that
80219d2e3deSDmitry Chaginmatch directories to prevent the completion mechanism from
80319d2e3deSDmitry Chagin.Xr stat 2
80419d2e3deSDmitry Chagining
80519d2e3deSDmitry Chaginthose directories.
80619d2e3deSDmitry Chagin.Va listmax
80719d2e3deSDmitry Chaginand
80819d2e3deSDmitry Chagin.Va listmaxrows
80919d2e3deSDmitry Chagincan be set to limit the number of items
81019d2e3deSDmitry Chaginand rows (respectively) that are listed without asking first.
81119d2e3deSDmitry Chagin.Va recognize_only_executables
81219d2e3deSDmitry Chagincan be set to make the shell list only
81319d2e3deSDmitry Chaginexecutables when listing commands, but it is quite slow.
81419d2e3deSDmitry Chagin.Pp
81519d2e3deSDmitry ChaginFinally, the
81619d2e3deSDmitry Chagin.Ic complete
81719d2e3deSDmitry Chaginbuiltin command can be used to tell the shell how
81819d2e3deSDmitry Chaginto complete words other than filenames, commands and variables.
81919d2e3deSDmitry ChaginCompletion and listing do not work on glob-patterns (see
82019d2e3deSDmitry Chagin.Sx Filename substitution ) ,
82119d2e3deSDmitry Chaginbut the
82219d2e3deSDmitry Chagin.Ic list-glob
82319d2e3deSDmitry Chaginand
82419d2e3deSDmitry Chagin.Ic expand-glob
82519d2e3deSDmitry Chagineditor commands perform
82619d2e3deSDmitry Chaginequivalent functions for glob-patterns.
82719d2e3deSDmitry Chagin.Ss Spelling correction (+)
82819d2e3deSDmitry ChaginThe shell can sometimes correct the spelling of filenames, commands and
82919d2e3deSDmitry Chaginvariable names as well as completing and listing them.
83019d2e3deSDmitry Chagin.Pp
83119d2e3deSDmitry ChaginIndividual words can be spelling-corrected with the
83219d2e3deSDmitry Chagin.Ic spell-word
83319d2e3deSDmitry Chagineditor command (usually bound to M-s and M-S)
83419d2e3deSDmitry Chaginand the entire input buffer with
83519d2e3deSDmitry Chagin.Ic spell-line
83619d2e3deSDmitry Chagin(usually bound to M-$).
83719d2e3deSDmitry ChaginThe
83819d2e3deSDmitry Chagin.Va correct
83919d2e3deSDmitry Chaginshell variable can be set to
84019d2e3deSDmitry Chagin.Dv cmd
84119d2e3deSDmitry Chaginto correct the command name or
84219d2e3deSDmitry Chagin.Dv all
84319d2e3deSDmitry Chaginto correct the entire line each time return is typed, and
84419d2e3deSDmitry Chagin.Va autocorrect
84519d2e3deSDmitry Chagincan be set to correct the word to be completed
84619d2e3deSDmitry Chaginbefore each completion attempt.
84719d2e3deSDmitry Chagin.Pp
84819d2e3deSDmitry ChaginWhen spelling correction is invoked in any of these ways and
84919d2e3deSDmitry Chaginthe shell thinks that any part of the command line is misspelled,
85019d2e3deSDmitry Chaginit prompts with the corrected line:
85119d2e3deSDmitry Chagin.Bd -literal -offset indent
85219d2e3deSDmitry Chagin> set correct = cmd
85319d2e3deSDmitry Chagin> lz /usr/bin
85419d2e3deSDmitry ChaginCORRECT>ls /usr/bin (y|n|e|a)?
85519d2e3deSDmitry Chagin.Ed
85619d2e3deSDmitry Chagin.Pp
85719d2e3deSDmitry ChaginOne can answer
85819d2e3deSDmitry Chagin.Sq y
85919d2e3deSDmitry Chaginor space to execute the corrected line,
86019d2e3deSDmitry Chagin.Sq e
86119d2e3deSDmitry Chaginto leave the uncorrected command in the input buffer,
86219d2e3deSDmitry Chagin.Sq a
86319d2e3deSDmitry Chaginto abort the command as if
86419d2e3deSDmitry Chagin.Sq ^C
86519d2e3deSDmitry Chaginhad been hit, and
86619d2e3deSDmitry Chaginanything else to execute the original line unchanged.
86719d2e3deSDmitry Chagin.Pp
86819d2e3deSDmitry ChaginSpelling correction recognizes user-defined completions (see the
86919d2e3deSDmitry Chagin.Ic complete
87019d2e3deSDmitry Chaginbuiltin command).
87119d2e3deSDmitry ChaginIf an input word in a position for
87219d2e3deSDmitry Chaginwhich a completion is defined resembles a word in the completion list,
87319d2e3deSDmitry Chaginspelling correction registers a misspelling and suggests the latter
87419d2e3deSDmitry Chaginword as a correction.
87519d2e3deSDmitry ChaginHowever, if the input word does not match any of
87619d2e3deSDmitry Chaginthe possible completions for that position, spelling correction does
87719d2e3deSDmitry Chaginnot register a misspelling.
87819d2e3deSDmitry Chagin.Pp
87919d2e3deSDmitry ChaginLike completion, spelling correction works anywhere in the line,
88019d2e3deSDmitry Chaginpushing the rest of the line to the right and possibly leaving
88119d2e3deSDmitry Chaginextra characters to the right of the cursor.
88219d2e3deSDmitry Chagin.Ss Editor commands (+)
88319d2e3deSDmitry Chagin.Ic bindkey
88419d2e3deSDmitry Chaginlists key bindings and
88519d2e3deSDmitry Chagin.Ic bindkey \-l
88619d2e3deSDmitry Chaginlists and briefly describes editor commands.
88719d2e3deSDmitry ChaginOnly new or especially interesting editor commands are described here.
88819d2e3deSDmitry ChaginSee
88919d2e3deSDmitry Chagin.Xr emacs 1
89019d2e3deSDmitry Chaginand
89119d2e3deSDmitry Chagin.Xr vi 1
89219d2e3deSDmitry Chaginfor descriptions of each editor's key bindings.
89319d2e3deSDmitry Chagin.Pp
89419d2e3deSDmitry ChaginThe character or characters to which each command is bound by default is
89519d2e3deSDmitry Chagingiven in parentheses.
89619d2e3deSDmitry Chagin.Sq ^character
89719d2e3deSDmitry Chaginmeans a control character and
89819d2e3deSDmitry Chagin.Sq M-character
89919d2e3deSDmitry Chagina meta character, typed as
90019d2e3deSDmitry Chagin.Sq escape-character
90119d2e3deSDmitry Chaginon terminals without a meta key.
90219d2e3deSDmitry ChaginCase counts, but commands that are bound
90319d2e3deSDmitry Chaginto letters by default are bound to both lower- and uppercase letters for
90419d2e3deSDmitry Chaginconvenience.
90519d2e3deSDmitry Chagin.Bl -tag -width indent
90619d2e3deSDmitry Chagin.It Ic backward-char Ar (^B, left)
90719d2e3deSDmitry ChaginMove back a character.
90819d2e3deSDmitry ChaginCursor behavior modified by
90919d2e3deSDmitry Chagin.Va vimode
91019d2e3deSDmitry Chagin.It Ic backward-delete-word Ar (M-^H, M-^?)
91119d2e3deSDmitry ChaginCut from beginning of current word to cursor \- saved in cut buffer.
91219d2e3deSDmitry ChaginWord boundary behavior modified by
91319d2e3deSDmitry Chagin.Va vimode
91419d2e3deSDmitry Chagin.It Ic backward-word Ar (M-b, M-B)
91519d2e3deSDmitry ChaginMove to beginning of current word.
91619d2e3deSDmitry ChaginWord boundary and cursor behavior modified by
91719d2e3deSDmitry Chagin.Va vimode
91819d2e3deSDmitry Chagin.It Ic beginning-of-line Ar (^A, home)
91919d2e3deSDmitry ChaginMove to beginning of line.
92019d2e3deSDmitry ChaginCursor behavior modified by
92119d2e3deSDmitry Chagin.Va vimode
92219d2e3deSDmitry Chagin.It Ic capitalize-word Ar (M-c, M-C)
92319d2e3deSDmitry ChaginCapitalize the characters from cursor to end of current word.
92419d2e3deSDmitry ChaginWord boundary behavior modified by
92519d2e3deSDmitry Chagin.Va vimode
92619d2e3deSDmitry Chagin.It Ic complete-word Ar (tab)
92719d2e3deSDmitry ChaginCompletes a word as described under
92819d2e3deSDmitry Chagin.Sx Completion and listing
92919d2e3deSDmitry Chagin.It Ic complete-word-back Ar (not bound)
93019d2e3deSDmitry ChaginLike
93119d2e3deSDmitry Chagin.Ic complete-word-fwd ,
93219d2e3deSDmitry Chaginbut steps up from the end of the list.
93319d2e3deSDmitry Chagin.It Ic complete-word-fwd Ar (not bound)
93419d2e3deSDmitry ChaginReplaces the current word with the first word in the list of possible
93519d2e3deSDmitry Chagincompletions.
93619d2e3deSDmitry ChaginMay be repeated to step down through the list.
93719d2e3deSDmitry ChaginAt the end of the list, beeps and reverts to the incomplete word.
93819d2e3deSDmitry Chagin.It Ic complete-word-raw Ar (^X-tab)
93919d2e3deSDmitry ChaginLike
94019d2e3deSDmitry Chagin.Ic complete-word ,
94119d2e3deSDmitry Chaginbut ignores user-defined completions.
94219d2e3deSDmitry Chagin.It Ic copy-prev-word Ar (M-^_)
94319d2e3deSDmitry ChaginCopies the previous word in the current line into the input buffer.
94419d2e3deSDmitry ChaginSee also
94519d2e3deSDmitry Chagin.Ic insert-last-word
94619d2e3deSDmitry ChaginWord boundary behavior modified by
94719d2e3deSDmitry Chagin.Va vimode
94819d2e3deSDmitry Chagin.It Ic dabbrev-expand Ar (M-/)
94919d2e3deSDmitry ChaginExpands the current word to the most recent preceding one for which
95019d2e3deSDmitry Chaginthe current is a leading substring, wrapping around the history list
95119d2e3deSDmitry Chagin(once) if necessary.
95219d2e3deSDmitry ChaginRepeating
95319d2e3deSDmitry Chagin.Ic dabbrev-expand
95419d2e3deSDmitry Chaginwithout any intervening typing
95519d2e3deSDmitry Chaginchanges to the next previous word etc., skipping identical matches
95619d2e3deSDmitry Chaginmuch like
95719d2e3deSDmitry Chagin.Ic history-search-backward
95819d2e3deSDmitry Chagindoes.
95919d2e3deSDmitry Chagin.It Ic delete-char Ar (not bound)
96019d2e3deSDmitry ChaginDeletes the character under the cursor.
96119d2e3deSDmitry ChaginSee also
96219d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
96319d2e3deSDmitry ChaginCursor behavior modified by
96419d2e3deSDmitry Chagin.Va vimode
96519d2e3deSDmitry Chagin.It Ic delete-char-or-eof Ar (not bound)
96619d2e3deSDmitry ChaginDoes
96719d2e3deSDmitry Chagin.Ic delete-char
96819d2e3deSDmitry Chaginif there is a character under the cursor or
96919d2e3deSDmitry Chagin.Ic end-of-file
97019d2e3deSDmitry Chaginon an empty line.
97119d2e3deSDmitry ChaginSee also
97219d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
97319d2e3deSDmitry ChaginCursor behavior modified by
97419d2e3deSDmitry Chagin.Va vimode
97519d2e3deSDmitry Chagin.It Ic delete-char-or-list Ar (not bound)
97619d2e3deSDmitry ChaginDoes
97719d2e3deSDmitry Chagin.Ic delete-char
97819d2e3deSDmitry Chaginif there is a character under the cursor
97919d2e3deSDmitry Chaginor
98019d2e3deSDmitry Chagin.Ic list-choices
98119d2e3deSDmitry Chaginat the end of the line.
98219d2e3deSDmitry ChaginSee also
98319d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
98419d2e3deSDmitry Chagin.It Ic delete-char-or-list-or-eof Ar (^D)
98519d2e3deSDmitry ChaginDoes
98619d2e3deSDmitry Chagin.Ic delete-char
98719d2e3deSDmitry Chaginif there is a character under the cursor,
98819d2e3deSDmitry Chagin.Ic list-choices
98919d2e3deSDmitry Chaginat the end of the line or
99019d2e3deSDmitry Chagin.Ic end-of-file
99119d2e3deSDmitry Chaginon an empty line.
99219d2e3deSDmitry ChaginSee also those three commands, each of which does only a single action, and
99319d2e3deSDmitry Chagin.Ic delete-char-or-eof ,
99419d2e3deSDmitry Chagin.Ic delete-char-or-list
99519d2e3deSDmitry Chaginand
99619d2e3deSDmitry Chagin.Ic list-or-eof ,
99719d2e3deSDmitry Chagineach of which does a different two out of the three.
99819d2e3deSDmitry Chagin.It Ic delete-word Ar (M-d, M-D)
99919d2e3deSDmitry ChaginCut from cursor to end of current word \- save in cut buffer.
100019d2e3deSDmitry ChaginWord boundary behavior modified by
100119d2e3deSDmitry Chagin.Va vimode
100219d2e3deSDmitry Chagin.It Ic down-history Ar (down-arrow, ^N)
100319d2e3deSDmitry ChaginLike
100419d2e3deSDmitry Chagin.Ic up-history ,
100519d2e3deSDmitry Chaginbut steps down, stopping at the original input line.
100619d2e3deSDmitry Chagin.It Ic downcase-word Ar (M-l, M-L)
100719d2e3deSDmitry ChaginLowercase the characters from cursor to end of current word.
100819d2e3deSDmitry ChaginWord boundary behavior modified by
100919d2e3deSDmitry Chagin.Va vimode
101019d2e3deSDmitry Chagin.It Ic end-of-file Ar (not bound)
101119d2e3deSDmitry ChaginSignals an end of file, causing the shell to exit unless the
101219d2e3deSDmitry Chagin.Va ignoreeof
101319d2e3deSDmitry Chaginshell variable (q.v.) is set to prevent this.
101419d2e3deSDmitry ChaginSee also
101519d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
101619d2e3deSDmitry Chagin.It Ic end-of-line Ar (^E, end)
101719d2e3deSDmitry ChaginMove cursor to end of line.
101819d2e3deSDmitry ChaginCursor behavior modified by
101919d2e3deSDmitry Chagin.Va vimode
102019d2e3deSDmitry Chagin.It Ic expand-history Ar (M-space)
102119d2e3deSDmitry ChaginExpands history substitutions in the current word.
102219d2e3deSDmitry ChaginSee
102319d2e3deSDmitry Chagin.Sx History substitution
102419d2e3deSDmitry ChaginSee also
102519d2e3deSDmitry Chagin.Ic magic-space ,
102619d2e3deSDmitry Chagin.Ic toggle-literal-history
102719d2e3deSDmitry Chaginand the
102819d2e3deSDmitry Chagin.Va autoexpand
102919d2e3deSDmitry Chaginshell variable.
103019d2e3deSDmitry Chagin.It Ic expand-glob Ar (^X-*)
103119d2e3deSDmitry ChaginExpands the glob-pattern to the left of the cursor.
103219d2e3deSDmitry ChaginSee
103319d2e3deSDmitry Chagin.Sx Filename substitution
103419d2e3deSDmitry Chagin.It Ic expand-line Ar (not bound)
103519d2e3deSDmitry ChaginLike
103619d2e3deSDmitry Chagin.Ic expand-history ,
103719d2e3deSDmitry Chaginbut expands history substitutions in each word in the input buffer.
103819d2e3deSDmitry Chagin.It Ic expand-variables Ar (^X-$)
103919d2e3deSDmitry ChaginExpands the variable to the left of the cursor.
104019d2e3deSDmitry ChaginSee
104119d2e3deSDmitry Chagin.Sx Variable substitution
104219d2e3deSDmitry Chagin.It Ic forward-char Ar (^F, right)
104319d2e3deSDmitry ChaginMove forward one character.
104419d2e3deSDmitry ChaginCursor behavior modified by
104519d2e3deSDmitry Chagin.Va vimode
104619d2e3deSDmitry Chagin.It Ic forward-word Ar (M-f, M-F)
104719d2e3deSDmitry ChaginMove forward to end of current word.
104819d2e3deSDmitry ChaginWord boundary and cursor behavior modified by
104919d2e3deSDmitry Chagin.Va vimode
105019d2e3deSDmitry Chagin.It Ic history-search-backward Ar (M-p, M-P)
105119d2e3deSDmitry ChaginSearches backwards through the history list for a command beginning with
105219d2e3deSDmitry Chaginthe current contents of the input buffer up to the cursor and copies it
105319d2e3deSDmitry Chagininto the input buffer.
105419d2e3deSDmitry ChaginThe search string may be a glob-pattern (see
105519d2e3deSDmitry Chagin.Sx Filename substitution )
105619d2e3deSDmitry Chagincontaining
105719d2e3deSDmitry Chagin.Sq * ,
105819d2e3deSDmitry Chagin.Sq \&?  ,
105919d2e3deSDmitry Chagin.Sq []
106019d2e3deSDmitry Chaginor
106119d2e3deSDmitry Chagin.Sq {}
106219d2e3deSDmitry Chagin.Ic up-history
106319d2e3deSDmitry Chaginand
106419d2e3deSDmitry Chagin.Ic down-history
106519d2e3deSDmitry Chaginwill proceed from the
106619d2e3deSDmitry Chaginappropriate point in the history list.
106719d2e3deSDmitry ChaginEmacs mode only.
106819d2e3deSDmitry ChaginSee also
106919d2e3deSDmitry Chagin.Ic history-search-forward
107019d2e3deSDmitry Chaginand
107119d2e3deSDmitry Chagin.Ic i-search-back
107219d2e3deSDmitry Chagin.It Ic history-search-forward Ar (M-n, M-N)
107319d2e3deSDmitry ChaginLike
107419d2e3deSDmitry Chagin.Ic history-search-backward ,
107519d2e3deSDmitry Chaginbut searches forward.
107619d2e3deSDmitry Chagin.It Ic i-search-back Ar (not bound)
107719d2e3deSDmitry ChaginSearches backward like
107819d2e3deSDmitry Chagin.Ic history-search-backward ,
107919d2e3deSDmitry Chagincopies the first match
108019d2e3deSDmitry Chagininto the input buffer with the cursor positioned at the end of the pattern,
108119d2e3deSDmitry Chaginand prompts with
108219d2e3deSDmitry Chagin.Sq bck:
108319d2e3deSDmitry Chaginand the first match.
108419d2e3deSDmitry ChaginAdditional characters may be
108519d2e3deSDmitry Chagintyped to extend the search,
108619d2e3deSDmitry Chagin.Ic i-search-back
108719d2e3deSDmitry Chaginmay be typed to continue
108819d2e3deSDmitry Chaginsearching with the same pattern, wrapping around the history list if
108919d2e3deSDmitry Chaginnecessary,
109019d2e3deSDmitry Chagin.Ic ( i-search-back
109119d2e3deSDmitry Chaginmust be bound to a
109219d2e3deSDmitry Chaginsingle character for this to work) or one of the following special characters
109319d2e3deSDmitry Chaginmay be typed:
109419d2e3deSDmitry Chagin.Pp
1095d803a9d0SBrooks Davis.Bl -tag -width indent -compact
1096d803a9d0SBrooks Davis.It ^W
109719d2e3deSDmitry ChaginAppends the rest of the word under the cursor to the search pattern.
1098d803a9d0SBrooks Davis.It delete
1099d803a9d0SBrooks Davis(or any character bound to
110019d2e3deSDmitry Chagin.Ic backward-delete-char )
110119d2e3deSDmitry ChaginUndoes the effect of the last character typed and deletes a character
110219d2e3deSDmitry Chaginfrom the search pattern if appropriate.
1103d803a9d0SBrooks Davis.It ^G
110419d2e3deSDmitry ChaginIf the previous search was successful, aborts the entire search.
110519d2e3deSDmitry ChaginIf not, goes back to the last successful search.
1106d803a9d0SBrooks Davis.It escape
110719d2e3deSDmitry ChaginEnds the search, leaving the current line in the input buffer.
1108d803a9d0SBrooks Davis.El
110919d2e3deSDmitry Chagin.Pp
111019d2e3deSDmitry ChaginAny other character not bound to
111119d2e3deSDmitry Chagin.Ic self-insert-command
111219d2e3deSDmitry Chaginterminates the
111319d2e3deSDmitry Chaginsearch, leaving the current line in the input buffer, and
111419d2e3deSDmitry Chaginis then interpreted as normal input.
111519d2e3deSDmitry ChaginIn particular, a carriage return
111619d2e3deSDmitry Chagincauses the current line to be executed.
111719d2e3deSDmitry ChaginSee also
111819d2e3deSDmitry Chagin.Ic i-search-fwd
111919d2e3deSDmitry Chaginand
112019d2e3deSDmitry Chagin.Ic history-search-backward
112119d2e3deSDmitry ChaginWord boundary behavior modified by
112219d2e3deSDmitry Chagin.Va vimode
112319d2e3deSDmitry Chagin.It Ic i-search-fwd Ar (not bound)
112419d2e3deSDmitry ChaginLike
112519d2e3deSDmitry Chagin.Ic i-search-back ,
112619d2e3deSDmitry Chaginbut searches forward.
112719d2e3deSDmitry ChaginWord boundary behavior modified by
112819d2e3deSDmitry Chagin.Va vimode
112919d2e3deSDmitry Chagin.It Ic insert-last-word Ar (M-_)
113019d2e3deSDmitry ChaginInserts the last word of the previous input line
113119d2e3deSDmitry Chagin.Sq ( \&!$ )
113219d2e3deSDmitry Chagininto the input buffer.
113319d2e3deSDmitry ChaginSee also
113419d2e3deSDmitry Chagin.Ic copy-prev-word
113519d2e3deSDmitry Chagin.It Ic list-choices Ar (M-^D)
113619d2e3deSDmitry ChaginLists completion possibilities as described under
113719d2e3deSDmitry Chagin.Sx Completion and listing
113819d2e3deSDmitry ChaginSee also
113919d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
114019d2e3deSDmitry Chaginand
114119d2e3deSDmitry Chagin.Ic list-choices-raw
114219d2e3deSDmitry Chagin.It Ic list-choices-raw Ar (^X-^D)
114319d2e3deSDmitry ChaginLike
114419d2e3deSDmitry Chagin.Ic list-choices ,
114519d2e3deSDmitry Chaginbut ignores user-defined completions.
114619d2e3deSDmitry Chagin.It Ic list-glob Ar (^X-g, ^X-G)
114719d2e3deSDmitry ChaginLists (via the
114819d2e3deSDmitry Chagin.Ic ls\-F
114919d2e3deSDmitry Chaginbuiltin) matches to the glob-pattern
115019d2e3deSDmitry Chagin(see
115119d2e3deSDmitry Chagin.Sx Filename substitution )
115219d2e3deSDmitry Chaginto the left of the cursor.
115319d2e3deSDmitry Chagin.It Ic list-or-eof Ar (not bound)
115419d2e3deSDmitry ChaginDoes
115519d2e3deSDmitry Chagin.Ic list-choices
115619d2e3deSDmitry Chaginor
115719d2e3deSDmitry Chagin.Ic end-of-file
115819d2e3deSDmitry Chaginon an empty line.
115919d2e3deSDmitry ChaginSee also
116019d2e3deSDmitry Chagin.Ic delete-char-or-list-or-eof
116119d2e3deSDmitry Chagin.It Ic magic-space Ar (not bound)
116219d2e3deSDmitry ChaginExpands history substitutions in the current line,
116319d2e3deSDmitry Chaginlike
116419d2e3deSDmitry Chagin.Ic expand-history ,
116519d2e3deSDmitry Chaginand inserts a space.
116619d2e3deSDmitry Chagin.Ic magic-space
116719d2e3deSDmitry Chaginis designed to be bound to the space bar,
116819d2e3deSDmitry Chaginbut is not bound by default.
116919d2e3deSDmitry Chagin.It Ic normalize-command Ar (^X-?)
117019d2e3deSDmitry ChaginSearches for the current word in PATH and, if it is found, replaces it with
117119d2e3deSDmitry Chaginthe full path to the executable.
117219d2e3deSDmitry ChaginSpecial characters are quoted.
117319d2e3deSDmitry ChaginAliases are
117419d2e3deSDmitry Chaginexpanded and quoted but commands within aliases are not.
117519d2e3deSDmitry ChaginThis command is
117619d2e3deSDmitry Chaginuseful with commands that take commands as arguments, e.g.,
117719d2e3deSDmitry Chagin.Sq dbx
117819d2e3deSDmitry Chaginand
117919d2e3deSDmitry Chagin.Sq sh \-x
118019d2e3deSDmitry Chagin.It Ic normalize-path Ar (^X-n, ^X-N)
118119d2e3deSDmitry ChaginExpands the current word as described under the
118219d2e3deSDmitry Chagin.Sq expand
118319d2e3deSDmitry Chaginsetting
118419d2e3deSDmitry Chaginof the
118519d2e3deSDmitry Chagin.Va symlinks
118619d2e3deSDmitry Chaginshell variable.
118719d2e3deSDmitry Chagin.It Ic overwrite-mode Ar (unbound)
118819d2e3deSDmitry ChaginToggles between input and overwrite modes.
118919d2e3deSDmitry Chagin.It Ic run-fg-editor Ar (M-^Z)
119019d2e3deSDmitry ChaginSaves the current input line and
119119d2e3deSDmitry Chaginlooks for a stopped job where the file name portion of its first word
119219d2e3deSDmitry Chaginis found in the
119319d2e3deSDmitry Chagin.Va editors
119419d2e3deSDmitry Chaginshell variable.
119519d2e3deSDmitry ChaginIf
119619d2e3deSDmitry Chagin.Va editors
119719d2e3deSDmitry Chaginis not set, then the file name portion of the
119819d2e3deSDmitry Chagin.Va EDITOR
119919d2e3deSDmitry Chaginenvironment variable
120019d2e3deSDmitry Chagin.Sq ( ed
120119d2e3deSDmitry Chaginif unset)
120219d2e3deSDmitry Chaginand the
120319d2e3deSDmitry Chagin.Va VISUAL
120419d2e3deSDmitry Chaginenvironment variable
120519d2e3deSDmitry ChaginSq ( vi
120619d2e3deSDmitry Chaginif unset)
120719d2e3deSDmitry Chaginwill be used.
120819d2e3deSDmitry ChaginIf such a job is found, it is restarted as if
120919d2e3deSDmitry Chagin.Sq fg %
121019d2e3deSDmitry Chagin.Ic job
121119d2e3deSDmitry Chaginhad been typed.
121219d2e3deSDmitry ChaginThis is used to toggle back and forth between an editor and
121319d2e3deSDmitry Chaginthe shell easily.
121419d2e3deSDmitry ChaginSome people bind this command to
121519d2e3deSDmitry Chagin.Sq ^Z
121619d2e3deSDmitry Chaginso they
121719d2e3deSDmitry Chagincan do this even more easily.
121819d2e3deSDmitry Chagin.It Ic run-help Ar (M-h, M-H)
121919d2e3deSDmitry ChaginSearches for documentation on the current command, using the same notion of
122019d2e3deSDmitry Chagin.Sq current command
122119d2e3deSDmitry Chaginas the completion routines, and prints it.
122219d2e3deSDmitry ChaginThere is no way
122319d2e3deSDmitry Chaginto use a pager;
122419d2e3deSDmitry Chagin.Ic run-help
122519d2e3deSDmitry Chaginis designed for short help files.
122619d2e3deSDmitry ChaginIf the special alias
122719d2e3deSDmitry Chagin.Va helpcommand
122819d2e3deSDmitry Chaginis defined, it is run with the
122919d2e3deSDmitry Chagincommand name as a sole argument.
123019d2e3deSDmitry ChaginElse,
123119d2e3deSDmitry Chagindocumentation should be in a file named
123219d2e3deSDmitry Chagin.Sq command.help ,
123319d2e3deSDmitry Chagin.Sq command.1 ,
123419d2e3deSDmitry Chagin.Sq command.6 ,
123519d2e3deSDmitry Chagin.Sq command.8 ,
123619d2e3deSDmitry Chaginor
123719d2e3deSDmitry Chagin.Sq command ,
123819d2e3deSDmitry Chaginwhich should be in one
123919d2e3deSDmitry Chaginof the directories listed in the
124019d2e3deSDmitry Chagin.Va HPATH
124119d2e3deSDmitry Chaginenvironment variable.
124219d2e3deSDmitry ChaginIf there is more than one help file only the first is printed.
124319d2e3deSDmitry Chagin.It Ic self-insert-command Ar (text characters)
124419d2e3deSDmitry ChaginIn insert mode (the default), inserts the typed character into the input line after the character under the cursor.
124519d2e3deSDmitry ChaginIn overwrite mode, replaces the character under the cursor with the typed character.
124619d2e3deSDmitry ChaginThe input mode is normally preserved between lines, but the
124719d2e3deSDmitry Chagin.Va inputmode
124819d2e3deSDmitry Chaginshell variable can be set to
124919d2e3deSDmitry Chagin.Dv insert
125019d2e3deSDmitry Chaginor
125119d2e3deSDmitry Chagin.Dv overwrite
125219d2e3deSDmitry Chaginto put the
125319d2e3deSDmitry Chagineditor in that mode at the beginning of each line.
125419d2e3deSDmitry ChaginSee also
125519d2e3deSDmitry Chagin.Ic overwrite-mode
125619d2e3deSDmitry Chagin.It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X)
125719d2e3deSDmitry ChaginIndicates that the following characters are part of a
125819d2e3deSDmitry Chaginmulti-key sequence.
125919d2e3deSDmitry ChaginBinding a command to a multi-key sequence really creates
126019d2e3deSDmitry Chagintwo bindings: the first character to
126119d2e3deSDmitry Chagin.Ic sequence-lead-in
126219d2e3deSDmitry Chaginand the
126319d2e3deSDmitry Chaginwhole sequence to the command.
126419d2e3deSDmitry ChaginAll sequences beginning with a character
126519d2e3deSDmitry Chaginbound to
126619d2e3deSDmitry Chagin.Ic sequence-lead-in
126719d2e3deSDmitry Chaginare effectively bound to
126819d2e3deSDmitry Chagin.Ic undefined-key
126919d2e3deSDmitry Chaginunless bound to another command.
127019d2e3deSDmitry Chagin.It Ic spell-line Ar (M-$)
127119d2e3deSDmitry ChaginAttempts to correct the spelling of each word in the input buffer, like
127219d2e3deSDmitry Chagin.Ic spell-word ,
127319d2e3deSDmitry Chaginbut ignores words whose first character is one of
127419d2e3deSDmitry Chagin.Sq \- ,
127519d2e3deSDmitry Chagin.Sq \ ! ,
127619d2e3deSDmitry Chagin.Sq ^
127719d2e3deSDmitry Chaginor
127819d2e3deSDmitry Chagin.Sq % ,
127919d2e3deSDmitry Chaginor which contain
128019d2e3deSDmitry Chagin.Sq \e ,
128119d2e3deSDmitry Chagin.Sq *
128219d2e3deSDmitry Chaginor
128319d2e3deSDmitry Chagin.Sq \&? ,
128419d2e3deSDmitry Chaginto avoid problems with switches, substitutions and the like.
128519d2e3deSDmitry ChaginSee
128619d2e3deSDmitry Chagin.Sx Spelling correction
128719d2e3deSDmitry Chagin.It Ic spell-word Ar (M-s, M-S)
128819d2e3deSDmitry ChaginAttempts to correct the spelling of the current word as described under
128919d2e3deSDmitry Chagin.Sx Spelling correction
129019d2e3deSDmitry ChaginChecks each component of a word which appears to be a pathname.
129119d2e3deSDmitry Chagin.It Ic toggle-literal-history Ar (M-r, M-R)
129219d2e3deSDmitry ChaginExpands or
129319d2e3deSDmitry Chagin.Sq unexpands
129419d2e3deSDmitry Chaginhistory substitutions in the input buffer.
129519d2e3deSDmitry ChaginSee also
129619d2e3deSDmitry Chagin.Ic expand-history
129719d2e3deSDmitry Chaginand the
129819d2e3deSDmitry Chagin.Va autoexpand
129919d2e3deSDmitry Chaginshell variable.
130019d2e3deSDmitry Chagin.It Ic undefined-key Ar (any unbound key)
130119d2e3deSDmitry ChaginBeeps.
130219d2e3deSDmitry Chagin.It Ic up-history Ar (up-arrow, ^P)
130319d2e3deSDmitry ChaginCopies the previous entry in the history list into the input buffer.
130419d2e3deSDmitry ChaginIf
130519d2e3deSDmitry Chagin.Va histlit
130619d2e3deSDmitry Chaginis set, uses the literal form of the entry.
130719d2e3deSDmitry ChaginMay be repeated to step up through the history list, stopping at the top.
130819d2e3deSDmitry Chagin.It Ic upcase-word Ar (M-u, M-U)
130919d2e3deSDmitry ChaginUppercase the characters from cursor to end of current word.
131019d2e3deSDmitry ChaginWord boundary behavior modified by
131119d2e3deSDmitry Chagin.Va vimode
131219d2e3deSDmitry Chagin.It Ic vi-beginning-of-next-word Ar (not bound)
131319d2e3deSDmitry ChaginVi goto the beginning of next word.
131419d2e3deSDmitry ChaginWord boundary and cursor behavior modified by
131519d2e3deSDmitry Chagin.Va vimode
131619d2e3deSDmitry Chagin.It Ic vi-eword Ar (not bound)
131719d2e3deSDmitry ChaginVi move to the end of the current word.
131819d2e3deSDmitry ChaginWord boundary behavior modified by
131919d2e3deSDmitry Chagin.Va vimode
132019d2e3deSDmitry Chagin.It Ic vi-search-back Ar (?)
132119d2e3deSDmitry ChaginPrompts with
132219d2e3deSDmitry Chagin.Sq \&?
132319d2e3deSDmitry Chaginfor a search string (which may be a glob-pattern, as with
132419d2e3deSDmitry Chagin.Ic history-search-backward ),
132519d2e3deSDmitry Chaginsearches for it and copies it into the input buffer.
132619d2e3deSDmitry ChaginThe bell rings if no match is found.
132719d2e3deSDmitry ChaginHitting return ends the search and leaves the last match in the input
132819d2e3deSDmitry Chaginbuffer.
132919d2e3deSDmitry ChaginHitting escape ends the search and executes the match.
133019d2e3deSDmitry Chagin.Ic vi
133119d2e3deSDmitry Chaginmode only.
133219d2e3deSDmitry Chagin.It Ic vi-search-fwd Ar (/)
133319d2e3deSDmitry ChaginLike
133419d2e3deSDmitry Chagin.Ic vi-search-back ,
133519d2e3deSDmitry Chaginbut searches forward.
133619d2e3deSDmitry Chagin.It Ic which-command Ar (M-?)
133719d2e3deSDmitry ChaginDoes a
133819d2e3deSDmitry Chagin.Ic which
133919d2e3deSDmitry Chagin(see the description of the builtin command) on the
134019d2e3deSDmitry Chaginfirst word of the input buffer.
134119d2e3deSDmitry Chagin.It Ic yank-pop Ar (M-y)
134219d2e3deSDmitry ChaginWhen executed immediately after a
134319d2e3deSDmitry Chagin.Ic yank
134419d2e3deSDmitry Chaginor another
134519d2e3deSDmitry Chagin.Ic yank-pop ,
134619d2e3deSDmitry Chaginreplaces the yanked string with the next previous string from the
134719d2e3deSDmitry Chaginkillring. This also has the effect of rotating the killring, such that
134819d2e3deSDmitry Chaginthis string will be considered the most recently killed by a later
134919d2e3deSDmitry Chagin.Ic yank
135019d2e3deSDmitry Chagincommand. Repeating
135119d2e3deSDmitry Chagin.Ic yank-pop
135219d2e3deSDmitry Chaginwill cycle through the
135319d2e3deSDmitry Chaginkillring any number of times.
135419d2e3deSDmitry Chagin.El
135519d2e3deSDmitry Chagin.Ss Lexical structure
135619d2e3deSDmitry ChaginThe shell splits input lines into words at blanks and tabs.
135719d2e3deSDmitry ChaginThe special
135819d2e3deSDmitry Chagincharacters
135919d2e3deSDmitry Chagin.Sq \&& ,
136019d2e3deSDmitry Chagin.Sq | ,
136119d2e3deSDmitry Chagin.Sq \&; ,
136219d2e3deSDmitry Chagin.Sq < ,
136319d2e3deSDmitry Chagin.Sq > ,
136419d2e3deSDmitry Chagin.Sq \&( ,
136519d2e3deSDmitry Chaginand
136619d2e3deSDmitry Chagin.Sq \&)
136719d2e3deSDmitry Chaginand the doubled characters
136819d2e3deSDmitry Chagin.Sq && ,
136919d2e3deSDmitry Chagin.Sq || ,
137019d2e3deSDmitry Chagin.Sq <<
137119d2e3deSDmitry Chaginand
137219d2e3deSDmitry Chagin.Sq >>
137319d2e3deSDmitry Chaginare always separate words, whether or not they are
137419d2e3deSDmitry Chaginsurrounded by whitespace.
137519d2e3deSDmitry Chagin.Pp
137619d2e3deSDmitry ChaginWhen the shell's input is not a terminal, the character
137719d2e3deSDmitry Chagin.Sq #
137819d2e3deSDmitry Chaginis taken to begin a
137919d2e3deSDmitry Chagincomment.
138019d2e3deSDmitry ChaginEach
138119d2e3deSDmitry Chagin.Sq #
138219d2e3deSDmitry Chaginand the rest of the input line on which it appears is
138319d2e3deSDmitry Chagindiscarded before further parsing.
138419d2e3deSDmitry Chagin.Pp
138519d2e3deSDmitry ChaginA special character (including a blank or tab) may be prevented from having
138619d2e3deSDmitry Chaginits special meaning, and possibly made part of another word, by preceding it
138719d2e3deSDmitry Chaginwith a backslash
138819d2e3deSDmitry Chagin.Sq ( \e )
138919d2e3deSDmitry Chaginor enclosing it in single
139019d2e3deSDmitry Chagin.Sq ( \&' ) ,
139119d2e3deSDmitry Chagin, double
139219d2e3deSDmitry Chagin.Sq ( \&" )
139319d2e3deSDmitry Chaginor
139419d2e3deSDmitry Chaginbackward
139519d2e3deSDmitry Chagin.Sq ( \&` )
139619d2e3deSDmitry Chaginquotes.
139719d2e3deSDmitry ChaginWhen not otherwise quoted a newline preceded by a
139819d2e3deSDmitry Chagin.Sq \e
139919d2e3deSDmitry Chaginis equivalent to a blank, but inside quotes this sequence results in a
140019d2e3deSDmitry Chaginnewline.
140119d2e3deSDmitry Chagin.Pp
140219d2e3deSDmitry ChaginFurthermore, all
140319d2e3deSDmitry Chagin.Sx Substitutions
140419d2e3deSDmitry Chagin(see below) except
140519d2e3deSDmitry Chagin.Sx History substitution
140619d2e3deSDmitry Chagincan be prevented by enclosing the strings (or parts of strings)
140719d2e3deSDmitry Chaginin which they appear with single quotes or by quoting the crucial character(s)
140819d2e3deSDmitry Chagin(e.g.,
140919d2e3deSDmitry Chagin.Sq $
141019d2e3deSDmitry Chaginor
141119d2e3deSDmitry Chagin.Sq \&`
141219d2e3deSDmitry Chaginfor
141319d2e3deSDmitry Chagin.Sx Variable substitution
141419d2e3deSDmitry Chaginor
141519d2e3deSDmitry Chagin.Sx Command substitution
141619d2e3deSDmitry Chaginrespectively)
141719d2e3deSDmitry Chaginwith
141819d2e3deSDmitry Chagin.Sq \e
141919d2e3deSDmitry Chagin.Sx ( Alias substitution
142019d2e3deSDmitry Chaginis no exception: quoting in any way any
142119d2e3deSDmitry Chagincharacter of a word for which an
142219d2e3deSDmitry Chagin.Va alias
142319d2e3deSDmitry Chaginhas been defined prevents
142419d2e3deSDmitry Chaginsubstitution of the alias.
142519d2e3deSDmitry ChaginThe usual way of quoting an alias is to precede it
142619d2e3deSDmitry Chaginwith a backslash.)
142719d2e3deSDmitry Chagin.Sx History substitution
142819d2e3deSDmitry Chaginis prevented by
142919d2e3deSDmitry Chaginbackslashes but not by single quotes.
143019d2e3deSDmitry ChaginStrings quoted with double or backward
143119d2e3deSDmitry Chaginquotes undergo
143219d2e3deSDmitry Chagin.Sx Variable substitution
143319d2e3deSDmitry Chaginand
143419d2e3deSDmitry Chagin.Sx Command substitution ,
143519d2e3deSDmitry Chaginbut other substitutions are prevented.
143619d2e3deSDmitry Chagin.Pp
143719d2e3deSDmitry ChaginText inside single or double quotes becomes a single word (or part of one).
143819d2e3deSDmitry ChaginMetacharacters in these strings, including blanks and tabs, do not form
143919d2e3deSDmitry Chaginseparate words.
144019d2e3deSDmitry ChaginOnly in one special case (see
144119d2e3deSDmitry Chagin.Sx Command substitution
144219d2e3deSDmitry Chaginbelow) can a double-quoted string yield parts of more than one word;
144319d2e3deSDmitry Chaginsingle-quoted strings never do.
144419d2e3deSDmitry ChaginBackward quotes are special: they signal
144519d2e3deSDmitry Chagin.Sx Command substitution
144619d2e3deSDmitry Chagin(q.v.), which may result in more than one word.
144719d2e3deSDmitry Chagin.Pp
144819d2e3deSDmitry ChaginQuoting complex strings, particularly strings which themselves contain quoting
144919d2e3deSDmitry Chagincharacters, can be confusing.
145019d2e3deSDmitry ChaginRemember that quotes need not be used as they are
145119d2e3deSDmitry Chaginin human writing!
145219d2e3deSDmitry ChaginIt may be easier to quote not an entire string, but only
145319d2e3deSDmitry Chaginthose parts of the string which need quoting, using different types of quoting
145419d2e3deSDmitry Chaginto do so if appropriate.
145519d2e3deSDmitry Chagin.Pp
145619d2e3deSDmitry ChaginThe
145719d2e3deSDmitry Chagin.Va backslash_quote
145819d2e3deSDmitry Chaginshell variable (q.v.) can be set to make backslashes
145919d2e3deSDmitry Chaginalways quote
146019d2e3deSDmitry Chagin.Sq \e ,
146119d2e3deSDmitry Chagin.Sq \&' ,
146219d2e3deSDmitry Chaginand
146319d2e3deSDmitry Chagin.Sq \&"
146419d2e3deSDmitry Chagin(+) This may make complex quoting tasks
146519d2e3deSDmitry Chagineasier, but it can cause syntax errors in
146619d2e3deSDmitry Chagin.Xr csh 1
146719d2e3deSDmitry Chaginscripts.
146819d2e3deSDmitry Chagin.Ss Substitutions
146919d2e3deSDmitry ChaginWe now describe the various transformations the shell performs on the input in
147019d2e3deSDmitry Chaginthe order in which they occur.
147119d2e3deSDmitry ChaginWe note in passing the data structures involved
147219d2e3deSDmitry Chaginand the commands and variables which affect them.
147319d2e3deSDmitry ChaginRemember that substitutions
147419d2e3deSDmitry Chagincan be prevented by quoting as described under
147519d2e3deSDmitry Chagin.Sx Lexical structure .
147619d2e3deSDmitry Chagin.Ss History substitution
147719d2e3deSDmitry ChaginEach command, or
147819d2e3deSDmitry Chagin.Sq event ,
147919d2e3deSDmitry Chagininput from the terminal is saved in the history list.
148019d2e3deSDmitry ChaginThe previous command is always saved, and the
148119d2e3deSDmitry Chagin.Va history
148219d2e3deSDmitry Chaginshell
148319d2e3deSDmitry Chaginvariable can be set to a number to save that many commands.
148419d2e3deSDmitry ChaginThe
148519d2e3deSDmitry Chagin.Va histdup
148619d2e3deSDmitry Chaginshell variable can be set to not save duplicate events or consecutive duplicate
148719d2e3deSDmitry Chaginevents.
148819d2e3deSDmitry Chagin.Pp
148919d2e3deSDmitry ChaginSaved commands are numbered sequentially from 1 and stamped with the time.
149019d2e3deSDmitry ChaginIt is not usually necessary to use event numbers, but the current event number
149119d2e3deSDmitry Chagincan be made part of the prompt by placing an
149219d2e3deSDmitry Chagin.Sq \&!
149319d2e3deSDmitry Chaginin the
149419d2e3deSDmitry Chagin.Va prompt
149519d2e3deSDmitry Chaginshell variable.
149619d2e3deSDmitry Chagin.Pp
1497*5224c2a3SDmitry ChaginBy default history entries are displayed by printing each parsed token
1498*5224c2a3SDmitry Chaginseparated by space; thus the redirection operator
1499*5224c2a3SDmitry Chagin.Sq >\&&\&!
1500*5224c2a3SDmitry Chaginwill be displayed as
1501*5224c2a3SDmitry Chagin.Sq >\0\&&\0\&! .
150219d2e3deSDmitry ChaginThe shell actually saves history in expanded and literal (unexpanded) forms.
150319d2e3deSDmitry ChaginIf the
150419d2e3deSDmitry Chagin.Va histlit
150519d2e3deSDmitry Chaginshell variable is set, commands that display and store
150619d2e3deSDmitry Chaginhistory use the literal form.
150719d2e3deSDmitry Chagin.Pp
150819d2e3deSDmitry ChaginThe
150919d2e3deSDmitry Chagin.Va history
151019d2e3deSDmitry Chaginbuiltin command can print, store in a file, restore
151119d2e3deSDmitry Chaginand clear the history list at any time,
151219d2e3deSDmitry Chaginand the
151319d2e3deSDmitry Chagin.Va savehist
151419d2e3deSDmitry Chaginand
151519d2e3deSDmitry Chagin.Va histfile
151619d2e3deSDmitry Chaginshell variables can be set to
151719d2e3deSDmitry Chaginstore the history list automatically on logout and restore it on login.
151819d2e3deSDmitry Chagin.Pp
151919d2e3deSDmitry ChaginHistory substitutions introduce words from the history list into the input
152019d2e3deSDmitry Chaginstream, making it easy to repeat commands, repeat arguments of a previous
152119d2e3deSDmitry Chagincommand in the current command, or fix spelling mistakes in the previous
152219d2e3deSDmitry Chagincommand with little typing and a high degree of confidence.
152319d2e3deSDmitry Chagin.Pp
152419d2e3deSDmitry ChaginHistory substitutions begin with the character
152519d2e3deSDmitry Chagin.Sq \&!
152619d2e3deSDmitry ChaginThey may begin anywhere in
152719d2e3deSDmitry Chaginthe input stream, but they do not nest.
152819d2e3deSDmitry ChaginThe
152919d2e3deSDmitry Chagin.Sq \&!
153019d2e3deSDmitry Chaginmay be preceded by a
153119d2e3deSDmitry Chagin.Sq \e
153219d2e3deSDmitry Chaginto
153319d2e3deSDmitry Chaginprevent its special meaning; for convenience, a
153419d2e3deSDmitry Chagin.Sq \&!
153519d2e3deSDmitry Chaginis passed unchanged when it
153619d2e3deSDmitry Chaginis followed by a blank, tab, newline,
153719d2e3deSDmitry Chagin.Sq =
153819d2e3deSDmitry Chaginor
153919d2e3deSDmitry Chagin.Sq \&(
154019d2e3deSDmitry ChaginHistory substitutions also
154119d2e3deSDmitry Chaginoccur when an input line begins with
154219d2e3deSDmitry Chagin.Sq ^
154319d2e3deSDmitry ChaginThis special abbreviation will be
154419d2e3deSDmitry Chagindescribed later.
154519d2e3deSDmitry ChaginThe characters used to signal history substitution
154619d2e3deSDmitry Chagin.Sq ( \&!
154719d2e3deSDmitry Chaginand
154819d2e3deSDmitry Chagin.Sq ^ )
154919d2e3deSDmitry Chagincan be changed by setting the
155019d2e3deSDmitry Chagin.Va histchars
155119d2e3deSDmitry Chaginshell variable.
155219d2e3deSDmitry ChaginAny input
155319d2e3deSDmitry Chaginline which contains a history substitution is printed before it is executed.
155419d2e3deSDmitry Chagin.Pp
155519d2e3deSDmitry ChaginA history substitution may have an
155619d2e3deSDmitry Chagin.Sq event specification ,
155719d2e3deSDmitry Chaginwhich indicates the event from which words are to be taken, a
155819d2e3deSDmitry Chagin.Sq word designator ,
155919d2e3deSDmitry Chaginwhich selects particular words from the chosen event, and/or a
156019d2e3deSDmitry Chagin.Sq modifier ,
156119d2e3deSDmitry Chaginwhich manipulates the selected words.
156219d2e3deSDmitry Chagin.Pp
156319d2e3deSDmitry ChaginAn event specification can be
156419d2e3deSDmitry Chagin.Pp
156519d2e3deSDmitry Chagin.Bl -tag -width XXXX -offset indent -compact
156619d2e3deSDmitry Chagin.It Ar n
156719d2e3deSDmitry ChaginA number, referring to a particular event
156819d2e3deSDmitry Chagin.It Ar \-n
156919d2e3deSDmitry ChaginAn offset, referring to the event
157019d2e3deSDmitry Chagin.Ar n
157119d2e3deSDmitry Chaginbefore the current event
157219d2e3deSDmitry Chagin.It Ar #
157319d2e3deSDmitry ChaginThe current event.
157419d2e3deSDmitry ChaginThis should be used carefully in
157519d2e3deSDmitry Chagin.Xr csh 1 ,
157619d2e3deSDmitry Chaginwhere there is no check for recursion.
157719d2e3deSDmitry Chagin.Nm
157819d2e3deSDmitry Chaginallows 10 levels of recursion.
157919d2e3deSDmitry Chagin(+)
158019d2e3deSDmitry Chagin.It Ar \&!
158119d2e3deSDmitry ChaginThe previous event (equivalent to
158219d2e3deSDmitry Chagin.Sq \-1 )
158319d2e3deSDmitry Chagin.It Ar s
158419d2e3deSDmitry ChaginThe most recent event whose first word begins with the string
158519d2e3deSDmitry Chagin.Va s
158619d2e3deSDmitry Chagin.It Ar ?s?
158719d2e3deSDmitry ChaginThe most recent event which contains the string
158819d2e3deSDmitry Chagin.Va s
158919d2e3deSDmitry ChaginThe second
159019d2e3deSDmitry Chagin.Sq \&?
159119d2e3deSDmitry Chagincan be omitted if it is immediately followed by a newline.
159219d2e3deSDmitry Chagin.El
159319d2e3deSDmitry Chagin.Pp
159419d2e3deSDmitry ChaginFor example, consider this bit of someone's history list:
159519d2e3deSDmitry Chagin.Bd -literal -offset indent
159619d2e3deSDmitry Chagin 9  8:30    nroff \-man wumpus.man
159719d2e3deSDmitry Chagin10  8:31    cp wumpus.man wumpus.man.old
159819d2e3deSDmitry Chagin11  8:36    vi wumpus.man
159919d2e3deSDmitry Chagin12  8:37    diff wumpus.man.old wumpus.man
160019d2e3deSDmitry Chagin.Ed
160119d2e3deSDmitry Chagin.Pp
160219d2e3deSDmitry ChaginThe commands are shown with their event numbers and time stamps.
160319d2e3deSDmitry ChaginThe current event, which we haven't typed in yet, is event 13.
160419d2e3deSDmitry Chagin.Sq !11
160519d2e3deSDmitry Chaginand
160619d2e3deSDmitry Chagin.Sq !\-2
160719d2e3deSDmitry Chaginrefer to event 11.
160819d2e3deSDmitry Chagin.Sq \&!!
160919d2e3deSDmitry Chaginrefers to the previous event, 12.
161019d2e3deSDmitry Chagin.Sq \&!!
161119d2e3deSDmitry Chagincan be abbreviated
161219d2e3deSDmitry Chagin.Sq \&!
161319d2e3deSDmitry Chaginif it is
161419d2e3deSDmitry Chaginfollowed by
161519d2e3deSDmitry Chagin.Sq \&:
161619d2e3deSDmitry Chagin.Sq ( \&:
161719d2e3deSDmitry Chaginis described below).
161819d2e3deSDmitry Chagin.Sq !n
161919d2e3deSDmitry Chaginrefers to event 9, which begins with
162019d2e3deSDmitry Chagin.Sq n
162119d2e3deSDmitry Chagin.Sq !?old?
162219d2e3deSDmitry Chaginalso refers to event 12, which contains
162319d2e3deSDmitry Chagin.Sq old
162419d2e3deSDmitry ChaginWithout word designators or modifiers history references simply expand to the
162519d2e3deSDmitry Chaginentire event, so we might type
162619d2e3deSDmitry Chagin.Sq !cp
162719d2e3deSDmitry Chaginto redo the copy command or
162819d2e3deSDmitry Chagin.Sq !!|more
162919d2e3deSDmitry Chaginif the
163019d2e3deSDmitry Chagin.Sq diff
163119d2e3deSDmitry Chaginoutput scrolled off the top of the screen.
163219d2e3deSDmitry Chagin.Pp
163319d2e3deSDmitry ChaginHistory references may be insulated from the surrounding text with braces if
163419d2e3deSDmitry Chaginnecessary.
163519d2e3deSDmitry ChaginFor example,
163619d2e3deSDmitry Chagin.Sq !vdoc
163719d2e3deSDmitry Chaginwould look for a command beginning with
163819d2e3deSDmitry Chagin.Sq vdoc ,
163919d2e3deSDmitry Chaginand, in this example, not find one, but
164019d2e3deSDmitry Chagin.Sq !{v}doc
164119d2e3deSDmitry Chaginwould expand
164219d2e3deSDmitry Chaginunambiguously to
164319d2e3deSDmitry Chagin.Sq vi wumpus.mandoc
164419d2e3deSDmitry ChaginEven in braces, history substitutions do not nest.
164519d2e3deSDmitry Chagin.Pp
164619d2e3deSDmitry Chagin(+) While
164719d2e3deSDmitry Chagin.Xr csh 1
164819d2e3deSDmitry Chaginexpands, for example,
164919d2e3deSDmitry Chagin.Sq !3d
165019d2e3deSDmitry Chaginto event 3 with the
165119d2e3deSDmitry Chaginletter
165219d2e3deSDmitry Chagin.Sq d
165319d2e3deSDmitry Chaginappended to it,
165419d2e3deSDmitry Chagin.Nm
165519d2e3deSDmitry Chaginexpands it to the last event beginning
165619d2e3deSDmitry Chaginwith
165719d2e3deSDmitry Chagin.Sq 3d ;
165819d2e3deSDmitry Chaginonly completely numeric arguments are treated as event numbers.
165919d2e3deSDmitry ChaginThis makes it possible to recall events beginning with numbers.
166019d2e3deSDmitry ChaginTo expand
166119d2e3deSDmitry Chagin.Sq !3d
166219d2e3deSDmitry Chaginas in
166319d2e3deSDmitry Chagin.Xr csh 1
166419d2e3deSDmitry Chaginsay
166519d2e3deSDmitry Chagin.Sq !{3}d
166619d2e3deSDmitry Chagin.Pp
166719d2e3deSDmitry ChaginTo select words from an event we can follow the event specification by a
166819d2e3deSDmitry Chagin.Sq \&:
166919d2e3deSDmitry Chaginand a designator for the desired words.
167019d2e3deSDmitry ChaginThe words of an input line are
167119d2e3deSDmitry Chaginnumbered from 0, the first (usually command) word being 0, the second word
167219d2e3deSDmitry Chagin(first argument) being 1, etc.
167319d2e3deSDmitry ChaginThe basic word designators are:
1674d803a9d0SBrooks Davis.Pp
167519d2e3deSDmitry Chagin.Bl -tag -width XXXX -offset indent -compact
167619d2e3deSDmitry Chagin.It Ar 0
167719d2e3deSDmitry ChaginThe first (command) word
167819d2e3deSDmitry Chagin.It Ar n
167919d2e3deSDmitry ChaginThe
168019d2e3deSDmitry Chagin.Va n
168119d2e3deSDmitry Chaginth argument
168219d2e3deSDmitry Chagin.It Ar ^
168319d2e3deSDmitry ChaginThe first argument, equivalent to
168419d2e3deSDmitry Chagin.Sq 1
168519d2e3deSDmitry Chagin.It Ar $
168619d2e3deSDmitry ChaginThe last argument
168719d2e3deSDmitry Chagin.It Ar %
168819d2e3deSDmitry ChaginThe word matched by an ?
168919d2e3deSDmitry Chagin.Va s
169019d2e3deSDmitry Chagin? search
169119d2e3deSDmitry Chagin.It Ar x\-y
169219d2e3deSDmitry ChaginA range of words
169319d2e3deSDmitry Chagin.It Ar \-y
169419d2e3deSDmitry ChaginEquivalent to
169519d2e3deSDmitry Chagin.Sq 0\-y
169619d2e3deSDmitry Chagin.It Ar *
169719d2e3deSDmitry ChaginEquivalent to
169819d2e3deSDmitry Chagin.Sq ^\-$ ,
169919d2e3deSDmitry Chaginbut returns nothing if the event contains only 1 word
170019d2e3deSDmitry Chagin.It Ar x*
170119d2e3deSDmitry ChaginEquivalent to
170219d2e3deSDmitry Chagin.Sq x\-$
170319d2e3deSDmitry Chagin.It Ar x\-
170419d2e3deSDmitry ChaginEquivalent to
170519d2e3deSDmitry Chagin.Sq x* ,
170619d2e3deSDmitry Chaginbut omitting the last word
170719d2e3deSDmitry Chagin.Sq ( $ )
170819d2e3deSDmitry Chagin.El
170919d2e3deSDmitry Chagin.Pp
171019d2e3deSDmitry ChaginSelected words are inserted into the command line separated by single blanks.
171119d2e3deSDmitry ChaginFor example, the
171219d2e3deSDmitry Chagin.Sq diff
171319d2e3deSDmitry Chagincommand in the previous example might have been
171419d2e3deSDmitry Chagintyped as
171519d2e3deSDmitry Chagin.Sq diff !!:1.old !!:1
171619d2e3deSDmitry Chagin(using
171719d2e3deSDmitry Chagin.Sq \&:1
171819d2e3deSDmitry Chaginto select the first argument
171919d2e3deSDmitry Chaginfrom the previous event) or
172019d2e3deSDmitry Chagin.Sq diff !\-2:2 !\-2:1
172119d2e3deSDmitry Chaginto select and swap the
172219d2e3deSDmitry Chaginarguments from the
172319d2e3deSDmitry Chagin.Sq cp
172419d2e3deSDmitry Chagincommand.
172519d2e3deSDmitry ChaginIf we didn't care about the order of the
172619d2e3deSDmitry Chagin`diff' we might have said
172719d2e3deSDmitry Chagin.Sq diff !\-2:1\-2
172819d2e3deSDmitry Chaginor simply
172919d2e3deSDmitry Chagin.Sq diff !\-2:*
173019d2e3deSDmitry ChaginThe
173119d2e3deSDmitry Chagin.Sq cp
173219d2e3deSDmitry Chagincommand might have been written
173319d2e3deSDmitry Chagin.Sq cp wumpus.man !#:1.old
173419d2e3deSDmitry Chagin, using
173519d2e3deSDmitry Chagin.Sq #
173619d2e3deSDmitry Chaginto refer to the current event.
173719d2e3deSDmitry Chagin`!n:\- hurkle.man' would reuse the first two words from the
173819d2e3deSDmitry Chagin.Sq nroff
173919d2e3deSDmitry Chagincommand
174019d2e3deSDmitry Chaginto say
174119d2e3deSDmitry Chagin.Sq nroff \-man hurkle.man
174219d2e3deSDmitry Chagin.Pp
174319d2e3deSDmitry ChaginThe
174419d2e3deSDmitry Chagin.Sq \&:
174519d2e3deSDmitry Chaginseparating the event specification from the word designator can be
174619d2e3deSDmitry Chaginomitted if the argument selector begins with a
174719d2e3deSDmitry Chagin.Sq ^ ,
174819d2e3deSDmitry Chagin.Sq $ ,
174919d2e3deSDmitry Chagin.Sq * ,
175019d2e3deSDmitry Chagin.Sq %
175119d2e3deSDmitry Chaginor
175219d2e3deSDmitry Chagin.Sq \&-
175319d2e3deSDmitry ChaginFor example, our
175419d2e3deSDmitry Chagin.Sq diff
175519d2e3deSDmitry Chagincommand might have been
175619d2e3deSDmitry Chagin.Sq diff !!^.old !!^
175719d2e3deSDmitry Chaginor,
175819d2e3deSDmitry Chaginequivalently,
175919d2e3deSDmitry Chagin.Sq diff !!$.old !!$
176019d2e3deSDmitry ChaginHowever, if
176119d2e3deSDmitry Chagin.Sq \&!!
176219d2e3deSDmitry Chaginis abbreviated
176319d2e3deSDmitry Chagin.Sq \&!
176419d2e3deSDmitry Chagin,
176519d2e3deSDmitry Chaginan argument selector beginning with
176619d2e3deSDmitry Chagin.Sq \-
176719d2e3deSDmitry Chaginwill be interpreted as an event
176819d2e3deSDmitry Chaginspecification.
176919d2e3deSDmitry Chagin.Pp
177019d2e3deSDmitry ChaginA history reference may have a word designator but no event specification.
177119d2e3deSDmitry ChaginIt then references the previous command.
177219d2e3deSDmitry ChaginContinuing our
177319d2e3deSDmitry Chagin.Sq diff
177419d2e3deSDmitry Chaginexample, we could have said simply `diff
177519d2e3deSDmitry Chagin!^.old !^' or, to get the arguments in the opposite order, just
177619d2e3deSDmitry Chagin.Sq diff !*
177719d2e3deSDmitry Chagin.Pp
177819d2e3deSDmitry ChaginThe word or words in a history reference can be edited, or
177919d2e3deSDmitry Chagin.Sq `modified
178019d2e3deSDmitry Chagin',
178119d2e3deSDmitry Chaginby following it with one or more modifiers, each preceded by a
178219d2e3deSDmitry Chagin.Sq \&: :
178319d2e3deSDmitry Chagin.Pp
178419d2e3deSDmitry Chagin.Bl -tag -width XXXXXX -offset indent -compact
178519d2e3deSDmitry Chagin.It Ar h
178619d2e3deSDmitry ChaginRemove a trailing pathname component, leaving the head.
178719d2e3deSDmitry Chagin.It Ar t
178819d2e3deSDmitry ChaginRemove all leading pathname components, leaving the tail.
178919d2e3deSDmitry Chagin.It Ar r
179019d2e3deSDmitry ChaginRemove a filename extension
179119d2e3deSDmitry Chagin.Sq .xxx ,
179219d2e3deSDmitry Chaginleaving the root name.
179319d2e3deSDmitry Chagin.It Ar e
179419d2e3deSDmitry ChaginRemove all but the extension.
179519d2e3deSDmitry Chagin.It Ar u
179619d2e3deSDmitry ChaginUppercase the first lowercase letter.
179719d2e3deSDmitry Chagin.It Ar l
179819d2e3deSDmitry ChaginLowercase the first uppercase letter.
179919d2e3deSDmitry Chagin.It Ar s/l/r/
180019d2e3deSDmitry ChaginSubstitute
180119d2e3deSDmitry Chagin.Ar l
180219d2e3deSDmitry Chaginfor
180319d2e3deSDmitry Chagin.Ar r
180419d2e3deSDmitry Chagin.Ar l
180519d2e3deSDmitry Chaginis simply a string like
180619d2e3deSDmitry Chagin.Ar r
180719d2e3deSDmitry Chagin, not a regular expression as in
180819d2e3deSDmitry Chaginthe eponymous
180919d2e3deSDmitry Chagin.Xr ed 1
181019d2e3deSDmitry Chagincommand.
181119d2e3deSDmitry ChaginAny character may be used as the delimiter in place of
181219d2e3deSDmitry Chagin.Sq / ;
181319d2e3deSDmitry Chagina
181419d2e3deSDmitry Chagin.Sq \e
181519d2e3deSDmitry Chagincan be used to quote the delimiter inside
181619d2e3deSDmitry Chagin.Va l
181719d2e3deSDmitry Chaginand
181819d2e3deSDmitry Chagin.Va r
181919d2e3deSDmitry ChaginThe character
182019d2e3deSDmitry Chagin.Sq &
182119d2e3deSDmitry Chaginin the
182219d2e3deSDmitry Chagin.Va r
182319d2e3deSDmitry Chaginis replaced by
182419d2e3deSDmitry Chagin.Va l ;
182519d2e3deSDmitry Chagin.Sq \e
182619d2e3deSDmitry Chaginalso quotes
182719d2e3deSDmitry Chagin.Sq &
182819d2e3deSDmitry ChaginIf
182919d2e3deSDmitry Chagin.Va l
183019d2e3deSDmitry Chaginis empty (
183119d2e3deSDmitry Chagin.Dq \& ) ,
183219d2e3deSDmitry Chaginthe
183319d2e3deSDmitry Chagin.Va l
183419d2e3deSDmitry Chaginfrom a previous substitution or the
183519d2e3deSDmitry Chagin.Va s
183619d2e3deSDmitry Chaginfrom a previous search or event number in event specification is used.
183719d2e3deSDmitry ChaginThe trailing delimiter may be omitted if it is immediately followed by a
183819d2e3deSDmitry Chaginnewline.
183919d2e3deSDmitry Chagin.It Ar \&&
184019d2e3deSDmitry ChaginRepeat the previous substitution.
184119d2e3deSDmitry Chagin.It Ar g
184219d2e3deSDmitry ChaginApply the following modifier once to each word.
184319d2e3deSDmitry Chagin.It Ar a (+)
184419d2e3deSDmitry ChaginApply the following modifier as many times as possible to a single word.
184519d2e3deSDmitry Chagin.Sq a
184619d2e3deSDmitry Chaginand
184719d2e3deSDmitry Chagin.Sq g
184819d2e3deSDmitry Chagincan be used together to apply a modifier globally.
184919d2e3deSDmitry ChaginWith the
185019d2e3deSDmitry Chagin.Sq s
185119d2e3deSDmitry Chaginmodifier, only the patterns contained in the original word are
185219d2e3deSDmitry Chaginsubstituted, not patterns that contain any substitution result.
185319d2e3deSDmitry Chagin.It Ar p
185419d2e3deSDmitry ChaginPrint the new command line but do not execute it.
185519d2e3deSDmitry Chagin.It Ar q
185619d2e3deSDmitry ChaginQuote the substituted words, preventing further substitutions.
1857*5224c2a3SDmitry Chagin.It Ar Q
1858*5224c2a3SDmitry ChaginSame as
1859*5224c2a3SDmitry Chagin.Ar q
1860*5224c2a3SDmitry Chaginbut in addition preserve empty variables as a string containing a NUL.
1861*5224c2a3SDmitry ChaginThis is useful to preserve positional arguments for example:
1862*5224c2a3SDmitry Chagin.Bd -literal -offset indent -compact
1863*5224c2a3SDmitry Chagin> set args=('arg 1' '' 'arg 3')
1864*5224c2a3SDmitry Chagin> tcsh -f -c 'echo ${#argv}' $args:gQ
1865*5224c2a3SDmitry Chagin3
1866*5224c2a3SDmitry Chagin.Ed
186719d2e3deSDmitry Chagin.It Ar x
186819d2e3deSDmitry ChaginLike
186919d2e3deSDmitry Chagin.Ar q ,
187019d2e3deSDmitry Chaginbut break into words at blanks, tabs and newlines.
187119d2e3deSDmitry Chagin.El
187219d2e3deSDmitry Chagin.Pp
187319d2e3deSDmitry ChaginModifiers are applied to only the first modifiable word (unless
187419d2e3deSDmitry Chagin.Sq g
187519d2e3deSDmitry Chaginis used).
187619d2e3deSDmitry ChaginIt is an error for no word to be modifiable.
187719d2e3deSDmitry Chagin.Pp
187819d2e3deSDmitry ChaginFor example, the
187919d2e3deSDmitry Chagin.Sq diff
188019d2e3deSDmitry Chagincommand might have been written as `diff wumpus.man.old
188119d2e3deSDmitry Chagin!#^:r', using
188219d2e3deSDmitry Chagin.Sq \&:r
188319d2e3deSDmitry Chaginto remove
188419d2e3deSDmitry Chagin.Sq .old
188519d2e3deSDmitry Chaginfrom the first argument on the same line
188619d2e3deSDmitry Chagin(`!#^').
188719d2e3deSDmitry ChaginWe could say
188819d2e3deSDmitry Chagin.Sq echo hello out there
188919d2e3deSDmitry Chagin, then
189019d2e3deSDmitry Chagin.Sq echo !*:u
189119d2e3deSDmitry Chaginto capitalize
189219d2e3deSDmitry Chagin`hello',
189319d2e3deSDmitry Chagin.Sq echo !*:au
189419d2e3deSDmitry Chaginto say it out loud, or
189519d2e3deSDmitry Chagin.Sq echo !*:agu
189619d2e3deSDmitry Chaginto really shout.
189719d2e3deSDmitry ChaginWe might follow
189819d2e3deSDmitry Chagin.Sq mail \-s "I forgot my password" rot
189919d2e3deSDmitry Chaginwith
190019d2e3deSDmitry Chagin.Sq !:s/rot/root
190119d2e3deSDmitry Chaginto
190219d2e3deSDmitry Chagincorrect the spelling of
190319d2e3deSDmitry Chagin.Sq root
190419d2e3deSDmitry Chagin(but see
190519d2e3deSDmitry Chagin.Sx Spelling correction
190619d2e3deSDmitry Chaginfor a
190719d2e3deSDmitry Chagindifferent approach).
190819d2e3deSDmitry Chagin.Pp
190919d2e3deSDmitry ChaginThere is a special abbreviation for substitutions.
191019d2e3deSDmitry Chagin.Sq ^ ,
191119d2e3deSDmitry Chaginwhen it is the first character on an input line, is equivalent to
191219d2e3deSDmitry Chagin.Sq !:s^
191319d2e3deSDmitry ChaginThus we might have said
191419d2e3deSDmitry Chagin.Sq ^rot^root
191519d2e3deSDmitry Chaginto make the spelling correction in the
191619d2e3deSDmitry Chaginprevious example.
191719d2e3deSDmitry ChaginThis is the only history substitution which does not explicitly begin with
191819d2e3deSDmitry Chagin.Sq \&!
191919d2e3deSDmitry Chagin.Pp
192019d2e3deSDmitry Chagin(+) In
192119d2e3deSDmitry Chagin.Xr csh 1
192219d2e3deSDmitry Chaginas such, only one modifier may be applied to each history
192319d2e3deSDmitry Chaginor variable expansion.
192419d2e3deSDmitry ChaginIn
192519d2e3deSDmitry Chagin.Nm ,
192619d2e3deSDmitry Chaginmore than one may be used, for example
192719d2e3deSDmitry Chagin.Bd -literal -offset indent
192819d2e3deSDmitry Chagin% mv wumpus.man /usr/man/man1/wumpus.1
192919d2e3deSDmitry Chagin% man !$:t:r
193019d2e3deSDmitry Chaginman wumpus
193119d2e3deSDmitry Chagin.Ed
193219d2e3deSDmitry Chagin.Pp
193319d2e3deSDmitry ChaginIn
193419d2e3deSDmitry Chagin.Xr csh 1 ,
193519d2e3deSDmitry Chaginthe result would be
193619d2e3deSDmitry Chagin.Sq wumpus.1:r
193719d2e3deSDmitry ChaginA substitution followed by a
193819d2e3deSDmitry Chagincolon may need to be insulated from it with braces:
193919d2e3deSDmitry Chagin.Bd -literal -offset indent
194019d2e3deSDmitry Chagin> mv a.out /usr/games/wumpus
194119d2e3deSDmitry Chagin> setenv PATH !$:h:$PATH
194219d2e3deSDmitry ChaginBad ! modifier: $.
194319d2e3deSDmitry Chagin> setenv PATH !{\-2$:h}:$PATH
194419d2e3deSDmitry Chaginsetenv PATH /usr/games:/bin:/usr/bin:.
194519d2e3deSDmitry Chagin.Ed
194619d2e3deSDmitry Chagin.Pp
194719d2e3deSDmitry ChaginThe first attempt would succeed in
194819d2e3deSDmitry Chagin.Xr csh 1
194919d2e3deSDmitry Chaginbut fails in
195019d2e3deSDmitry Chagin.Nm ,
195119d2e3deSDmitry Chaginbecause
195219d2e3deSDmitry Chagin.Nm
195319d2e3deSDmitry Chaginexpects another modifier after the second colon
195419d2e3deSDmitry Chaginrather than
195519d2e3deSDmitry Chagin.Sq $
195619d2e3deSDmitry Chagin.Pp
195719d2e3deSDmitry ChaginFinally, history can be accessed through the editor as well as through
195819d2e3deSDmitry Chaginthe substitutions just described.
195919d2e3deSDmitry ChaginThe
196019d2e3deSDmitry Chagin.Ic up-
196119d2e3deSDmitry Chaginand
196219d2e3deSDmitry Chagin.Ic down-history ,
196319d2e3deSDmitry Chagin.Ic history-search-backward
196419d2e3deSDmitry Chaginand
196519d2e3deSDmitry Chagin.Va -forward ,
196619d2e3deSDmitry Chagin.Ic i-search-back
196719d2e3deSDmitry Chaginand
196819d2e3deSDmitry Chagin.Ic -fwd ,
196919d2e3deSDmitry Chagin.Ic vi-search-back
197019d2e3deSDmitry Chaginand
197119d2e3deSDmitry Chagin.Ic -fwd ,
197219d2e3deSDmitry Chagin.Ic copy-prev-word
197319d2e3deSDmitry Chaginand
197419d2e3deSDmitry Chagin.Ic insert-last-word
197519d2e3deSDmitry Chagineditor commands search for
197619d2e3deSDmitry Chaginevents in the history list and copy them into the input buffer.
197719d2e3deSDmitry ChaginThe
197819d2e3deSDmitry Chagin.Ic toggle-literal-history
197919d2e3deSDmitry Chagineditor command switches between the
198019d2e3deSDmitry Chaginexpanded and literal forms of history lines in the input buffer.
198119d2e3deSDmitry Chagin.Ic expand-history
198219d2e3deSDmitry Chaginand
198319d2e3deSDmitry Chagin.Ic expand-line
198419d2e3deSDmitry Chaginexpand history substitutions
198519d2e3deSDmitry Chaginin the current word and in the entire input buffer respectively.
198619d2e3deSDmitry Chagin.Ss Alias substitution
198719d2e3deSDmitry ChaginThe shell maintains a list of aliases which can be set, unset and printed by
198819d2e3deSDmitry Chaginthe
198919d2e3deSDmitry Chagin.Ic alias
199019d2e3deSDmitry Chaginand
199119d2e3deSDmitry Chagin.Ic unalias
199219d2e3deSDmitry Chagincommands.
199319d2e3deSDmitry ChaginAfter a command line is parsed
199419d2e3deSDmitry Chagininto simple commands (see
199519d2e3deSDmitry Chagin.Sx Commands )
199619d2e3deSDmitry Chaginthe first word of each command,
199719d2e3deSDmitry Chaginleft-to-right, is checked to see if it has an alias.
199819d2e3deSDmitry ChaginIf so, the first word is
199919d2e3deSDmitry Chaginreplaced by the alias.
200019d2e3deSDmitry ChaginIf the alias contains a history reference, it undergoes
200119d2e3deSDmitry Chagin.Va History substitution
200219d2e3deSDmitry Chagin(q.v.) as though the original command were the
200319d2e3deSDmitry Chaginprevious input line.
200419d2e3deSDmitry ChaginIf the alias does not contain a history reference, the
200519d2e3deSDmitry Chaginargument list is left untouched.
200619d2e3deSDmitry Chagin.Pp
200719d2e3deSDmitry ChaginThus if the alias for
200819d2e3deSDmitry Chagin.Sq ls
200919d2e3deSDmitry Chaginwere
201019d2e3deSDmitry Chagin.Sq ls \-l
201119d2e3deSDmitry Chaginthe command
201219d2e3deSDmitry Chagin.Sq ls /usr
201319d2e3deSDmitry Chaginwould become `ls
201419d2e3deSDmitry Chagin\-l /usr', the argument list here being undisturbed.
201519d2e3deSDmitry ChaginIf the alias for
201619d2e3deSDmitry Chagin.Sq lookup
201719d2e3deSDmitry Chaginwere
201819d2e3deSDmitry Chagin.Sq grep !/etc/passwd
201919d2e3deSDmitry Chaginthen
202019d2e3deSDmitry Chagin.Sq lookup bill
202119d2e3deSDmitry Chaginwould become `grep bill
202219d2e3deSDmitry Chagin/etc/passwd'.
202319d2e3deSDmitry ChaginAliases can be used to introduce parser metasyntax.
202419d2e3deSDmitry ChaginFor
202519d2e3deSDmitry Chaginexample,
202619d2e3deSDmitry Chagin.Sq alias print
202719d2e3deSDmitry Chaginpr \e!* | lpr'' defines a
202819d2e3deSDmitry Chagin.Sq `command
202919d2e3deSDmitry Chagin' (`print') which
203019d2e3deSDmitry Chagin.Va pr
203119d2e3deSDmitry Chagin(1)s its arguments to the line printer.
203219d2e3deSDmitry Chagin.Pp
203319d2e3deSDmitry ChaginAlias substitution is repeated until the first word of the command has no
203419d2e3deSDmitry Chaginalias.
203519d2e3deSDmitry ChaginIf an alias substitution does not change the first word (as in the
203619d2e3deSDmitry Chaginprevious example) it is flagged to prevent a loop.
203719d2e3deSDmitry ChaginOther loops are detected and
203819d2e3deSDmitry Chagincause an error.
203919d2e3deSDmitry Chagin.Pp
204019d2e3deSDmitry ChaginSome aliases are referred to by the shell; see
204119d2e3deSDmitry Chagin.Va Special aliases
2042d803a9d0SBrooks Davis.Ss Variable substitution
204319d2e3deSDmitry ChaginThe shell maintains a list of variables, each of which has as value a list of
204419d2e3deSDmitry Chaginzero or more words.
204519d2e3deSDmitry ChaginThe values of shell variables can be displayed and changed with the
204619d2e3deSDmitry Chagin.Va set
204719d2e3deSDmitry Chaginand
204819d2e3deSDmitry Chagin.Va unset
204919d2e3deSDmitry Chagincommands.
205019d2e3deSDmitry ChaginThe system maintains its own list of
205119d2e3deSDmitry Chagin.Sq `environment
205219d2e3deSDmitry Chagin' variables.
205319d2e3deSDmitry ChaginThese can be displayed and changed with
205419d2e3deSDmitry Chagin.Va printenv
205519d2e3deSDmitry Chagin,
205619d2e3deSDmitry Chagin.Va setenv
205719d2e3deSDmitry Chaginand
205819d2e3deSDmitry Chagin.Va unsetenv
205919d2e3deSDmitry Chagin.Pp
206019d2e3deSDmitry Chagin(+) Variables may be made read-only with
206119d2e3deSDmitry Chagin.Sq set \-r
206219d2e3deSDmitry Chagin(q.v.).
206319d2e3deSDmitry ChaginRead-only variables may not be modified or unset;
206419d2e3deSDmitry Chaginattempting to do so will cause an error.
206519d2e3deSDmitry ChaginOnce made read-only, a variable cannot be made writable,
206619d2e3deSDmitry Chaginso
206719d2e3deSDmitry Chagin.Sq set \-r
206819d2e3deSDmitry Chaginshould be used with caution.
206919d2e3deSDmitry ChaginEnvironment variables cannot be made read-only.
207019d2e3deSDmitry Chagin.Pp
207119d2e3deSDmitry ChaginSome variables are set by the shell or referred to by it.
207219d2e3deSDmitry ChaginFor instance, the
207319d2e3deSDmitry Chagin.Va argv
207419d2e3deSDmitry Chaginvariable is an image of the shell's argument
207519d2e3deSDmitry Chaginlist, and words of this variable's value are referred to in special ways.
207619d2e3deSDmitry ChaginSome of the variables referred to by the shell are toggles;
207719d2e3deSDmitry Chaginthe shell does not care what their value is, only whether they are set or not.
207819d2e3deSDmitry ChaginFor instance, the
207919d2e3deSDmitry Chagin.Va verbose
208019d2e3deSDmitry Chaginvariable is a toggle which causes command
208119d2e3deSDmitry Chagininput to be echoed.
208219d2e3deSDmitry ChaginThe
208319d2e3deSDmitry Chagin.Fl v\fR command line option sets this variable.
208419d2e3deSDmitry Chagin.Va Special shell variables
208519d2e3deSDmitry Chaginlists all variables which are referred to by the shell.
208619d2e3deSDmitry Chagin.Pp
208719d2e3deSDmitry ChaginOther operations treat variables numerically.
208819d2e3deSDmitry ChaginThe
208919d2e3deSDmitry Chagin.Sq @
209019d2e3deSDmitry Chagincommand permits numeric
209119d2e3deSDmitry Chagincalculations to be performed and the result assigned to a variable.
209219d2e3deSDmitry ChaginVariable
209319d2e3deSDmitry Chaginvalues are, however, always represented as (zero or more) strings.
209419d2e3deSDmitry ChaginFor the
209519d2e3deSDmitry Chaginpurposes of numeric operations, the null string is considered to be zero, and
209619d2e3deSDmitry Chaginthe second and subsequent words of multi-word values are ignored.
209719d2e3deSDmitry Chagin.Pp
209819d2e3deSDmitry ChaginAfter the input line is aliased and parsed, and before each command is
209919d2e3deSDmitry Chaginexecuted, variable substitution is performed keyed by
210019d2e3deSDmitry Chagin.Sq $
210119d2e3deSDmitry Chagincharacters.
210219d2e3deSDmitry ChaginThis
210319d2e3deSDmitry Chaginexpansion can be prevented by preceding the
210419d2e3deSDmitry Chagin.Sq $
210519d2e3deSDmitry Chaginwith a
210619d2e3deSDmitry Chagin.Sq \e
210719d2e3deSDmitry Chaginexcept within
210819d2e3deSDmitry Chagin.Sq "
210919d2e3deSDmitry Chagins
211019d2e3deSDmitry Chaginwhere it
211119d2e3deSDmitry Chagin.Va always
211219d2e3deSDmitry Chaginoccurs, and within
211319d2e3deSDmitry Chagin.Sq
211419d2e3deSDmitry Chagin's where it
211519d2e3deSDmitry Chagin.Va never
211619d2e3deSDmitry Chaginoccurs.
211719d2e3deSDmitry ChaginStrings quoted by
211819d2e3deSDmitry Chagin.Sq \`
211919d2e3deSDmitry Chaginare interpreted later (see
212019d2e3deSDmitry Chagin.Sx Command substitution
212119d2e3deSDmitry Chaginbelow) so
212219d2e3deSDmitry Chagin.Sq $
212319d2e3deSDmitry Chaginsubstitution does not occur there until later,
212419d2e3deSDmitry Chaginif at all.
212519d2e3deSDmitry ChaginA
212619d2e3deSDmitry Chagin.Sq $
212719d2e3deSDmitry Chaginis passed unchanged if followed by a blank, tab, or
212819d2e3deSDmitry Chaginend-of-line.
212919d2e3deSDmitry Chagin.Pp
213019d2e3deSDmitry ChaginInput/output redirections are recognized before variable expansion, and are
213119d2e3deSDmitry Chaginvariable expanded separately.
213219d2e3deSDmitry ChaginOtherwise, the command name and entire argument
213319d2e3deSDmitry Chaginlist are expanded together.
213419d2e3deSDmitry ChaginIt is thus possible for the first (command) word
213519d2e3deSDmitry Chagin(to this point) to generate more than one word, the first of which becomes the
213619d2e3deSDmitry Chagincommand name, and the rest of which become arguments.
213719d2e3deSDmitry Chagin.Pp
213819d2e3deSDmitry ChaginUnless enclosed in
213919d2e3deSDmitry Chagin.Sq "
214019d2e3deSDmitry Chaginor given the
214119d2e3deSDmitry Chagin.Sq \&:q
214219d2e3deSDmitry Chaginmodifier the results of variable
214319d2e3deSDmitry Chaginsubstitution may eventually be command and filename substituted.
214419d2e3deSDmitry ChaginWithin
214519d2e3deSDmitry Chagin.Sq "
214619d2e3deSDmitry Chagin, a
214719d2e3deSDmitry Chaginvariable whose value consists of multiple words expands to a (portion of a)
214819d2e3deSDmitry Chaginsingle word, with the words of the variable's value separated by blanks.
214919d2e3deSDmitry ChaginWhen
215019d2e3deSDmitry Chaginthe
215119d2e3deSDmitry Chagin.Sq \&:q
215219d2e3deSDmitry Chaginmodifier is applied to a substitution the variable will expand to
215319d2e3deSDmitry Chaginmultiple words with each word separated by a blank and quoted to prevent later
215419d2e3deSDmitry Chagincommand or filename substitution.
215519d2e3deSDmitry Chagin.Pp
215619d2e3deSDmitry ChaginThe following metasequences are provided for introducing variable values into
215719d2e3deSDmitry Chaginthe shell input.
215819d2e3deSDmitry ChaginExcept as noted, it is an error to reference a variable which
215919d2e3deSDmitry Chaginis not set.
216019d2e3deSDmitry Chagin.Pp
216119d2e3deSDmitry Chagin.Bl -tag -width XXXXXXXXXX -offset indent -compact
216219d2e3deSDmitry Chagin.PD 0
216319d2e3deSDmitry Chagin.It Ar $name
216419d2e3deSDmitry Chagin.It Ar ${name}
216519d2e3deSDmitry ChaginSubstitutes the words of the value of variable
216619d2e3deSDmitry Chagin.Va name ,
216719d2e3deSDmitry Chagineach separated
216819d2e3deSDmitry Chaginby a blank.
216919d2e3deSDmitry ChaginBraces insulate
217019d2e3deSDmitry Chagin.Va name
217119d2e3deSDmitry Chaginfrom following characters which would
217219d2e3deSDmitry Chaginotherwise be part of it.
217319d2e3deSDmitry ChaginShell variables have names consisting of
217419d2e3deSDmitry Chaginletters and digits starting with a letter.
217519d2e3deSDmitry ChaginThe underscore character is
217619d2e3deSDmitry Chaginconsidered a letter.
217719d2e3deSDmitry ChaginIf
217819d2e3deSDmitry Chagin.Va name
217919d2e3deSDmitry Chaginis not a shell variable, but is set in the
218019d2e3deSDmitry Chaginenvironment, then that value is returned (but some of the other forms
218119d2e3deSDmitry Chagingiven below are not available in this case).
218219d2e3deSDmitry Chagin.It Ar $name[selector]
218319d2e3deSDmitry Chagin.It Ar ${name[selector]}
218419d2e3deSDmitry ChaginSubstitutes only the selected words from the value of
218519d2e3deSDmitry Chagin.Va name
218619d2e3deSDmitry ChaginThe
218719d2e3deSDmitry Chagin.Va selector
218819d2e3deSDmitry Chaginis subjected to
218919d2e3deSDmitry Chagin.Sq $
219019d2e3deSDmitry Chaginsubstitution and may consist of
219119d2e3deSDmitry Chagina single number or two numbers separated by a
219219d2e3deSDmitry Chagin.Sq \&-
219319d2e3deSDmitry ChaginThe first word of a variable's value is numbered
219419d2e3deSDmitry Chagin.Sq 1
219519d2e3deSDmitry ChaginIf the first number of a range is omitted it defaults to
219619d2e3deSDmitry Chagin.Sq 1
219719d2e3deSDmitry ChaginIf the last member of a range is omitted it defaults to
219819d2e3deSDmitry Chagin.Sq $#
219919d2e3deSDmitry Chagin.Va name
220019d2e3deSDmitry ChaginThe
220119d2e3deSDmitry Chagin.Va selector
220219d2e3deSDmitry Chagin.Sq *
220319d2e3deSDmitry Chaginselects all words.
220419d2e3deSDmitry ChaginIt is not an error for a range to be empty if the
220519d2e3deSDmitry Chaginsecond argument is omitted or in range.
220619d2e3deSDmitry Chagin.It Ar $0
220719d2e3deSDmitry ChaginSubstitutes the name of the file from which command input
220819d2e3deSDmitry Chaginis being read.
220919d2e3deSDmitry ChaginAn error occurs if the name is not known.
221019d2e3deSDmitry Chagin.It Ar $number
221119d2e3deSDmitry Chagin.It Ar ${number}
221219d2e3deSDmitry ChaginEquivalent to
221319d2e3deSDmitry Chagin.Sq $argv[number]
221419d2e3deSDmitry Chagin.It Ar $*
221519d2e3deSDmitry ChaginEquivalent to
221619d2e3deSDmitry Chagin.Sq $argv ,
221719d2e3deSDmitry Chaginwhich is equivalent to
221819d2e3deSDmitry Chagin.Sq $argv[*]
221919d2e3deSDmitry Chagin.El
222019d2e3deSDmitry Chagin.Pp
222119d2e3deSDmitry ChaginThe
222219d2e3deSDmitry Chagin.Sq \&:
222319d2e3deSDmitry Chaginmodifiers described under
222419d2e3deSDmitry Chagin.Sx History substitution ,
222519d2e3deSDmitry Chaginexcept for
222619d2e3deSDmitry Chagin.Sq \&:p ,
222719d2e3deSDmitry Chagincan be applied to the substitutions above.
222819d2e3deSDmitry ChaginMore than one may be used.
222919d2e3deSDmitry Chagin(+)
223019d2e3deSDmitry ChaginBraces may be needed to insulate a variable substitution from a literal colon
223119d2e3deSDmitry Chaginjust as with
223219d2e3deSDmitry Chagin.Sx History substitution
223319d2e3deSDmitry Chagin(q.v.); any modifiers must appear
223419d2e3deSDmitry Chaginwithin the braces.
223519d2e3deSDmitry Chagin.Pp
223619d2e3deSDmitry ChaginThe following substitutions can not be modified with
223719d2e3deSDmitry Chagin.Sq \&:
223819d2e3deSDmitry Chaginmodifiers.
223919d2e3deSDmitry Chagin.Pp
2240d803a9d0SBrooks Davis.Bl -tag -width XXXXXXXXXX -offset indent -compact
224119d2e3deSDmitry Chagin.It Ar $?name
224219d2e3deSDmitry Chagin.It Ar ${?name}
224319d2e3deSDmitry ChaginSubstitutes the string
224419d2e3deSDmitry Chagin.Sq 1
224519d2e3deSDmitry Chaginif
224619d2e3deSDmitry Chagin.Va name
224719d2e3deSDmitry Chaginis set,
224819d2e3deSDmitry Chagin.Sq 0
224919d2e3deSDmitry Chaginif it is not.
225019d2e3deSDmitry Chagin.It Ar $?0
225119d2e3deSDmitry ChaginSubstitutes
225219d2e3deSDmitry Chagin.Sq 1
225319d2e3deSDmitry Chaginif the current input filename is known,
225419d2e3deSDmitry Chagin.Sq 0
225519d2e3deSDmitry Chaginif it is not.
225619d2e3deSDmitry ChaginAlways
225719d2e3deSDmitry Chagin.Sq 0
225819d2e3deSDmitry Chaginin interactive shells.
2259d803a9d0SBrooks Davis.It Ar $#name
2260d803a9d0SBrooks Davis.It Ar ${#name}
226119d2e3deSDmitry ChaginSubstitutes the number of words in
226219d2e3deSDmitry Chagin.Va name
2263d803a9d0SBrooks Davis.It Ar $#
226419d2e3deSDmitry ChaginEquivalent to
226519d2e3deSDmitry Chagin.Sq $#argv
226619d2e3deSDmitry Chagin(+)
2267d803a9d0SBrooks Davis.It Ar $%name
226819d2e3deSDmitry Chagin.It Ar ${%name}
226919d2e3deSDmitry ChaginSubstitutes the number of characters in
227019d2e3deSDmitry Chagin.Va name
227119d2e3deSDmitry Chagin(+)
227219d2e3deSDmitry Chagin.Pp
2273d803a9d0SBrooks Davis.It Ar $%number
227419d2e3deSDmitry Chagin.It Ar ${%number}
227519d2e3deSDmitry ChaginSubstitutes the number of characters in
227619d2e3deSDmitry Chagin.Va $argv[number] .
227719d2e3deSDmitry Chagin(+)
227819d2e3deSDmitry Chagin.It Ar $?
227919d2e3deSDmitry ChaginEquivalent to
228019d2e3deSDmitry Chagin.Sq $status
228119d2e3deSDmitry Chagin(+)
228219d2e3deSDmitry Chagin.It Ar $$
228319d2e3deSDmitry ChaginSubstitutes the (decimal) process number of the (parent) shell.
228419d2e3deSDmitry Chagin.It Ar $!
228519d2e3deSDmitry ChaginSubstitutes the (decimal) process number of the last
228619d2e3deSDmitry Chaginbackground process started by this shell.
228719d2e3deSDmitry Chagin(+)
228819d2e3deSDmitry Chagin.It Ar $_
228919d2e3deSDmitry ChaginSubstitutes the command line of the last command executed.
229019d2e3deSDmitry Chagin(+)
229119d2e3deSDmitry Chagin.It Ar $<
229219d2e3deSDmitry ChaginSubstitutes a line from the standard input, with no further interpretation
229319d2e3deSDmitry Chaginthereafter.
229419d2e3deSDmitry ChaginIt can be used to read from the keyboard in a shell script.
229519d2e3deSDmitry Chagin(+) While
229619d2e3deSDmitry Chagin.Xr csh 1
229719d2e3deSDmitry Chaginalways quotes $<, as if it were equivalent to
229819d2e3deSDmitry Chagin.Sq $<:q ,
229919d2e3deSDmitry Chagin.Nm
230019d2e3deSDmitry Chagindoes not.
230119d2e3deSDmitry ChaginFurthermore, when
230219d2e3deSDmitry Chagin.Nm
230319d2e3deSDmitry Chaginis waiting for a line to be
230419d2e3deSDmitry Chagintyped the user may type an interrupt to interrupt the sequence into
230519d2e3deSDmitry Chaginwhich the line is to be substituted, but
230619d2e3deSDmitry Chagin.Xr csh 1
230719d2e3deSDmitry Chagindoes not allow this.
230819d2e3deSDmitry Chagin.El
230919d2e3deSDmitry Chagin.Pp
231019d2e3deSDmitry ChaginThe editor command
231119d2e3deSDmitry Chagin.Va expand-variables
231219d2e3deSDmitry Chagin, normally bound to
231319d2e3deSDmitry Chagin.Sq ^X-$ ,
231419d2e3deSDmitry Chagincan be used to interactively expand individual variables.
231519d2e3deSDmitry Chagin.Ss "Command, filename and directory stack substitution"
231619d2e3deSDmitry ChaginThe remaining substitutions are applied selectively to the arguments
231719d2e3deSDmitry Chaginof builtin commands.
231819d2e3deSDmitry ChaginThis means that portions of expressions which are not evaluated are
231919d2e3deSDmitry Chaginnot subjected to these expansions.
232019d2e3deSDmitry ChaginFor commands which are not internal to the
232119d2e3deSDmitry Chaginshell, the command name is substituted separately from the argument list.
232219d2e3deSDmitry ChaginThis occurs very late, after input-output redirection is performed, andk
232319d2e3deSDmitry Chaginin a child of the main shell.
232419d2e3deSDmitry Chagin.Ss "Command substitution"
232519d2e3deSDmitry ChaginCommand substitution is indicated by a command enclosed in
232619d2e3deSDmitry Chagin.Sq \&`
232719d2e3deSDmitry ChaginThe output
232819d2e3deSDmitry Chaginfrom such a command is broken into separate words at blanks, tabs and newlines,
232919d2e3deSDmitry Chaginand null words are discarded.
233019d2e3deSDmitry ChaginThe output is variable and command substituted
233119d2e3deSDmitry Chaginand put in place of the original string.
233219d2e3deSDmitry Chagin.Pp
233319d2e3deSDmitry ChaginCommand substitutions inside double
233419d2e3deSDmitry Chaginquotes
233519d2e3deSDmitry Chagin.Sq ( \&" )
233619d2e3deSDmitry Chaginretain blanks and tabs; only newlines force new words.
233719d2e3deSDmitry ChaginThe single
233819d2e3deSDmitry Chaginfinal newline does not force a new word in any case.
233919d2e3deSDmitry ChaginIt is thus possible for a
234019d2e3deSDmitry Chagincommand substitution to yield only part of a word, even if the command outputs
234119d2e3deSDmitry Chagina complete line.
234219d2e3deSDmitry Chagin.Pp
234319d2e3deSDmitry ChaginBy default, the shell since version 6.12 replaces all newline and carriage
234419d2e3deSDmitry Chaginreturn characters in the command by spaces.
234519d2e3deSDmitry ChaginIf this is switched off by
234619d2e3deSDmitry Chaginunsetting
234719d2e3deSDmitry Chagin.Va csubstnonl ,
234819d2e3deSDmitry Chaginnewlines separate commands as usual.
234919d2e3deSDmitry Chagin.Ss "Filename substitution"
235019d2e3deSDmitry ChaginIf a word contains any of the characters
235119d2e3deSDmitry Chagin.Sq * ,
235219d2e3deSDmitry Chagin.Sq \&? ,
235319d2e3deSDmitry Chagin.Sq \&[
235419d2e3deSDmitry Chaginor
235519d2e3deSDmitry Chagin.Sq {
235619d2e3deSDmitry Chaginor begins with
235719d2e3deSDmitry Chaginthe character
235819d2e3deSDmitry Chagin.Sq ~
235919d2e3deSDmitry Chaginit is a candidate for filename substitution, also known as
236019d2e3deSDmitry Chagin.Dq globbing .
236119d2e3deSDmitry ChaginThis word is then regarded as a pattern
236219d2e3deSDmitry Chagin.Dq ( glob-pattern ) ,
236319d2e3deSDmitry Chaginand
236419d2e3deSDmitry Chaginreplaced with an alphabetically sorted list of file names which match the
236519d2e3deSDmitry Chaginpattern.
236619d2e3deSDmitry Chagin.Pp
236719d2e3deSDmitry ChaginIn matching filenames, the character
236819d2e3deSDmitry Chagin.Sq .
236919d2e3deSDmitry Chaginat the beginning of a filename or
237019d2e3deSDmitry Chaginimmediately following a
237119d2e3deSDmitry Chagin.Sq / ,
237219d2e3deSDmitry Chaginas well as the character
237319d2e3deSDmitry Chagin.Sq /
237419d2e3deSDmitry Chaginmust be matched
237519d2e3deSDmitry Chaginexplicitly (unless either
237619d2e3deSDmitry Chagin.Va globdot
237719d2e3deSDmitry Chaginor
237819d2e3deSDmitry Chagin.Va globstar
237919d2e3deSDmitry Chaginor both are set(+)).
238019d2e3deSDmitry ChaginThe character
238119d2e3deSDmitry Chagin.Sq *
238219d2e3deSDmitry Chaginmatches any string of characters,
238319d2e3deSDmitry Chaginincluding the null string.
238419d2e3deSDmitry ChaginThe character
238519d2e3deSDmitry Chagin.Sq \&?
238619d2e3deSDmitry Chaginmatches any single character.
238719d2e3deSDmitry ChaginThe sequence
238819d2e3deSDmitry Chagin.Sq [...]
238919d2e3deSDmitry Chaginmatches any one of the characters enclosed.
239019d2e3deSDmitry ChaginWithin
239119d2e3deSDmitry Chagin.Sq [...]
239219d2e3deSDmitry Chagin, a pair of
239319d2e3deSDmitry Chagincharacters separated by
239419d2e3deSDmitry Chagin.Sq \&-
239519d2e3deSDmitry Chaginmatches any character lexically between the two.
239619d2e3deSDmitry Chagin.Pp
239719d2e3deSDmitry Chagin(+) Some glob-patterns can be negated:
239819d2e3deSDmitry ChaginThe sequence
239919d2e3deSDmitry Chagin.Sq [^...]
240019d2e3deSDmitry Chaginmatches any single character
240119d2e3deSDmitry Chagin.Va not
240219d2e3deSDmitry Chaginspecified by the
240319d2e3deSDmitry Chagincharacters and/or ranges of characters in the braces.
240419d2e3deSDmitry Chagin.Pp
240519d2e3deSDmitry ChaginAn entire glob-pattern can also be negated with
240619d2e3deSDmitry Chagin.Sq ^ :
240719d2e3deSDmitry Chagin.Bd -literal -offset indent
240819d2e3deSDmitry Chagin> echo *
240919d2e3deSDmitry Chaginbang crash crunch ouch
241019d2e3deSDmitry Chagin> echo ^cr*
241119d2e3deSDmitry Chaginbang ouch
241219d2e3deSDmitry Chagin.Ed
241319d2e3deSDmitry Chagin.Pp
241419d2e3deSDmitry ChaginGlob-patterns which do not use
241519d2e3deSDmitry Chagin.Sq \&? ,
241619d2e3deSDmitry Chagin.Sq * , or
241719d2e3deSDmitry Chagin.Sq []
241819d2e3deSDmitry Chaginor which use
241919d2e3deSDmitry Chagin.Sq {}
242019d2e3deSDmitry Chaginor
242119d2e3deSDmitry Chagin.Sq ~
242219d2e3deSDmitry Chagin(below) are not negated correctly.
242319d2e3deSDmitry Chagin.Pp
242419d2e3deSDmitry ChaginThe metanotation
242519d2e3deSDmitry Chagin.Sq a{b,c,d}e
242619d2e3deSDmitry Chaginis a shorthand for
242719d2e3deSDmitry Chagin.Sq abe ace ade
242819d2e3deSDmitry ChaginLeft-to-right order is preserved:
242919d2e3deSDmitry Chagin.Sq /usr/source/s1/{oldls,ls}.c
243019d2e3deSDmitry Chaginexpands
243119d2e3deSDmitry Chaginto
243219d2e3deSDmitry Chagin.Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c
243319d2e3deSDmitry ChaginThe results of matches are
243419d2e3deSDmitry Chaginsorted separately at a low level to preserve this order:
243519d2e3deSDmitry Chagin.Sq ../{memo,*box}
243619d2e3deSDmitry Chaginmight expand to
243719d2e3deSDmitry Chagin.Sq ../memo ../box ../mbox
243819d2e3deSDmitry Chagin(Note that
243919d2e3deSDmitry Chagin.Sq memo
244019d2e3deSDmitry Chaginwas not sorted with the results of matching
244119d2e3deSDmitry Chagin.Sq *box . )
244219d2e3deSDmitry ChaginIt is not an error when this construct expands to files which do not exist,
244319d2e3deSDmitry Chaginbut it is possible to get an error from a command to which the expanded list
244419d2e3deSDmitry Chaginis passed.
244519d2e3deSDmitry ChaginThis construct may be nested.
244619d2e3deSDmitry ChaginAs a special case the words
244719d2e3deSDmitry Chagin.Sq { ,
244819d2e3deSDmitry Chagin.Sq }
244919d2e3deSDmitry Chaginand
245019d2e3deSDmitry Chagin.Sq {}
245119d2e3deSDmitry Chaginare passed undisturbed.
245219d2e3deSDmitry Chagin.Pp
245319d2e3deSDmitry ChaginThe character
245419d2e3deSDmitry Chagin.Sq ~
245519d2e3deSDmitry Chaginat the beginning of a filename refers to home directories.
245619d2e3deSDmitry ChaginStanding alone, i.e.,
245719d2e3deSDmitry Chagin.Sq ~ ,
245819d2e3deSDmitry Chaginit expands to the invoker's home directory as
245919d2e3deSDmitry Chaginreflected in the value of the
246019d2e3deSDmitry Chagin.Va home
246119d2e3deSDmitry Chaginshell variable.
246219d2e3deSDmitry ChaginWhen followed by a
246319d2e3deSDmitry Chaginname consisting of letters, digits and
246419d2e3deSDmitry Chagin.Sq \&-
246519d2e3deSDmitry Chagincharacters the shell searches for a
246619d2e3deSDmitry Chaginuser with that name and substitutes their home directory; thus
246719d2e3deSDmitry Chagin.Sq ~ken
246819d2e3deSDmitry Chaginmight
246919d2e3deSDmitry Chaginexpand to
247019d2e3deSDmitry Chagin.Sq /usr/ken
247119d2e3deSDmitry Chaginand
247219d2e3deSDmitry Chagin.Sq ~ken/chmach
247319d2e3deSDmitry Chaginto
247419d2e3deSDmitry Chagin.Sq /usr/ken/chmach
247519d2e3deSDmitry ChaginIf the character
247619d2e3deSDmitry Chagin.Sq ~
247719d2e3deSDmitry Chaginis followed by a character other than a letter or
247819d2e3deSDmitry Chagin.Sq /
247919d2e3deSDmitry Chaginor appears elsewhere
248019d2e3deSDmitry Chaginthan at the beginning of a word, it is left undisturbed.
248119d2e3deSDmitry ChaginA command like
248219d2e3deSDmitry Chagin.Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man
248319d2e3deSDmitry Chagindoes not,
248419d2e3deSDmitry Chagintherefore, do home directory substitution as one might hope.
248519d2e3deSDmitry Chagin.Pp
248619d2e3deSDmitry ChaginIt is an error for a glob-pattern containing
248719d2e3deSDmitry Chagin.Sq * ,
248819d2e3deSDmitry Chagin.Sq \&?  ,
248919d2e3deSDmitry Chagin.Sq \&[
249019d2e3deSDmitry Chaginor
249119d2e3deSDmitry Chagin.Sq ~ ,
249219d2e3deSDmitry Chaginwith or
249319d2e3deSDmitry Chaginwithout
249419d2e3deSDmitry Chagin.Sq ^ ,
249519d2e3deSDmitry Chaginnot to match any files.
249619d2e3deSDmitry ChaginHowever, only one pattern in a list of
249719d2e3deSDmitry Chaginglob-patterns must match a file (so that, e.g.,
249819d2e3deSDmitry Chagin.Sq rm *.a *.c *.o
249919d2e3deSDmitry Chaginwould fail
250019d2e3deSDmitry Chaginonly if there were no files in the current directory ending in
250119d2e3deSDmitry Chagin.Sq .a ,
250219d2e3deSDmitry Chagin.Sq .c ,
250319d2e3deSDmitry Chaginor
250419d2e3deSDmitry Chagin.Sq .o ) ,
250519d2e3deSDmitry Chaginand if the
250619d2e3deSDmitry Chagin.Va nonomatch
250719d2e3deSDmitry Chaginshell variable is set a pattern (or list
250819d2e3deSDmitry Chaginof patterns) which matches nothing is left unchanged rather than causing
250919d2e3deSDmitry Chaginan error.
251019d2e3deSDmitry Chagin.Pp
251119d2e3deSDmitry ChaginThe
251219d2e3deSDmitry Chagin.Va globstar
251319d2e3deSDmitry Chaginshell variable can be set to allow
251419d2e3deSDmitry Chagin.Sq **
251519d2e3deSDmitry Chaginor
251619d2e3deSDmitry Chagin.Sq ***
251719d2e3deSDmitry Chaginas
251819d2e3deSDmitry Chagina file glob pattern that matches any string of characters including
251919d2e3deSDmitry Chagin.Sq / ,
252019d2e3deSDmitry Chaginrecursively traversing any existing sub-directories.
252119d2e3deSDmitry ChaginFor example,
252219d2e3deSDmitry Chagin.Sq ls **.c
252319d2e3deSDmitry Chaginwill list all the .c files in the current directory tree.
252419d2e3deSDmitry ChaginIf used by itself, it will match zero or more sub-directories
252519d2e3deSDmitry Chagin(e.g.
252619d2e3deSDmitry Chagin.Sq ls /usr/include/**/time.h
252719d2e3deSDmitry Chaginwill list any file named
252819d2e3deSDmitry Chagin.Sq time.h
252919d2e3deSDmitry Chaginin the /usr/include directory tree;
253019d2e3deSDmitry Chagin.Sq ls /usr/include/**time.h
253119d2e3deSDmitry Chaginwill match
253219d2e3deSDmitry Chaginany file in the /usr/include directory tree ending in
253319d2e3deSDmitry Chagin.Sq time.h ;
253419d2e3deSDmitry Chaginand
253519d2e3deSDmitry Chagin.Sq ls /usr/include/**time**.h
253619d2e3deSDmitry Chaginwill match any .h file with
253719d2e3deSDmitry Chagin.Sq time
253819d2e3deSDmitry Chagineither
253919d2e3deSDmitry Chaginin a subdirectory name or in the filename itself).
254019d2e3deSDmitry ChaginTo prevent problems with recursion, the
254119d2e3deSDmitry Chagin.Sq **
254219d2e3deSDmitry Chaginglob-pattern will not
254319d2e3deSDmitry Chagindescend into a symbolic link containing a directory.
254419d2e3deSDmitry ChaginTo override this,
254519d2e3deSDmitry Chaginuse
254619d2e3deSDmitry Chagin.Sq ***
254719d2e3deSDmitry Chagin(+)
254819d2e3deSDmitry Chagin.Pp
254919d2e3deSDmitry ChaginThe
255019d2e3deSDmitry Chagin.Va noglob
255119d2e3deSDmitry Chaginshell variable can be set to prevent filename substitution,
255219d2e3deSDmitry Chaginand the
255319d2e3deSDmitry Chagin.Va expand-glob
255419d2e3deSDmitry Chagineditor command, normally bound to
255519d2e3deSDmitry Chagin.Sq ^X-* ,
255619d2e3deSDmitry Chagincan be
255719d2e3deSDmitry Chaginused to interactively expand individual filename substitutions.
255819d2e3deSDmitry Chagin.Ss "Directory stack substitution (+)"
255919d2e3deSDmitry ChaginThe directory stack is a list of directories, numbered from zero, used by the
256019d2e3deSDmitry Chagin.Va pushd ,
256119d2e3deSDmitry Chagin.Va popd
256219d2e3deSDmitry Chaginand
256319d2e3deSDmitry Chagin.Va dirs
256419d2e3deSDmitry Chaginbuiltin commands (q.v.).
256519d2e3deSDmitry Chagin.Va dirs
256619d2e3deSDmitry Chagincan print, store in a file, restore and clear the directory stack
256719d2e3deSDmitry Chaginat any time, and the
256819d2e3deSDmitry Chagin.Va savedirs
256919d2e3deSDmitry Chaginand
257019d2e3deSDmitry Chagin.Va dirsfile
257119d2e3deSDmitry Chaginshell variables can be set to
257219d2e3deSDmitry Chaginstore the directory stack automatically on logout and restore it on login.
257319d2e3deSDmitry ChaginThe
257419d2e3deSDmitry Chagin.Va dirstack
257519d2e3deSDmitry Chaginshell variable can be examined to see the directory stack and
257619d2e3deSDmitry Chaginset to put arbitrary directories into the directory stack.
257719d2e3deSDmitry Chagin.Pp
257819d2e3deSDmitry ChaginThe character
257919d2e3deSDmitry Chagin.Sq =
258019d2e3deSDmitry Chaginfollowed by one or more digits expands to an entry in
258119d2e3deSDmitry Chaginthe directory stack.
258219d2e3deSDmitry ChaginThe special case
258319d2e3deSDmitry Chagin.Sq =-
258419d2e3deSDmitry Chaginexpands to the last directory in
258519d2e3deSDmitry Chaginthe stack.
258619d2e3deSDmitry ChaginFor example,
258719d2e3deSDmitry Chagin.Bd -literal -offset indent
258819d2e3deSDmitry Chagin> dirs \&-v
258919d2e3deSDmitry Chagin0       /usr/bin
259019d2e3deSDmitry Chagin1       /usr/spool/uucp
259119d2e3deSDmitry Chagin2       /usr/accts/sys
259219d2e3deSDmitry Chagin> echo =1
259319d2e3deSDmitry Chagin/usr/spool/uucp
259419d2e3deSDmitry Chagin> echo =0/calendar
259519d2e3deSDmitry Chagin/usr/bin/calendar
259619d2e3deSDmitry Chagin> echo =\-
259719d2e3deSDmitry Chagin/usr/accts/sys
259819d2e3deSDmitry Chagin.Ed
259919d2e3deSDmitry Chagin.Pp
260019d2e3deSDmitry ChaginThe
260119d2e3deSDmitry Chagin.Va noglob
260219d2e3deSDmitry Chaginand
260319d2e3deSDmitry Chagin.Va nonomatch
260419d2e3deSDmitry Chaginshell variables and the
260519d2e3deSDmitry Chagin.Va expand-glob
260619d2e3deSDmitry Chagineditor command apply to directory stack as well as filename substitutions.
260719d2e3deSDmitry Chagin.Ss "Other substitutions (+)"
260819d2e3deSDmitry ChaginThere are several more transformations involving filenames, not strictly
260919d2e3deSDmitry Chaginrelated to the above but mentioned here for completeness.
261019d2e3deSDmitry Chagin.Va Any
261119d2e3deSDmitry Chaginfilename may be expanded to a full path when the
261219d2e3deSDmitry Chagin.Va symlinks
261319d2e3deSDmitry Chaginvariable (q.v.) is set to
261419d2e3deSDmitry Chagin.Sq expand
261519d2e3deSDmitry ChaginQuoting prevents this expansion, and
261619d2e3deSDmitry Chaginthe
261719d2e3deSDmitry Chagin.Va normalize-path
261819d2e3deSDmitry Chagineditor command does it on demand.
261919d2e3deSDmitry ChaginThe
262019d2e3deSDmitry Chagin.Va normalize-command
262119d2e3deSDmitry Chagineditor command expands commands in PATH into
262219d2e3deSDmitry Chaginfull paths on demand.
262319d2e3deSDmitry ChaginFinally,
262419d2e3deSDmitry Chagin.Va cd
262519d2e3deSDmitry Chaginand
262619d2e3deSDmitry Chagin.Va pushd
262719d2e3deSDmitry Chagininterpret
262819d2e3deSDmitry Chagin.Sq \&-
262919d2e3deSDmitry Chaginas the old working directory
263019d2e3deSDmitry Chagin(equivalent to the shell variable
263119d2e3deSDmitry Chagin.Va owd ) .
263219d2e3deSDmitry ChaginThis is not a substitution at all, but an abbreviation recognized by only
263319d2e3deSDmitry Chaginthose commands.
263419d2e3deSDmitry ChaginNonetheless, it too can be prevented by quoting.
263519d2e3deSDmitry Chagin.Ss "Commands"
263619d2e3deSDmitry ChaginThe next three sections describe how the shell executes commands and
263719d2e3deSDmitry Chagindeals with their input and output.
263819d2e3deSDmitry Chagin.Ss "Simple commands, pipelines and sequences"
263919d2e3deSDmitry ChaginA simple command is a sequence of words, the first of which specifies the
264019d2e3deSDmitry Chagincommand to be executed.
264119d2e3deSDmitry ChaginA series of simple commands joined by
264219d2e3deSDmitry Chagin.Sq |
264319d2e3deSDmitry Chagincharacters
264419d2e3deSDmitry Chaginforms a pipeline.
264519d2e3deSDmitry ChaginThe output of each command in a pipeline is connected to the
264619d2e3deSDmitry Chagininput of the next.
264719d2e3deSDmitry Chagin.Pp
264819d2e3deSDmitry ChaginSimple commands and pipelines may be joined into sequences with
264919d2e3deSDmitry Chagin.Sq ; ,
265019d2e3deSDmitry Chaginand will
265119d2e3deSDmitry Chaginbe executed sequentially.
265219d2e3deSDmitry ChaginCommands and pipelines can also be joined into
265319d2e3deSDmitry Chaginsequences with
265419d2e3deSDmitry Chagin.Sq ||
265519d2e3deSDmitry Chaginor
265619d2e3deSDmitry Chagin.Sq && ,
265719d2e3deSDmitry Chaginindicating, as in the C language, that the second
265819d2e3deSDmitry Chaginis to be executed only if the first fails or succeeds respectively.
265919d2e3deSDmitry Chagin.Pp
266019d2e3deSDmitry ChaginA simple command, pipeline or sequence may be placed in parentheses,
266119d2e3deSDmitry Chagin.Sq () ,
266219d2e3deSDmitry Chaginto form a simple command, which may in turn be a component of a pipeline or
266319d2e3deSDmitry Chaginsequence.
266419d2e3deSDmitry ChaginA command, pipeline or sequence can be executed
266519d2e3deSDmitry Chaginwithout waiting for it to terminate by following it with an
266619d2e3deSDmitry Chagin.Sq \&& .
266719d2e3deSDmitry Chagin.Ss "Builtin and non-builtin command execution"
266819d2e3deSDmitry ChaginBuiltin commands are executed within the shell.
266919d2e3deSDmitry ChaginIf any component of a
267019d2e3deSDmitry Chaginpipeline except the last is a builtin command, the pipeline is executed
267119d2e3deSDmitry Chaginin a subshell.
267219d2e3deSDmitry Chagin.Pp
267319d2e3deSDmitry ChaginParenthesized commands are always executed in a subshell.
267419d2e3deSDmitry Chagin.Bd -literal -offset indent
267519d2e3deSDmitry Chagin(cd; pwd); pwd
267619d2e3deSDmitry Chagin.Ed
267719d2e3deSDmitry Chagin.Pp
267819d2e3deSDmitry Chaginthus prints the
267919d2e3deSDmitry Chagin.Va home
268019d2e3deSDmitry Chagindirectory, leaving you where you were
268119d2e3deSDmitry Chagin(printing this after the home directory), while
268219d2e3deSDmitry Chagin.Bd -literal -offset indent
268319d2e3deSDmitry Chagincd; pwd
268419d2e3deSDmitry Chagin.Ed
268519d2e3deSDmitry Chagin.Pp
268619d2e3deSDmitry Chaginleaves you in the
268719d2e3deSDmitry Chagin.Va home
268819d2e3deSDmitry Chagindirectory.
268919d2e3deSDmitry ChaginParenthesized commands are most often
269019d2e3deSDmitry Chaginused to prevent
269119d2e3deSDmitry Chagin.Va cd
269219d2e3deSDmitry Chaginfrom affecting the current shell.
269319d2e3deSDmitry Chagin.Pp
269419d2e3deSDmitry ChaginWhen a command to be executed is found not to be a builtin command the shell
269519d2e3deSDmitry Chaginattempts to execute the command via
269619d2e3deSDmitry Chagin.Xr execve 2 .
269719d2e3deSDmitry ChaginEach word in the variable
269819d2e3deSDmitry Chagin.Va path
269919d2e3deSDmitry Chaginnames a directory in which the shell will look for the
270019d2e3deSDmitry Chagincommand.
270119d2e3deSDmitry ChaginIf the shell is not given a
270219d2e3deSDmitry Chagin.Fl f
270319d2e3deSDmitry Chaginoption, the shell
270419d2e3deSDmitry Chaginhashes the names in these directories into an internal table so that it will
270519d2e3deSDmitry Chagintry an
270619d2e3deSDmitry Chagin.Xr execve 2
270719d2e3deSDmitry Chaginin only a directory where there is a possibility that the
270819d2e3deSDmitry Chagincommand resides there.
270919d2e3deSDmitry ChaginThis greatly speeds command location when a large
271019d2e3deSDmitry Chaginnumber of directories are present in the search path. This hashing mechanism is
271119d2e3deSDmitry Chaginnot used:
271219d2e3deSDmitry Chagin.TP 4
271319d2e3deSDmitry Chagin.Bl -enum -width indent
271419d2e3deSDmitry Chagin.It
271519d2e3deSDmitry ChaginIf hashing is turned explicitly off via
271619d2e3deSDmitry Chagin.Va unhash
271719d2e3deSDmitry Chagin.It
271819d2e3deSDmitry ChaginIf the shell was given a
271919d2e3deSDmitry Chagin.Fl f Ar argument
272019d2e3deSDmitry Chagin.It
272119d2e3deSDmitry ChaginFor each directory component of
272219d2e3deSDmitry Chagin.Va path
272319d2e3deSDmitry Chaginwhich does not begin with a
272419d2e3deSDmitry Chagin.Sq /
272519d2e3deSDmitry Chagin.It
272619d2e3deSDmitry ChaginIf the command contains a
272719d2e3deSDmitry Chagin.Sq /
272819d2e3deSDmitry Chagin.El
272919d2e3deSDmitry Chagin.Pp
273019d2e3deSDmitry ChaginIn the above four cases the shell concatenates each component of the path
273119d2e3deSDmitry Chaginvector with the given command name to form a path name of a file which it
273219d2e3deSDmitry Chaginthen attempts to execute it. If execution is successful, the search stops.
273319d2e3deSDmitry Chagin.Pp
273419d2e3deSDmitry ChaginIf the file has execute permissions but is not an executable to the system
273519d2e3deSDmitry Chagin(i.e., it is neither an executable binary nor a script that specifies its
273619d2e3deSDmitry Chagininterpreter), then it is assumed to be a file containing shell commands and
273719d2e3deSDmitry Chagina new shell is spawned to read it.
273819d2e3deSDmitry ChaginThe
273919d2e3deSDmitry Chagin.Va shell
274019d2e3deSDmitry Chaginspecial alias may be set
274119d2e3deSDmitry Chaginto specify an interpreter other than the shell itself.
274219d2e3deSDmitry Chagin.Pp
274319d2e3deSDmitry ChaginOn systems which do not understand the
274419d2e3deSDmitry Chagin.Sq #!
274519d2e3deSDmitry Chaginscript interpreter convention
274619d2e3deSDmitry Chaginthe shell may be compiled to emulate it; see the
274719d2e3deSDmitry Chagin.Va version
274819d2e3deSDmitry Chaginshell
274919d2e3deSDmitry Chaginvariable.
275019d2e3deSDmitry ChaginIf so, the shell checks the first line of the file to
275119d2e3deSDmitry Chaginsee if it is of the form
275219d2e3deSDmitry Chagin.Sq #!interpreter arg ...
275319d2e3deSDmitry ChaginIf it is,
275419d2e3deSDmitry Chaginthe shell starts
275519d2e3deSDmitry Chagin.Va interpreter
275619d2e3deSDmitry Chaginwith the given
275719d2e3deSDmitry Chagin.Va arg
275819d2e3deSDmitry Chagins and feeds the
275919d2e3deSDmitry Chaginfile to it on standard input.
276019d2e3deSDmitry Chagin.Ss "Input/output"
276119d2e3deSDmitry ChaginThe standard input and standard output of a command may be redirected with the
276219d2e3deSDmitry Chaginfollowing syntax:
276319d2e3deSDmitry Chagin.Pp
2764d803a9d0SBrooks Davis.Bl -tag -width XXXXXXXXX -offset indent -compact
276519d2e3deSDmitry Chagin.It Ar < name
276619d2e3deSDmitry ChaginOpen file
276719d2e3deSDmitry Chagin.Va name
276819d2e3deSDmitry Chagin(which is first variable, command and filename
276919d2e3deSDmitry Chaginexpanded) as the standard input.
277019d2e3deSDmitry Chagin.It Ar << word
277119d2e3deSDmitry ChaginRead the shell input up to a line which is identical to
277219d2e3deSDmitry Chagin.Va word .
277319d2e3deSDmitry Chagin.Va word
277419d2e3deSDmitry Chaginis not subjected to variable, filename or command substitution, and each input
277519d2e3deSDmitry Chaginline is compared to
277619d2e3deSDmitry Chagin.Va word
277719d2e3deSDmitry Chaginbefore any substitutions are done on this input
277819d2e3deSDmitry Chaginline.
277919d2e3deSDmitry ChaginUnless a quoting
278019d2e3deSDmitry Chagin.Sq \e ,
278119d2e3deSDmitry Chagin.Sq \&"
278219d2e3deSDmitry Chagin,
278319d2e3deSDmitry Chagin.Sq \&'
278419d2e3deSDmitry Chaginor
278519d2e3deSDmitry Chagin.Sq \&`
278619d2e3deSDmitry Chaginappears in
278719d2e3deSDmitry Chagin.Va word
278819d2e3deSDmitry Chaginvariable and
278919d2e3deSDmitry Chagincommand substitution is performed on the intervening lines, allowing
279019d2e3deSDmitry Chagin.Sq \e
279119d2e3deSDmitry Chaginto
279219d2e3deSDmitry Chaginquote
279319d2e3deSDmitry Chagin.Sq $ ,
279419d2e3deSDmitry Chagin.Sq \e
279519d2e3deSDmitry Chaginand
279619d2e3deSDmitry Chagin.Sq \&` .
279719d2e3deSDmitry ChaginCommands which are substituted have all blanks, tabs,
279819d2e3deSDmitry Chaginand newlines preserved, except for the final newline which is dropped.
279919d2e3deSDmitry ChaginThe
280019d2e3deSDmitry Chaginresultant text is placed in an anonymous temporary file which is given to the
280119d2e3deSDmitry Chagincommand as standard input.
280219d2e3deSDmitry Chagin.Pp
280319d2e3deSDmitry Chagin.It Ar > name
280419d2e3deSDmitry Chagin.It Ar >! name
280519d2e3deSDmitry Chagin.It Ar >& name
280619d2e3deSDmitry Chagin.It Ar >&! name
280719d2e3deSDmitry ChaginThe file
280819d2e3deSDmitry Chagin.Va name
280919d2e3deSDmitry Chaginis used as standard output.
281019d2e3deSDmitry ChaginIf the file does not exist
281119d2e3deSDmitry Chaginthen it is created; if the file exists, it is truncated, its previous contents
281219d2e3deSDmitry Chaginbeing lost.
281319d2e3deSDmitry Chagin.Pp
281419d2e3deSDmitry ChaginIf the shell variable
281519d2e3deSDmitry Chagin.Va noclobber
281619d2e3deSDmitry Chaginis set, then the file must not exist or be a
281719d2e3deSDmitry Chagincharacter special file (e.g., a terminal or
281819d2e3deSDmitry Chagin.Sq /dev/null )
281919d2e3deSDmitry Chaginor an error results.
282019d2e3deSDmitry ChaginThis helps prevent accidental destruction of files.
282119d2e3deSDmitry ChaginIn this case the
282219d2e3deSDmitry Chagin.Sq \&!
282319d2e3deSDmitry Chaginforms
282419d2e3deSDmitry Chagincan be used to suppress this check.
282519d2e3deSDmitry ChaginIf
282619d2e3deSDmitry Chagin.Va notempty
282719d2e3deSDmitry Chaginis given in
282819d2e3deSDmitry Chagin.Va noclobber ,
282919d2e3deSDmitry Chagin.Sq >
283019d2e3deSDmitry Chaginis allowed on empty files;
283119d2e3deSDmitry Chaginif
283219d2e3deSDmitry Chagin.Va ask
283319d2e3deSDmitry Chaginis set, an interacive confirmation is presented, rather than an
283419d2e3deSDmitry Chaginerror.
283519d2e3deSDmitry Chagin.Pp
283619d2e3deSDmitry ChaginThe forms involving
283719d2e3deSDmitry Chagin.Sq \&&
283819d2e3deSDmitry Chaginroute the diagnostic output into the specified file as
283919d2e3deSDmitry Chaginwell as the standard output.
284019d2e3deSDmitry Chagin.Va name
284119d2e3deSDmitry Chaginis expanded in the same way as
284219d2e3deSDmitry Chagin.Sq <
284319d2e3deSDmitry Chagininput filenames are.
284419d2e3deSDmitry Chagin.Pp
284519d2e3deSDmitry Chagin.It Ar >> name
284619d2e3deSDmitry Chagin.It Ar >>& name
284719d2e3deSDmitry Chagin.It Ar >>! name
284819d2e3deSDmitry Chagin.It Ar >>&! name
284919d2e3deSDmitry ChaginLike
285019d2e3deSDmitry Chagin.Sq >
285119d2e3deSDmitry Chagin, but appends output to the end of
285219d2e3deSDmitry Chagin.Va name
285319d2e3deSDmitry ChaginIf the shell variable
285419d2e3deSDmitry Chagin.Va noclobber
285519d2e3deSDmitry Chaginis set, then it is an error for
285619d2e3deSDmitry Chaginthe file
285719d2e3deSDmitry Chagin.Va not
285819d2e3deSDmitry Chaginto exist, unless one of the
285919d2e3deSDmitry Chagin.Sq \&!
286019d2e3deSDmitry Chaginforms is given.
286119d2e3deSDmitry Chagin.El
286219d2e3deSDmitry Chagin.Pp
286319d2e3deSDmitry ChaginA command receives the environment in which the shell was invoked as modified
286419d2e3deSDmitry Chaginby the input-output parameters and the presence of the command in a pipeline.
286519d2e3deSDmitry ChaginThus, unlike some previous shells, commands run from a file of shell commands
286619d2e3deSDmitry Chaginhave no access to the text of the commands by default; rather they receive the
286719d2e3deSDmitry Chaginoriginal standard input of the shell.
286819d2e3deSDmitry ChaginThe
286919d2e3deSDmitry Chagin.Sq <<
287019d2e3deSDmitry Chaginmechanism should be used to
287119d2e3deSDmitry Chaginpresent inline data.
287219d2e3deSDmitry ChaginThis permits shell command scripts to function as
287319d2e3deSDmitry Chagincomponents of pipelines and allows the shell to block read its input.
287419d2e3deSDmitry ChaginNote
287519d2e3deSDmitry Chaginthat the default standard input for a command run detached is
287619d2e3deSDmitry Chagin.Va not
287719d2e3deSDmitry Chaginthe empty file
287819d2e3deSDmitry Chagin.Va /dev/null ,
287919d2e3deSDmitry Chaginbut the original standard input of the shell.
288019d2e3deSDmitry ChaginIf this is a terminal and if the process attempts to read from the terminal,
288119d2e3deSDmitry Chaginthen the process will block and the user will be notified (see
288219d2e3deSDmitry Chagin.Sx Jobs ) .
288319d2e3deSDmitry Chagin.Pp
288419d2e3deSDmitry ChaginDiagnostic output may be directed through a pipe with the standard output.
288519d2e3deSDmitry ChaginSimply use the form
288619d2e3deSDmitry Chagin.Sq |&
288719d2e3deSDmitry Chaginrather than just
288819d2e3deSDmitry Chagin.Sq | .
288919d2e3deSDmitry Chagin.Pp
289019d2e3deSDmitry ChaginThe shell cannot presently redirect diagnostic output without also redirecting
289119d2e3deSDmitry Chaginstandard output, but
289219d2e3deSDmitry Chagin.Sq \&( command > output-file ) >&  error-file
289319d2e3deSDmitry Chaginis often an acceptable workaround.
289419d2e3deSDmitry ChaginEither
289519d2e3deSDmitry Chagin.Va output-file
289619d2e3deSDmitry Chaginor
289719d2e3deSDmitry Chagin.Va error-file
289819d2e3deSDmitry Chaginmay be
289919d2e3deSDmitry Chagin.Sq /dev/tty
290019d2e3deSDmitry Chaginto send output to the terminal.
290119d2e3deSDmitry Chagin.Ss "Features"
290219d2e3deSDmitry ChaginHaving described how the shell accepts, parses and executes
290319d2e3deSDmitry Chagincommand lines, we now turn to a variety of its useful features.
290419d2e3deSDmitry Chagin.Ss "Control flow"
290519d2e3deSDmitry ChaginThe shell contains a number of commands which can be used to regulate the
290619d2e3deSDmitry Chaginflow of control in command files (shell scripts) and (in limited but
290719d2e3deSDmitry Chaginuseful ways) from terminal input.
290819d2e3deSDmitry ChaginThese commands all operate by forcing the
290919d2e3deSDmitry Chaginshell to reread or skip in its input and, due to the implementation,
291019d2e3deSDmitry Chaginrestrict the placement of some of the commands.
291119d2e3deSDmitry Chagin.Pp
291219d2e3deSDmitry ChaginThe
291319d2e3deSDmitry Chagin.Va foreach ,
291419d2e3deSDmitry Chagin.Va switch ,
291519d2e3deSDmitry Chaginand
291619d2e3deSDmitry Chagin.Va while
291719d2e3deSDmitry Chaginstatements, as well as the
291819d2e3deSDmitry Chagin.Va if-then-else
291919d2e3deSDmitry Chaginform of the
292019d2e3deSDmitry Chagin.Va if
292119d2e3deSDmitry Chaginstatement, require that the major
292219d2e3deSDmitry Chaginkeywords appear in a single simple command on an input line as shown below.
292319d2e3deSDmitry Chagin.Pp
292419d2e3deSDmitry ChaginIf the shell's input is not seekable, the shell buffers up input whenever
292519d2e3deSDmitry Chagina loop is being read and performs seeks in this internal buffer to
292619d2e3deSDmitry Chaginaccomplish the rereading implied by the loop.
292719d2e3deSDmitry Chagin(To the extent that this allows, backward
292819d2e3deSDmitry Chagin.Va goto
292919d2e3deSDmitry Chagins will succeed on non-seekable inputs.)
293019d2e3deSDmitry Chagin.Ss "Expressions"
293119d2e3deSDmitry ChaginThe
293219d2e3deSDmitry Chagin.Va if ,
293319d2e3deSDmitry Chagin.Va while
293419d2e3deSDmitry Chaginand
293519d2e3deSDmitry Chagin.Va exit
293619d2e3deSDmitry Chaginbuiltin commands
293719d2e3deSDmitry Chaginuse expressions with a common syntax.
293819d2e3deSDmitry ChaginThe expressions can include any
293919d2e3deSDmitry Chaginof the operators described in the next three sections.
294019d2e3deSDmitry ChaginNote that the
294119d2e3deSDmitry Chagin.Va @
294219d2e3deSDmitry Chaginbuiltin command (q.v.) has its own separate syntax.
294319d2e3deSDmitry Chagin.Ss "Logical, arithmetical and comparison operators"
294419d2e3deSDmitry ChaginThese operators are similar to those of C and have the same precedence.
294519d2e3deSDmitry ChaginThey include
294619d2e3deSDmitry Chagin.IP "" 4
294719d2e3deSDmitry Chagin.Bl -tag -width XXXXXX -offset indent -compact
294819d2e3deSDmitry Chagin.It ||  &&  |   &  ==  !=  =~  !~  <=  >=
294919d2e3deSDmitry Chagin.It <  > <<  >>  +  \-  *  /  %  !  ~  (  )
295019d2e3deSDmitry Chagin.El
295119d2e3deSDmitry Chagin.Pp
295219d2e3deSDmitry ChaginHere the precedence increases to the right,
295319d2e3deSDmitry Chagin.Sq ==
295419d2e3deSDmitry Chagin.Sq \&!=
295519d2e3deSDmitry Chagin.Sq =~
295619d2e3deSDmitry Chaginand
295719d2e3deSDmitry Chagin.Sq \&!~ ,
295819d2e3deSDmitry Chagin.Sq <=
295919d2e3deSDmitry Chagin.Sq >=
296019d2e3deSDmitry Chagin.Sq <
296119d2e3deSDmitry Chaginand
296219d2e3deSDmitry Chagin.Sq > ,
296319d2e3deSDmitry Chagin.Sq <<
296419d2e3deSDmitry Chagin.Sq >> ,
296519d2e3deSDmitry Chagin.Sq +
296619d2e3deSDmitry Chaginand
296719d2e3deSDmitry Chagin.Sq \&- ,
296819d2e3deSDmitry Chagin.Sq *
296919d2e3deSDmitry Chagin.Sq /
297019d2e3deSDmitry Chaginand
297119d2e3deSDmitry Chagin.Sq %
297219d2e3deSDmitry Chaginbeing, in
297319d2e3deSDmitry Chagingroups, at the same level.
297419d2e3deSDmitry ChaginThe
297519d2e3deSDmitry Chagin.Sq ==
297619d2e3deSDmitry Chagin.Sq \&!=
297719d2e3deSDmitry Chagin.Sq =~
297819d2e3deSDmitry Chaginand
297919d2e3deSDmitry Chagin.Sq \&!~
298019d2e3deSDmitry Chaginoperators compare
298119d2e3deSDmitry Chagintheir arguments as strings; all others operate on numbers.
298219d2e3deSDmitry ChaginThe operators
298319d2e3deSDmitry Chagin.Sq =~
298419d2e3deSDmitry Chaginand
298519d2e3deSDmitry Chagin.Sq \&!~
298619d2e3deSDmitry Chaginare like
298719d2e3deSDmitry Chagin.Sq \&!=
298819d2e3deSDmitry Chaginand
298919d2e3deSDmitry Chagin.Sq ==
299019d2e3deSDmitry Chaginexcept that the right hand side is a
299119d2e3deSDmitry Chaginglob-pattern (see
299219d2e3deSDmitry Chagin.Sx Filename substitution )
299319d2e3deSDmitry Chaginagainst which the left hand operand is matched.
299419d2e3deSDmitry ChaginThis reduces the need for use of the
299519d2e3deSDmitry Chagin.Va switch
299619d2e3deSDmitry Chaginbuiltin command in shell scripts when all that is really needed is
299719d2e3deSDmitry Chaginpattern matching.
299819d2e3deSDmitry Chagin.Pp
299919d2e3deSDmitry ChaginNull or
300019d2e3deSDmitry Chaginmissing arguments are considered
300119d2e3deSDmitry Chagin.Sq 0
300219d2e3deSDmitry ChaginThe results of all expressions are
300319d2e3deSDmitry Chaginstrings, which represent decimal numbers.
300419d2e3deSDmitry ChaginIt is important to note that
300519d2e3deSDmitry Chaginno two components of an expression can appear in the same word; except
300619d2e3deSDmitry Chaginwhen adjacent to components of expressions which are syntactically
300719d2e3deSDmitry Chaginsignificant to the parser
300819d2e3deSDmitry Chagin.Sq ( \&&
300919d2e3deSDmitry Chagin.Sq |
301019d2e3deSDmitry Chagin.Sq <
301119d2e3deSDmitry Chagin.Sq >
301219d2e3deSDmitry Chagin.Sq \&(
301319d2e3deSDmitry Chagin.Sq \&) )
301419d2e3deSDmitry Chaginthey should be
301519d2e3deSDmitry Chaginsurrounded by spaces.
301619d2e3deSDmitry Chagin.Ss "Command exit status"
301719d2e3deSDmitry ChaginCommands can be executed in expressions and their exit status
301819d2e3deSDmitry Chaginreturned by enclosing them in braces
301919d2e3deSDmitry Chagin.Sq ( {} ) .
302019d2e3deSDmitry ChaginRemember that the braces should
302119d2e3deSDmitry Chaginbe separated from the words of the command by spaces.
302219d2e3deSDmitry ChaginCommand executions
302319d2e3deSDmitry Chaginsucceed, returning true, i.e.,
302419d2e3deSDmitry Chagin.Sq 1 ,
302519d2e3deSDmitry Chaginif the command exits with status 0,
302619d2e3deSDmitry Chaginotherwise they fail, returning false, i.e.,
302719d2e3deSDmitry Chagin.Sq 0 .
302819d2e3deSDmitry ChaginIf more detailed status
302919d2e3deSDmitry Chagininformation is required then the command should be executed outside of an
303019d2e3deSDmitry Chaginexpression and the
303119d2e3deSDmitry Chagin.Va status
303219d2e3deSDmitry Chaginshell variable examined.
303319d2e3deSDmitry Chagin.Ss "File inquiry operators"
303419d2e3deSDmitry ChaginSome of these operators perform true/false tests on files and related
303519d2e3deSDmitry Chaginobjects.
303619d2e3deSDmitry ChaginThey are of the form
303719d2e3deSDmitry Chagin.Fl
303819d2e3deSDmitry Chagin.Va op file
303919d2e3deSDmitry Chagin, where
304019d2e3deSDmitry Chagin.Va op
304119d2e3deSDmitry Chaginis one of
304219d2e3deSDmitry Chagin.Bl -tag -width XXX -offset indent -compact
304319d2e3deSDmitry Chagin.It Ar r
304419d2e3deSDmitry ChaginRead access
304519d2e3deSDmitry Chagin.It Ar w
304619d2e3deSDmitry ChaginWrite access
304719d2e3deSDmitry Chagin.It Ar x
304819d2e3deSDmitry ChaginExecute access
304919d2e3deSDmitry Chagin.It Ar X
305019d2e3deSDmitry ChaginExecutable in the path or shell builtin, e.g.,
305119d2e3deSDmitry Chagin.Sq \&-X ls
305219d2e3deSDmitry Chaginand
305319d2e3deSDmitry Chagin.Sq \&-X ls\&-F
305419d2e3deSDmitry Chaginare
305519d2e3deSDmitry Chagingenerally true, but
305619d2e3deSDmitry Chagin.Sq \&-X /bin/ls
305719d2e3deSDmitry Chaginis not (+)
305819d2e3deSDmitry Chagin.It Ar e
305919d2e3deSDmitry ChaginExistence
306019d2e3deSDmitry Chagin.It Ar o
306119d2e3deSDmitry ChaginOwnership
306219d2e3deSDmitry Chagin.It Ar z
306319d2e3deSDmitry ChaginZero size
306419d2e3deSDmitry Chagin.It Ar s
306519d2e3deSDmitry ChaginNon-zero size (+)
306619d2e3deSDmitry Chagin.It Ar f
306719d2e3deSDmitry ChaginPlain file
306819d2e3deSDmitry Chagin.It Ar d
306919d2e3deSDmitry ChaginDirectory
307019d2e3deSDmitry Chagin.It Ar l
307119d2e3deSDmitry ChaginSymbolic link (+) *
307219d2e3deSDmitry Chagin.It Ar b
307319d2e3deSDmitry ChaginBlock special file (+)
307419d2e3deSDmitry Chagin.It Ar c
307519d2e3deSDmitry ChaginCharacter special file (+)
307619d2e3deSDmitry Chagin.It Ar p
307719d2e3deSDmitry ChaginNamed pipe (fifo) (+) *
307819d2e3deSDmitry Chagin.It Ar S
307919d2e3deSDmitry ChaginSocket special file (+) *
308019d2e3deSDmitry Chagin.It Ar u
308119d2e3deSDmitry ChaginSet-user-ID bit is set (+)
308219d2e3deSDmitry Chagin.It Ar g
308319d2e3deSDmitry ChaginSet-group-ID bit is set (+)
308419d2e3deSDmitry Chagin.It Ar k
308519d2e3deSDmitry ChaginSticky bit is set (+)
308619d2e3deSDmitry Chagin.It Ar t file
308719d2e3deSDmitry Chagin(which must be a digit) is an open file descriptor
308819d2e3deSDmitry Chaginfor a terminal device (+)
308919d2e3deSDmitry Chagin.It Ar R
309019d2e3deSDmitry ChaginHas been migrated (Convex only) (+)
309119d2e3deSDmitry Chagin.It Ar L
309219d2e3deSDmitry ChaginApplies subsequent operators in a multiple-operator test to a symbolic link
309319d2e3deSDmitry Chaginrather than to the file to which the link points (+) *
309419d2e3deSDmitry Chagin.El
309519d2e3deSDmitry Chagin.Pp
309619d2e3deSDmitry Chagin.Va file
309719d2e3deSDmitry Chaginis command and filename expanded and then tested to
309819d2e3deSDmitry Chaginsee if it has the specified relationship to the real user.
309919d2e3deSDmitry ChaginIf
310019d2e3deSDmitry Chagin.Va file
310119d2e3deSDmitry Chagindoes not exist or is inaccessible or, for the operators indicated by
310219d2e3deSDmitry Chagin.Sq * ,
310319d2e3deSDmitry Chaginif the specified file type does not exist on the current system,
310419d2e3deSDmitry Chaginthen all inquiries return false, i.e.,
310519d2e3deSDmitry Chagin.Sq 0 .
310619d2e3deSDmitry Chagin.Pp
310719d2e3deSDmitry ChaginThese operators may be combined for conciseness:
310819d2e3deSDmitry Chagin.Sq \&-
310919d2e3deSDmitry Chagin.Va xy file
311019d2e3deSDmitry Chaginis
311119d2e3deSDmitry Chaginequivalent to
311219d2e3deSDmitry Chagin.Sq \&-x file && \&-y file .
311319d2e3deSDmitry Chagin(+) For example,
311419d2e3deSDmitry Chagin.Sq \&-fx
311519d2e3deSDmitry Chaginis true
311619d2e3deSDmitry Chagin(returns
311719d2e3deSDmitry Chagin.Sq 1 )
311819d2e3deSDmitry Chaginfor plain executable files, but not for directories.
311919d2e3deSDmitry Chagin.Pp
312019d2e3deSDmitry Chagin.Va L
312119d2e3deSDmitry Chaginmay be used in a multiple-operator test to apply subsequent operators
312219d2e3deSDmitry Chaginto a symbolic link rather than to the file to which the link points.
312319d2e3deSDmitry ChaginFor example,
312419d2e3deSDmitry Chagin.Sq \&-lLo
312519d2e3deSDmitry Chaginis true for links owned by the invoking user.
312619d2e3deSDmitry Chagin.Va Lr ,
312719d2e3deSDmitry Chagin.Va Lw
312819d2e3deSDmitry Chaginand
312919d2e3deSDmitry Chagin.Va Lx
313019d2e3deSDmitry Chaginare always true for links and false for
313119d2e3deSDmitry Chaginnon-links.
313219d2e3deSDmitry Chagin.Va L
313319d2e3deSDmitry Chaginhas a different meaning when it is the last operator
313419d2e3deSDmitry Chaginin a multiple-operator test; see below.
313519d2e3deSDmitry Chagin.Pp
313619d2e3deSDmitry ChaginIt is possible but not useful, and sometimes misleading, to combine operators
313719d2e3deSDmitry Chaginwhich expect
313819d2e3deSDmitry Chagin.Va file
313919d2e3deSDmitry Chaginto be a file with operators which do not
314019d2e3deSDmitry Chagin(e.g.,
314119d2e3deSDmitry Chagin.Va X
314219d2e3deSDmitry Chaginand
314319d2e3deSDmitry Chagin.Va t ) .
314419d2e3deSDmitry ChaginFollowing
314519d2e3deSDmitry Chagin.Va L
314619d2e3deSDmitry Chaginwith a non-file operator
314719d2e3deSDmitry Chagincan lead to particularly strange results.
314819d2e3deSDmitry Chagin.Pp
314919d2e3deSDmitry ChaginOther operators return other information, i.e., not just
315019d2e3deSDmitry Chagin.Sq 0
315119d2e3deSDmitry Chaginor
315219d2e3deSDmitry Chagin.Sq 1
315319d2e3deSDmitry Chagin(+)
315419d2e3deSDmitry ChaginThey have the same format as before;
315519d2e3deSDmitry Chagin.Va op
315619d2e3deSDmitry Chaginmay be one of
315719d2e3deSDmitry Chagin.Pp
3158d803a9d0SBrooks Davis.Bl -tag -width XXX -offset indent -compact
3159d803a9d0SBrooks Davis.It Ar A
316019d2e3deSDmitry ChaginLast file access time, as the number of seconds since the epoch
3161d803a9d0SBrooks Davis.It Ar A:
316219d2e3deSDmitry ChaginLike
3163d803a9d0SBrooks Davis.Va Ar A
316419d2e3deSDmitry Chagin, but in timestamp format, e.g.,
316519d2e3deSDmitry Chagin.Sq Fri May 14 16:36:10 1993
3166d803a9d0SBrooks Davis.It Ar M
316719d2e3deSDmitry ChaginLast file modification time
3168d803a9d0SBrooks Davis.It Ar M:
316919d2e3deSDmitry ChaginLike
317019d2e3deSDmitry Chagin.Va M
317119d2e3deSDmitry Chagin, but in timestamp format
3172d803a9d0SBrooks Davis.It Ar C
317319d2e3deSDmitry ChaginLast inode modification time
3174d803a9d0SBrooks Davis.It Ar C:
317519d2e3deSDmitry ChaginLike
317619d2e3deSDmitry Chagin.Va C
317719d2e3deSDmitry Chagin, but in timestamp format
3178d803a9d0SBrooks Davis.It Ar D
317919d2e3deSDmitry ChaginDevice number
3180d803a9d0SBrooks Davis.It Ar I
318119d2e3deSDmitry ChaginInode number
3182d803a9d0SBrooks Davis.It Ar F
318319d2e3deSDmitry ChaginComposite
318419d2e3deSDmitry Chagin.Va f
318519d2e3deSDmitry Chaginile identifier, in the form
3186d803a9d0SBrooks Davis.Va device :
318719d2e3deSDmitry Chagin.Va inode
3188d803a9d0SBrooks Davis.It Ar L
318919d2e3deSDmitry ChaginThe name of the file pointed to by a symbolic link
3190d803a9d0SBrooks Davis.It Ar N
319119d2e3deSDmitry ChaginNumber of (hard) links
3192d803a9d0SBrooks Davis.It Ar P
319319d2e3deSDmitry ChaginPermissions, in octal, without leading zero
3194d803a9d0SBrooks Davis.It Ar P:
319519d2e3deSDmitry ChaginLike
319619d2e3deSDmitry Chagin.Va P
319719d2e3deSDmitry Chagin, with leading zero
3198d803a9d0SBrooks Davis.It Ar P<mode>
319919d2e3deSDmitry ChaginEquivalent to
320019d2e3deSDmitry Chagin.Sq \-P
320119d2e3deSDmitry Chagin.Va file
320219d2e3deSDmitry Chagin&
320319d2e3deSDmitry Chagin.Va mode
320419d2e3deSDmitry Chagin, e.g.,
320519d2e3deSDmitry Chagin.Sq \-P22
320619d2e3deSDmitry Chagin.Va file
320719d2e3deSDmitry Chaginreturns
320819d2e3deSDmitry Chagin`22' if
320919d2e3deSDmitry Chagin.Va file
321019d2e3deSDmitry Chaginis writable by group and other,
321119d2e3deSDmitry Chagin.Sq 20
321219d2e3deSDmitry Chaginif by group only,
321319d2e3deSDmitry Chaginand
321419d2e3deSDmitry Chagin.Sq 0
321519d2e3deSDmitry Chaginif by neither
3216d803a9d0SBrooks Davis.It Ar P<mode>:
3217d803a9d0SBrooks DavisLike
3218d803a9d0SBrooks Davis.Ar BP
321919d2e3deSDmitry Chagin.Va mode
322019d2e3deSDmitry Chagin, with leading zero
3221d803a9d0SBrooks Davis.It Ar U
322219d2e3deSDmitry ChaginNumeric userid
3223d803a9d0SBrooks Davis.It Ar U:
322419d2e3deSDmitry ChaginUsername, or the numeric userid if the username is unknown
3225d803a9d0SBrooks Davis.It Ar G
322619d2e3deSDmitry ChaginNumeric groupid
3227d803a9d0SBrooks Davis.It Ar G:
322819d2e3deSDmitry ChaginGroupname, or the numeric groupid if the groupname is unknown
3229d803a9d0SBrooks Davis.It Ar Z
323019d2e3deSDmitry ChaginSize, in bytes
3231d803a9d0SBrooks Davis.El
323219d2e3deSDmitry Chagin.Pp
323319d2e3deSDmitry ChaginOnly one of these operators may appear in a multiple-operator test, and it
323419d2e3deSDmitry Chaginmust be the last.
323519d2e3deSDmitry ChaginNote that
323619d2e3deSDmitry Chagin.Va L
323719d2e3deSDmitry Chaginhas a different meaning at the end of and
323819d2e3deSDmitry Chaginelsewhere in a multiple-operator test.
323919d2e3deSDmitry ChaginBecause
324019d2e3deSDmitry Chagin.Sq 0
324119d2e3deSDmitry Chaginis a valid return value
324219d2e3deSDmitry Chaginfor many of these operators, they do not return
324319d2e3deSDmitry Chagin.Sq 0
324419d2e3deSDmitry Chaginwhen they fail: most
324519d2e3deSDmitry Chaginreturn
324619d2e3deSDmitry Chagin.Sq \&-1
324719d2e3deSDmitry Chagin, and
324819d2e3deSDmitry Chagin.Va F
324919d2e3deSDmitry Chaginreturns
325019d2e3deSDmitry Chagin.Sq \&:
325119d2e3deSDmitry Chagin.Pp
325219d2e3deSDmitry ChaginIf the shell is compiled with POSIX defined (see the
325319d2e3deSDmitry Chagin.Va version
325419d2e3deSDmitry Chaginshell
325519d2e3deSDmitry Chaginvariable), the result of a file inquiry is based on the permission bits of
325619d2e3deSDmitry Chaginthe file and not on the result of the
325719d2e3deSDmitry Chagin.Va access
325819d2e3deSDmitry Chagin(2) system call.
325919d2e3deSDmitry ChaginFor example, if one tests a file with
326019d2e3deSDmitry Chagin.Fl w\fR whose permissions would
326119d2e3deSDmitry Chaginordinarily allow writing but which is on a file system mounted read-only,
326219d2e3deSDmitry Chaginthe test will succeed in a POSIX shell but fail in a non-POSIX shell.
326319d2e3deSDmitry Chagin.Pp
326419d2e3deSDmitry ChaginFile inquiry operators can also be evaluated with the
326519d2e3deSDmitry Chagin.Va filetest
326619d2e3deSDmitry Chaginbuiltin
326719d2e3deSDmitry Chagincommand (q.v.) (+).
326819d2e3deSDmitry Chagin.Ss Jobs
326919d2e3deSDmitry ChaginThe shell associates a
327019d2e3deSDmitry Chagin.Va job
327119d2e3deSDmitry Chaginwith each pipeline.
327219d2e3deSDmitry ChaginIt keeps a table of
327319d2e3deSDmitry Chagincurrent jobs, printed by the
327419d2e3deSDmitry Chagin.Va jobs
327519d2e3deSDmitry Chagincommand, and assigns them small integer
327619d2e3deSDmitry Chaginnumbers.
327719d2e3deSDmitry ChaginWhen a job is started asynchronously with
327819d2e3deSDmitry Chagin.Sq &
327919d2e3deSDmitry Chagin, the shell prints a
328019d2e3deSDmitry Chaginline which looks like
328119d2e3deSDmitry Chagin.IP "" 4
328219d2e3deSDmitry Chagin[1] 1234
328319d2e3deSDmitry Chagin.Pp
328419d2e3deSDmitry Chaginindicating that the job which was started asynchronously was job number 1 and
328519d2e3deSDmitry Chaginhad one (top-level) process, whose process id was 1234.
328619d2e3deSDmitry Chagin.Pp
328719d2e3deSDmitry ChaginIf you are running a job and wish to do something else you may hit the suspend
328819d2e3deSDmitry Chaginkey (usually
328919d2e3deSDmitry Chagin.Sq ^Z ) ,
329019d2e3deSDmitry Chaginwhich sends a STOP signal to the current job.
329119d2e3deSDmitry ChaginThe shell will then normally
329219d2e3deSDmitry Chaginindicate that the job has been
329319d2e3deSDmitry Chagin.Sq Suspended
329419d2e3deSDmitry Chaginand print another prompt.
329519d2e3deSDmitry ChaginIf the
329619d2e3deSDmitry Chagin.Va listjobs
329719d2e3deSDmitry Chaginshell variable is set, all jobs will be listed
329819d2e3deSDmitry Chaginlike the
329919d2e3deSDmitry Chagin.Va jobs
330019d2e3deSDmitry Chaginbuiltin command; if it is set to
330119d2e3deSDmitry Chagin.Sq long
330219d2e3deSDmitry Chaginthe listing will
330319d2e3deSDmitry Chaginbe in long format, like
330419d2e3deSDmitry Chagin.Sq jobs \&-l
330519d2e3deSDmitry ChaginYou can then manipulate the state of the suspended job.
330619d2e3deSDmitry ChaginYou can put it in the
330719d2e3deSDmitry Chagin.Dq background
330819d2e3deSDmitry Chagin with the
330919d2e3deSDmitry Chagin.Va bg
331019d2e3deSDmitry Chagincommand or run some other commands and
331119d2e3deSDmitry Chagineventually bring the job back into the
331219d2e3deSDmitry Chagin.Sq foreground
331319d2e3deSDmitry Chagin' with
331419d2e3deSDmitry Chagin.Va fg
331519d2e3deSDmitry Chagin(See also the
331619d2e3deSDmitry Chagin.Va run-fg-editor
331719d2e3deSDmitry Chagineditor command.)
331819d2e3deSDmitry ChaginA
331919d2e3deSDmitry Chagin.Sq ^Z
332019d2e3deSDmitry Chagintakes effect immediately and is like an interrupt
332119d2e3deSDmitry Chaginin that pending output and unread input are discarded when it is typed.
332219d2e3deSDmitry ChaginThe
332319d2e3deSDmitry Chagin.Va wait
332419d2e3deSDmitry Chaginbuiltin command causes the shell to wait for all background
332519d2e3deSDmitry Chaginjobs to complete.
332619d2e3deSDmitry Chagin.Pp
332719d2e3deSDmitry ChaginThe
332819d2e3deSDmitry Chagin.Sq ^]
332919d2e3deSDmitry Chaginkey sends a delayed suspend signal, which does not generate a STOP
333019d2e3deSDmitry Chaginsignal until a program attempts to
333119d2e3deSDmitry Chagin.Va read
333219d2e3deSDmitry Chagin(2) it, to the current job.
333319d2e3deSDmitry ChaginThis can usefully be typed ahead when you have prepared some commands for a
333419d2e3deSDmitry Chaginjob which you wish to stop after it has read them.
333519d2e3deSDmitry ChaginThe
333619d2e3deSDmitry Chagin.Sq ^Y
333719d2e3deSDmitry Chaginkey performs this function in
333819d2e3deSDmitry Chagin.Xr csh 1
333919d2e3deSDmitry Chagin; in
334019d2e3deSDmitry Chagin.Nm
334119d2e3deSDmitry Chagin,
334219d2e3deSDmitry Chagin`^Y' is an editing command.
334319d2e3deSDmitry Chagin(+)
334419d2e3deSDmitry Chagin.Pp
334519d2e3deSDmitry ChaginA job being run in the background stops if it tries to read from the
334619d2e3deSDmitry Chaginterminal.
334719d2e3deSDmitry ChaginBackground jobs are normally allowed to produce output, but this can
334819d2e3deSDmitry Chaginbe disabled by giving the command
334919d2e3deSDmitry Chagin.Sq stty tostop
335019d2e3deSDmitry ChaginIf you set this tty option,
335119d2e3deSDmitry Chaginthen background jobs will stop when they try to produce output like they do
335219d2e3deSDmitry Chaginwhen they try to read input.
335319d2e3deSDmitry Chagin.Pp
335419d2e3deSDmitry ChaginThere are several ways to refer to jobs in the shell.
335519d2e3deSDmitry ChaginThe character
335619d2e3deSDmitry Chagin.Sq %
335719d2e3deSDmitry Chaginintroduces a job name.
335819d2e3deSDmitry ChaginIf you wish to refer to job number 1, you can name it
335919d2e3deSDmitry Chaginas
336019d2e3deSDmitry Chagin.Sq %1
336119d2e3deSDmitry ChaginJust naming a job brings it to the foreground; thus
336219d2e3deSDmitry Chagin.Sq %1
336319d2e3deSDmitry Chaginis a synonym
336419d2e3deSDmitry Chaginfor
336519d2e3deSDmitry Chagin.Sq fg %1
336619d2e3deSDmitry Chagin, bringing job 1 back into the foreground.
336719d2e3deSDmitry ChaginSimilarly, saying
336819d2e3deSDmitry Chagin.Sq %1 &
336919d2e3deSDmitry Chaginresumes job 1 in the background, just like
337019d2e3deSDmitry Chagin.Sq bg %1
337119d2e3deSDmitry ChaginA job can also be named
337219d2e3deSDmitry Chaginby an unambiguous prefix of the string typed in to start it:
337319d2e3deSDmitry Chagin.Sq %ex
337419d2e3deSDmitry Chaginwould
337519d2e3deSDmitry Chaginnormally restart a suspended
3376*5224c2a3SDmitry Chagin.Xr ex 1
3377*5224c2a3SDmitry Chaginjob, if there were only one suspended
337819d2e3deSDmitry Chaginjob whose name began with the string
3379*5224c2a3SDmitry Chagin.Sq ex .
338019d2e3deSDmitry ChaginIt is also possible to say
3381*5224c2a3SDmitry Chagin.Va %?string
3382*5224c2a3SDmitry Chaginto specify a job whose text contains
3383*5224c2a3SDmitry Chagin.Va string ,
3384*5224c2a3SDmitry Chaginif there is only one such job.
338519d2e3deSDmitry Chagin.Pp
338619d2e3deSDmitry ChaginThe shell maintains a notion of the current and previous jobs.
338719d2e3deSDmitry ChaginIn output
338819d2e3deSDmitry Chaginpertaining to jobs, the current job is marked with a
338919d2e3deSDmitry Chagin.Sq +
339019d2e3deSDmitry Chaginand the previous job
339119d2e3deSDmitry Chaginwith a
339219d2e3deSDmitry Chagin.Sq \-
339319d2e3deSDmitry ChaginThe abbreviations
339419d2e3deSDmitry Chagin.Sq %+
339519d2e3deSDmitry Chagin,
339619d2e3deSDmitry Chagin.Sq %
339719d2e3deSDmitry Chagin, and (by analogy with the syntax of
339819d2e3deSDmitry Chaginthe
339919d2e3deSDmitry Chagin.Va history
340019d2e3deSDmitry Chaginmechanism)
340119d2e3deSDmitry Chagin.Sq %%
340219d2e3deSDmitry Chaginall refer to the current job, and
340319d2e3deSDmitry Chagin.Sq %\-
340419d2e3deSDmitry Chaginrefers
340519d2e3deSDmitry Chaginto the previous job.
340619d2e3deSDmitry Chagin.Pp
340719d2e3deSDmitry ChaginThe job control mechanism requires that the
340819d2e3deSDmitry Chagin.Va stty
340919d2e3deSDmitry Chagin(1) option
341019d2e3deSDmitry Chagin.Sq new
341119d2e3deSDmitry Chaginbe set
341219d2e3deSDmitry Chaginon some systems.
341319d2e3deSDmitry ChaginIt is an artifact from a
341419d2e3deSDmitry Chagin.Sq new
341519d2e3deSDmitry Chaginimplementation of the tty
341619d2e3deSDmitry Chagindriver which allows generation of interrupt characters from the keyboard to
341719d2e3deSDmitry Chagintell jobs to stop.
341819d2e3deSDmitry ChaginSee
341919d2e3deSDmitry Chagin.Va stty
342019d2e3deSDmitry Chagin(1) and the
342119d2e3deSDmitry Chagin.Va setty
342219d2e3deSDmitry Chaginbuiltin command for
342319d2e3deSDmitry Chagindetails on setting options in the new tty driver.
342419d2e3deSDmitry Chagin.Ss "Status reporting"
342519d2e3deSDmitry ChaginThe shell learns immediately whenever a process changes state.
342619d2e3deSDmitry ChaginIt normally
342719d2e3deSDmitry Chagininforms you whenever a job becomes blocked so that no further progress is
342819d2e3deSDmitry Chaginpossible, but only right before it prints a prompt.
342919d2e3deSDmitry ChaginThis is done so that it
343019d2e3deSDmitry Chagindoes not otherwise disturb your work.
343119d2e3deSDmitry ChaginIf, however, you set the shell variable
343219d2e3deSDmitry Chagin.Va notify
343319d2e3deSDmitry Chagin, the shell will notify you immediately of changes of status in
343419d2e3deSDmitry Chaginbackground jobs.
343519d2e3deSDmitry ChaginThere is also a shell command
343619d2e3deSDmitry Chagin.Va notify
343719d2e3deSDmitry Chaginwhich marks a
343819d2e3deSDmitry Chaginsingle process so that its status changes will be immediately reported.
343919d2e3deSDmitry ChaginBy
344019d2e3deSDmitry Chagindefault
344119d2e3deSDmitry Chagin.Va notify
344219d2e3deSDmitry Chaginmarks the current process; simply say
344319d2e3deSDmitry Chagin.Sq notify
344419d2e3deSDmitry Chaginafter
344519d2e3deSDmitry Chaginstarting a background job to mark it.
344619d2e3deSDmitry Chagin.Pp
344719d2e3deSDmitry ChaginWhen you try to leave the shell while jobs are stopped, you will be
344819d2e3deSDmitry Chaginwarned that
344919d2e3deSDmitry Chagin.Sq There are suspended jobs.
345019d2e3deSDmitry ChaginYou may use the
345119d2e3deSDmitry Chagin.Va jobs
345219d2e3deSDmitry Chagincommand to
345319d2e3deSDmitry Chaginsee what they are.
345419d2e3deSDmitry ChaginIf you do this or immediately try to exit again, the shell
345519d2e3deSDmitry Chaginwill not warn you a second time, and the suspended jobs will be terminated.
345619d2e3deSDmitry Chagin.Ss "Automatic, periodic and timed events (+)"
345719d2e3deSDmitry ChaginThere are various ways to run commands and take other actions automatically
345819d2e3deSDmitry Chaginat various times in the
345919d2e3deSDmitry Chagin.Sq `life cycle
346019d2e3deSDmitry Chagin' of the shell.
346119d2e3deSDmitry ChaginThey are summarized here,
346219d2e3deSDmitry Chaginand described in detail under the appropriate
346319d2e3deSDmitry Chagin.Va Builtin commands
346419d2e3deSDmitry Chagin,
346519d2e3deSDmitry Chagin.Va Special shell variables
346619d2e3deSDmitry Chaginand
346719d2e3deSDmitry Chagin.Va Special aliases
346819d2e3deSDmitry Chagin.Pp
346919d2e3deSDmitry ChaginThe
347019d2e3deSDmitry Chagin.Va sched
347119d2e3deSDmitry Chaginbuiltin command puts commands in a scheduled-event list,
347219d2e3deSDmitry Chaginto be executed by the shell at a given time.
347319d2e3deSDmitry Chagin.Pp
347419d2e3deSDmitry ChaginThe
347519d2e3deSDmitry Chagin.Va beepcmd
347619d2e3deSDmitry Chagin,
347719d2e3deSDmitry Chagin.Va cwdcmd
347819d2e3deSDmitry Chagin,
347919d2e3deSDmitry Chagin.Va periodic
348019d2e3deSDmitry Chagin,
348119d2e3deSDmitry Chagin.Va precmd
348219d2e3deSDmitry Chagin,
348319d2e3deSDmitry Chagin.Va postcmd
348419d2e3deSDmitry Chagin,
348519d2e3deSDmitry Chaginand
348619d2e3deSDmitry Chagin.Va jobcmd
348719d2e3deSDmitry Chagin.Va Special aliases
348819d2e3deSDmitry Chagincan be set, respectively, to execute commands when the shell wants
348919d2e3deSDmitry Chaginto ring the bell, when the working directory changes, every
349019d2e3deSDmitry Chagin.Va tperiod
349119d2e3deSDmitry Chaginminutes, before each prompt, before each command gets executed, after each
349219d2e3deSDmitry Chagincommand gets executed, and when a job is started or is brought into the
349319d2e3deSDmitry Chaginforeground.
349419d2e3deSDmitry Chagin.Pp
349519d2e3deSDmitry ChaginThe
349619d2e3deSDmitry Chagin.Va autologout
349719d2e3deSDmitry Chaginshell variable can be set to log out or lock the shell
349819d2e3deSDmitry Chaginafter a given number of minutes of inactivity.
349919d2e3deSDmitry Chagin.Pp
350019d2e3deSDmitry ChaginThe
350119d2e3deSDmitry Chagin.Va mail
350219d2e3deSDmitry Chaginshell variable can be set to check for new mail periodically.
350319d2e3deSDmitry Chagin.Pp
350419d2e3deSDmitry ChaginThe
350519d2e3deSDmitry Chagin.Va printexitvalue
350619d2e3deSDmitry Chaginshell variable can be set to print the exit status
350719d2e3deSDmitry Chaginof commands which exit with a status other than zero.
350819d2e3deSDmitry Chagin.Pp
350919d2e3deSDmitry ChaginThe
351019d2e3deSDmitry Chagin.Va rmstar
351119d2e3deSDmitry Chaginshell variable can be set to ask the user, when
351219d2e3deSDmitry Chagin.Sq rm *
351319d2e3deSDmitry Chaginis
351419d2e3deSDmitry Chagintyped, if that is really what was meant.
351519d2e3deSDmitry Chagin.Pp
351619d2e3deSDmitry ChaginThe
351719d2e3deSDmitry Chagin.Va time
351819d2e3deSDmitry Chaginshell variable can be set to execute the
351919d2e3deSDmitry Chagin.Va time
352019d2e3deSDmitry Chaginbuiltin
352119d2e3deSDmitry Chagincommand after the completion of any process that takes more than a given
352219d2e3deSDmitry Chaginnumber of CPU seconds.
352319d2e3deSDmitry Chagin.Pp
352419d2e3deSDmitry ChaginThe
352519d2e3deSDmitry Chagin.Va watch
352619d2e3deSDmitry Chaginand
352719d2e3deSDmitry Chagin.Va who
352819d2e3deSDmitry Chaginshell variables can be set to report when
352919d2e3deSDmitry Chaginselected users log in or out, and the
353019d2e3deSDmitry Chagin.Va log
353119d2e3deSDmitry Chaginbuiltin command reports
353219d2e3deSDmitry Chaginon those users at any time.
353319d2e3deSDmitry Chagin.Ss "Native Language System support (+)"
353419d2e3deSDmitry ChaginThe shell is eight bit clean
353519d2e3deSDmitry Chagin(if so compiled; see the
353619d2e3deSDmitry Chagin.Va version
353719d2e3deSDmitry Chaginshell variable)
353819d2e3deSDmitry Chaginand thus supports character sets needing this capability.
353919d2e3deSDmitry ChaginNLS support differs depending on whether or not
354019d2e3deSDmitry Chaginthe shell was compiled to use the system's NLS (again, see
354119d2e3deSDmitry Chagin.Va version
354219d2e3deSDmitry Chagin).
354319d2e3deSDmitry ChaginIn either case, 7-bit ASCII is the default character code
354419d2e3deSDmitry Chagin(e.g., the classification of which characters are printable) and sorting,
354519d2e3deSDmitry Chaginand changing the
354619d2e3deSDmitry Chagin.Va LANG
354719d2e3deSDmitry Chaginor
354819d2e3deSDmitry Chagin.Va LC_CTYPE
354919d2e3deSDmitry Chaginenvironment variables
355019d2e3deSDmitry Chagincauses a check for possible changes in these respects.
355119d2e3deSDmitry Chagin.Pp
355219d2e3deSDmitry ChaginWhen using the system's NLS, the
355319d2e3deSDmitry Chagin.Va setlocale
355419d2e3deSDmitry Chagin(3) function is called
355519d2e3deSDmitry Chaginto determine appropriate character code/classification and sorting
355619d2e3deSDmitry Chagin(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
355719d2e3deSDmitry ChaginThis function typically examines the
355819d2e3deSDmitry Chagin.Va LANG
355919d2e3deSDmitry Chaginand
356019d2e3deSDmitry Chagin.Va LC_CTYPE
356119d2e3deSDmitry Chaginenvironment variables; refer to the system documentation for further details.
356219d2e3deSDmitry ChaginWhen not using the system's NLS, the shell simulates it by assuming that the
356319d2e3deSDmitry ChaginISO 8859-1 character set is used
356419d2e3deSDmitry Chaginwhenever either of the
356519d2e3deSDmitry Chagin.Va LANG
356619d2e3deSDmitry Chaginand
356719d2e3deSDmitry Chagin.Va LC_CTYPE
356819d2e3deSDmitry Chaginvariables are set, regardless of
356919d2e3deSDmitry Chagintheir values.
357019d2e3deSDmitry ChaginSorting is not affected for the simulated NLS.
357119d2e3deSDmitry Chagin.Pp
357219d2e3deSDmitry ChaginIn addition, with both real and simulated NLS, all printable
357319d2e3deSDmitry Chagincharacters in the range \e200\-\e377, i.e., those that have
357419d2e3deSDmitry ChaginM-
357519d2e3deSDmitry Chagin.Va char
357619d2e3deSDmitry Chaginbindings, are automatically rebound to
357719d2e3deSDmitry Chagin.Va self-insert-command
357819d2e3deSDmitry ChaginThe corresponding binding for the escape-
357919d2e3deSDmitry Chagin.Va char
358019d2e3deSDmitry Chaginsequence, if any, is
358119d2e3deSDmitry Chaginleft alone.
358219d2e3deSDmitry ChaginThese characters are not rebound if the
358319d2e3deSDmitry Chagin.Va NOREBIND
358419d2e3deSDmitry Chaginenvironment variable
358519d2e3deSDmitry Chaginis set.
358619d2e3deSDmitry ChaginThis may be useful for the simulated NLS or a primitive real NLS
358719d2e3deSDmitry Chaginwhich assumes full ISO 8859-1.
358819d2e3deSDmitry ChaginOtherwise, all M-
358919d2e3deSDmitry Chagin.Va char
359019d2e3deSDmitry Chaginbindings in the
359119d2e3deSDmitry Chaginrange \e240\-\e377 are effectively undone.
359219d2e3deSDmitry ChaginExplicitly rebinding the relevant keys with
359319d2e3deSDmitry Chagin.Va bindkey
359419d2e3deSDmitry Chaginis of course still possible.
359519d2e3deSDmitry Chagin.Pp
359619d2e3deSDmitry ChaginUnknown characters (i.e., those that are neither printable nor control
359719d2e3deSDmitry Chagincharacters) are printed in the format \ennn.
359819d2e3deSDmitry ChaginIf the tty is not in 8 bit mode, other 8 bit characters are printed by
359919d2e3deSDmitry Chaginconverting them to ASCII and using standout mode.
360019d2e3deSDmitry ChaginThe shell
360119d2e3deSDmitry Chaginnever changes the 7/8 bit mode of the tty and tracks user-initiated
360219d2e3deSDmitry Chaginchanges of 7/8 bit mode.
360319d2e3deSDmitry ChaginNLS users (or, for that matter, those who want to
360419d2e3deSDmitry Chaginuse a meta key) may need to explicitly set
360519d2e3deSDmitry Chaginthe tty in 8 bit mode through the appropriate
360619d2e3deSDmitry Chagin.Va stty
360719d2e3deSDmitry Chagin(1)
360819d2e3deSDmitry Chagincommand in, e.g., the
360919d2e3deSDmitry Chagin.Va ~/.login
361019d2e3deSDmitry Chaginfile.
361119d2e3deSDmitry Chagin.Ss "OS variant support (+)"
361219d2e3deSDmitry ChaginA number of new builtin commands are provided to support features in
361319d2e3deSDmitry Chaginparticular operating systems.
361419d2e3deSDmitry ChaginAll are described in detail in the
361519d2e3deSDmitry Chagin.Va Builtin commands
361619d2e3deSDmitry Chaginsection.
361719d2e3deSDmitry Chagin.Pp
361819d2e3deSDmitry ChaginOn systems that support TCF (aix-ibm370, aix-ps2),
361919d2e3deSDmitry Chagin.Va getspath
362019d2e3deSDmitry Chaginand
362119d2e3deSDmitry Chagin.Va setspath
362219d2e3deSDmitry Chaginget and set the system execution path,
362319d2e3deSDmitry Chagin.Va getxvers
362419d2e3deSDmitry Chaginand
362519d2e3deSDmitry Chagin.Va setxvers
362619d2e3deSDmitry Chaginget and set the experimental version prefix
362719d2e3deSDmitry Chaginand
362819d2e3deSDmitry Chagin.Va migrate
362919d2e3deSDmitry Chaginmigrates processes between sites.
363019d2e3deSDmitry ChaginThe
363119d2e3deSDmitry Chagin.Va jobs
363219d2e3deSDmitry Chaginbuiltin
363319d2e3deSDmitry Chaginprints the site on which each job is executing.
363419d2e3deSDmitry Chagin.Pp
363519d2e3deSDmitry ChaginUnder BS2000,
363619d2e3deSDmitry Chagin.Va bs2cmd
363719d2e3deSDmitry Chaginexecutes commands of the underlying BS2000/OSD
363819d2e3deSDmitry Chaginoperating system.
363919d2e3deSDmitry Chagin.Pp
364019d2e3deSDmitry ChaginUnder Domain/OS,
364119d2e3deSDmitry Chagin.Va inlib
364219d2e3deSDmitry Chaginadds shared libraries to the current environment,
364319d2e3deSDmitry Chagin.Va rootnode
364419d2e3deSDmitry Chaginchanges the rootnode and
364519d2e3deSDmitry Chagin.Va ver
364619d2e3deSDmitry Chaginchanges the systype.
364719d2e3deSDmitry Chagin.Pp
364819d2e3deSDmitry ChaginUnder Mach,
364919d2e3deSDmitry Chagin.Va setpath
365019d2e3deSDmitry Chaginis equivalent to Mach's
365119d2e3deSDmitry Chagin.Va setpath
365219d2e3deSDmitry Chagin(1).
365319d2e3deSDmitry Chagin.Pp
365419d2e3deSDmitry ChaginUnder Masscomp/RTU and Harris CX/UX,
365519d2e3deSDmitry Chagin.Va universe
365619d2e3deSDmitry Chaginsets the universe.
365719d2e3deSDmitry Chagin.Pp
365819d2e3deSDmitry ChaginUnder Harris CX/UX,
365919d2e3deSDmitry Chagin.Va ucb
366019d2e3deSDmitry Chaginor
366119d2e3deSDmitry Chagin.Va att
366219d2e3deSDmitry Chaginruns a command under the specified
366319d2e3deSDmitry Chaginuniverse.
366419d2e3deSDmitry Chagin.Pp
366519d2e3deSDmitry ChaginUnder Convex/OS,
366619d2e3deSDmitry Chagin.Va warp
366719d2e3deSDmitry Chaginprints or sets the universe.
366819d2e3deSDmitry Chagin.Pp
366919d2e3deSDmitry ChaginThe
367019d2e3deSDmitry Chagin.Va VENDOR
367119d2e3deSDmitry Chagin,
367219d2e3deSDmitry Chagin.Va OSTYPE
367319d2e3deSDmitry Chaginand
367419d2e3deSDmitry Chagin.Va MACHTYPE
367519d2e3deSDmitry Chaginenvironment variables
367619d2e3deSDmitry Chaginindicate respectively the vendor, operating system and machine type
367719d2e3deSDmitry Chagin(microprocessor class or machine model) of the
367819d2e3deSDmitry Chaginsystem on which the shell thinks it is running.
367919d2e3deSDmitry ChaginThese are particularly useful when sharing one's home directory between several
368019d2e3deSDmitry Chagintypes of machines; one can, for example,
368119d2e3deSDmitry Chagin.IP "" 4
368219d2e3deSDmitry Chaginset path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
368319d2e3deSDmitry Chagin.Pp
368419d2e3deSDmitry Chaginin one's
368519d2e3deSDmitry Chagin.Va ~/.login
368619d2e3deSDmitry Chaginand put executables compiled for each machine in the
368719d2e3deSDmitry Chaginappropriate directory.
368819d2e3deSDmitry Chagin.Pp
368919d2e3deSDmitry ChaginThe
369019d2e3deSDmitry Chagin.Va version
369119d2e3deSDmitry Chaginshell
369219d2e3deSDmitry Chaginvariable indicates what options were chosen when the shell was compiled.
369319d2e3deSDmitry Chagin.Pp
369419d2e3deSDmitry ChaginNote also the
369519d2e3deSDmitry Chagin.Va newgrp
369619d2e3deSDmitry Chaginbuiltin, the
369719d2e3deSDmitry Chagin.Va afsuser
369819d2e3deSDmitry Chaginand
369919d2e3deSDmitry Chagin.Va echo_style
370019d2e3deSDmitry Chaginshell variables and the system-dependent locations of
370119d2e3deSDmitry Chaginthe shell's input files (see
370219d2e3deSDmitry Chagin.Va FILES
370319d2e3deSDmitry Chagin).
370419d2e3deSDmitry Chagin.Ss "Signal handling"
370519d2e3deSDmitry ChaginLogin shells ignore interrupts when reading the file
370619d2e3deSDmitry Chagin.Va ~/.logout
370719d2e3deSDmitry ChaginThe shell ignores quit signals unless started with
370819d2e3deSDmitry Chagin.Fl q\fR.
370919d2e3deSDmitry ChaginLogin shells catch the terminate signal, but non-login shells inherit the
371019d2e3deSDmitry Chaginterminate behavior from their parents.
371119d2e3deSDmitry ChaginOther signals have the values which the shell inherited from its parent.
371219d2e3deSDmitry Chagin.Pp
371319d2e3deSDmitry ChaginIn shell scripts, the shell's handling of interrupt and terminate signals
371419d2e3deSDmitry Chagincan be controlled with
371519d2e3deSDmitry Chagin.Va onintr
371619d2e3deSDmitry Chagin, and its handling of hangups can be
371719d2e3deSDmitry Chagincontrolled with
371819d2e3deSDmitry Chagin.Va hup
371919d2e3deSDmitry Chaginand
372019d2e3deSDmitry Chagin.Va nohup
372119d2e3deSDmitry Chagin.Pp
372219d2e3deSDmitry ChaginThe shell exits on a hangup (see also the
372319d2e3deSDmitry Chagin.Va logout
372419d2e3deSDmitry Chaginshell variable).
372519d2e3deSDmitry ChaginBy
372619d2e3deSDmitry Chagindefault, the shell's children do too, but the shell does not send them a
372719d2e3deSDmitry Chaginhangup when it exits.
372819d2e3deSDmitry Chagin.Va hup
372919d2e3deSDmitry Chaginarranges for the shell to send a hangup to
373019d2e3deSDmitry Chagina child when it exits, and
373119d2e3deSDmitry Chagin.Va nohup
373219d2e3deSDmitry Chaginsets a child to ignore hangups.
373319d2e3deSDmitry Chagin.Ss "Terminal management (+)"
373419d2e3deSDmitry ChaginThe shell uses three different sets of terminal (
373519d2e3deSDmitry Chagin.Dq tty
373619d2e3deSDmitry Chagin) modes:
373719d2e3deSDmitry Chagin`edit', used when editing,
373819d2e3deSDmitry Chagin.Sq quote
373919d2e3deSDmitry Chagin, used when quoting literal characters,
374019d2e3deSDmitry Chaginand
374119d2e3deSDmitry Chagin.Sq execute
374219d2e3deSDmitry Chagin, used when executing commands.
374319d2e3deSDmitry ChaginThe shell holds some settings in each mode constant, so commands which leave
374419d2e3deSDmitry Chaginthe tty in a confused state do not interfere with the shell.
374519d2e3deSDmitry ChaginThe shell also matches changes in the speed and padding of the tty.
374619d2e3deSDmitry ChaginThe list of tty modes that are kept constant
374719d2e3deSDmitry Chagincan be examined and modified with the
374819d2e3deSDmitry Chagin.Va setty
374919d2e3deSDmitry Chaginbuiltin.
375019d2e3deSDmitry ChaginNote that although the editor uses CBREAK mode (or its equivalent),
375119d2e3deSDmitry Chaginit takes typed-ahead characters anyway.
375219d2e3deSDmitry Chagin.Pp
375319d2e3deSDmitry ChaginThe
375419d2e3deSDmitry Chagin.Va echotc
375519d2e3deSDmitry Chagin,
375619d2e3deSDmitry Chagin.Va settc
375719d2e3deSDmitry Chaginand
375819d2e3deSDmitry Chagin.Va telltc
375919d2e3deSDmitry Chagincommands can be used to
376019d2e3deSDmitry Chaginmanipulate and debug terminal capabilities from the command line.
376119d2e3deSDmitry Chagin.Pp
376219d2e3deSDmitry ChaginOn systems that support SIGWINCH or SIGWINDOW, the shell
376319d2e3deSDmitry Chaginadapts to window resizing automatically and adjusts the environment
376419d2e3deSDmitry Chaginvariables
376519d2e3deSDmitry Chagin.Va LINES
376619d2e3deSDmitry Chaginand
376719d2e3deSDmitry Chagin.Va COLUMNS
376819d2e3deSDmitry Chaginif set.
376919d2e3deSDmitry ChaginIf the environment
377019d2e3deSDmitry Chaginvariable
377119d2e3deSDmitry Chagin.Va TERMCAP
377219d2e3deSDmitry Chagincontains li# and co# fields, the shell adjusts
377319d2e3deSDmitry Chaginthem to reflect the new window size.
377419d2e3deSDmitry Chagin.Sh REFERENCE
377519d2e3deSDmitry ChaginThe next sections of this manual describe all of the available
377619d2e3deSDmitry Chagin.Va Builtin commands
377719d2e3deSDmitry Chagin,
377819d2e3deSDmitry Chagin.Va Special aliases
377919d2e3deSDmitry Chaginand
378019d2e3deSDmitry Chagin.Va Special shell variables
378119d2e3deSDmitry Chagin.Ss "Builtin commands"
3782d803a9d0SBrooks Davis.Bl -tag -width XXXXXXX -offset indent
3783d803a9d0SBrooks Davis.It Ar %job
378419d2e3deSDmitry ChaginA synonym for the
378519d2e3deSDmitry Chagin.Va fg
378619d2e3deSDmitry Chaginbuiltin command.
3787d803a9d0SBrooks Davis.It Ar %job \&&
378819d2e3deSDmitry ChaginA synonym for the
378919d2e3deSDmitry Chagin.Va bg
379019d2e3deSDmitry Chaginbuiltin command.
3791d803a9d0SBrooks Davis.It Ar \&:
379219d2e3deSDmitry ChaginDoes nothing, successfully.
379319d2e3deSDmitry Chagin.Pp
3794d803a9d0SBrooks Davis.It Ar @
3795d803a9d0SBrooks Davis.It Ar @ name = expr
3796d803a9d0SBrooks Davis.It Ar @ name[index] = expr
3797d803a9d0SBrooks Davis.It Ar @ name++|--
3798d803a9d0SBrooks Davis.It Ar @name[index]++|--
379919d2e3deSDmitry ChaginThe first form prints the values of all shell variables.
380019d2e3deSDmitry Chagin.Pp
380119d2e3deSDmitry ChaginThe second form assigns the value of
380219d2e3deSDmitry Chagin.Va expr
380319d2e3deSDmitry Chaginto
380419d2e3deSDmitry Chagin.Va name
380519d2e3deSDmitry ChaginThe third form assigns the value of
380619d2e3deSDmitry Chagin.Va expr
380719d2e3deSDmitry Chaginto the
380819d2e3deSDmitry Chagin.Va index
380919d2e3deSDmitry Chagin'th
381019d2e3deSDmitry Chagincomponent of
381119d2e3deSDmitry Chagin.Va name
381219d2e3deSDmitry Chagin; both
381319d2e3deSDmitry Chagin.Va name
381419d2e3deSDmitry Chaginand its
381519d2e3deSDmitry Chagin.Va index
381619d2e3deSDmitry Chagin'th component
381719d2e3deSDmitry Chaginmust already exist.
381819d2e3deSDmitry Chagin.Pp
381919d2e3deSDmitry Chagin.Va expr
382019d2e3deSDmitry Chaginmay contain the operators
382119d2e3deSDmitry Chagin.Sq *
382219d2e3deSDmitry Chagin,
382319d2e3deSDmitry Chagin.Sq +
382419d2e3deSDmitry Chagin, etc., as in C.
382519d2e3deSDmitry ChaginIf
382619d2e3deSDmitry Chagin.Va expr
382719d2e3deSDmitry Chagincontains
382819d2e3deSDmitry Chagin.Sq <
382919d2e3deSDmitry Chagin,
383019d2e3deSDmitry Chagin.Sq >
383119d2e3deSDmitry Chagin,
383219d2e3deSDmitry Chagin.Sq &
383319d2e3deSDmitry Chaginor
383419d2e3deSDmitry Chagin.Sq
383519d2e3deSDmitry Chaginthen at least that part of
383619d2e3deSDmitry Chagin.Va expr
383719d2e3deSDmitry Chaginmust be placed within
383819d2e3deSDmitry Chagin.Sq ()
383919d2e3deSDmitry ChaginNote that the syntax of
384019d2e3deSDmitry Chagin.Va expr
384119d2e3deSDmitry Chaginhas nothing to do with that described
384219d2e3deSDmitry Chaginunder
384319d2e3deSDmitry Chagin.Va Expressions
384419d2e3deSDmitry Chagin.Pp
3845d803a9d0SBrooks DavisThe fourth and fifth forms increment (
3846d803a9d0SBrooks Davis.Sq ++ )
3847d803a9d0SBrooks Davisor decrement
3848d803a9d0SBrooks Davis.Sq ( -- )
384919d2e3deSDmitry Chagin.Va name
385019d2e3deSDmitry Chaginor its
385119d2e3deSDmitry Chagin.Va index
385219d2e3deSDmitry Chagin'th component.
385319d2e3deSDmitry Chagin.Pp
385419d2e3deSDmitry ChaginThe space between
385519d2e3deSDmitry Chagin.Sq @
385619d2e3deSDmitry Chaginand
385719d2e3deSDmitry Chagin.Va name
385819d2e3deSDmitry Chaginis required.
385919d2e3deSDmitry ChaginThe spaces between
386019d2e3deSDmitry Chagin.Va name
386119d2e3deSDmitry Chaginand
386219d2e3deSDmitry Chagin.Sq =
386319d2e3deSDmitry Chaginand between
386419d2e3deSDmitry Chagin.Sq =
386519d2e3deSDmitry Chaginand
386619d2e3deSDmitry Chagin.Va expr
386719d2e3deSDmitry Chaginare optional.
386819d2e3deSDmitry ChaginComponents of
386919d2e3deSDmitry Chagin.Va expr
387019d2e3deSDmitry Chaginmust be separated by spaces.
3871d803a9d0SBrooks Davis.It Ar alias [name [wordlist]]
387219d2e3deSDmitry ChaginWithout arguments, prints all aliases.
387319d2e3deSDmitry ChaginWith
387419d2e3deSDmitry Chagin.Va name
387519d2e3deSDmitry Chagin, prints the alias for name.
387619d2e3deSDmitry ChaginWith
387719d2e3deSDmitry Chagin.Va name
387819d2e3deSDmitry Chaginand
387919d2e3deSDmitry Chagin.Va wordlist
388019d2e3deSDmitry Chagin, assigns
388119d2e3deSDmitry Chagin.Va wordlist
388219d2e3deSDmitry Chaginas the alias of
388319d2e3deSDmitry Chagin.Va name
388419d2e3deSDmitry Chagin.Va wordlist
388519d2e3deSDmitry Chaginis command and filename substituted.
388619d2e3deSDmitry Chagin.Va name
388719d2e3deSDmitry Chaginmay not be
388819d2e3deSDmitry Chagin.Sq alias
388919d2e3deSDmitry Chaginor
389019d2e3deSDmitry Chagin.Sq unalias
389119d2e3deSDmitry ChaginSee also the
389219d2e3deSDmitry Chagin.Va unalias
389319d2e3deSDmitry Chaginbuiltin command.
3894d803a9d0SBrooks Davis.It Ar alloc
389519d2e3deSDmitry ChaginShows the amount of dynamic memory acquired, broken down into used and free
389619d2e3deSDmitry Chaginmemory.
389719d2e3deSDmitry ChaginWith an argument shows the number of free and used blocks in each size
389819d2e3deSDmitry Chagincategory.
389919d2e3deSDmitry ChaginThe categories start at size 8 and double at each step.
3900*5224c2a3SDmitry ChaginThis command's output may vary across system types, because systems other
3901*5224c2a3SDmitry Chaginthan the VAX may use a different memory allocator.
3902d803a9d0SBrooks Davis.It Ar bg [%job...]
390319d2e3deSDmitry ChaginPuts the specified jobs (or, without arguments, the current job)
390419d2e3deSDmitry Chagininto the background, continuing each if it is stopped.
390519d2e3deSDmitry Chagin.Va job
390619d2e3deSDmitry Chaginmay be a number, a string,
3907*5224c2a3SDmitry Chagin.Sq \&, ,
3908*5224c2a3SDmitry Chagin.Sq % ,
3909*5224c2a3SDmitry Chagin.Sq + ,
391019d2e3deSDmitry Chaginor
3911*5224c2a3SDmitry Chagin.Sq \&-
391219d2e3deSDmitry Chaginas described
391319d2e3deSDmitry Chaginunder
3914*5224c2a3SDmitry Chagin.Va Jobs .
3915d803a9d0SBrooks Davis.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+)
3916d803a9d0SBrooks Davis.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+)
3917d803a9d0SBrooks Davis.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+)
3918d803a9d0SBrooks Davis.\" .It Ar macro can't take too many words, so I used \fB in the previous tags
391919d2e3deSDmitry ChaginWithout options, the first form lists all bound keys and the editor command to which each is bound,
392019d2e3deSDmitry Chaginthe second form lists the editor command to which
392119d2e3deSDmitry Chagin.Va key
392219d2e3deSDmitry Chaginis bound and
392319d2e3deSDmitry Chaginthe third form binds the editor command
392419d2e3deSDmitry Chagin.Va command
392519d2e3deSDmitry Chaginto
392619d2e3deSDmitry Chagin.Va key
392719d2e3deSDmitry ChaginOptions include:
392819d2e3deSDmitry Chagin.Pp
3929d803a9d0SBrooks Davis.Bl -tag -width XXX -compact
3930d803a9d0SBrooks Davis.It Fl l
393119d2e3deSDmitry ChaginLists all editor commands and a short description of each.
3932d803a9d0SBrooks Davis.It Fl d
393319d2e3deSDmitry ChaginBinds all keys to the standard bindings for the default editor,
393419d2e3deSDmitry Chaginas per
393519d2e3deSDmitry Chagin.Va -e
393619d2e3deSDmitry Chaginand
393719d2e3deSDmitry Chagin.Va -v
393819d2e3deSDmitry Chaginbelow.
3939d803a9d0SBrooks Davis.It Fl e
394019d2e3deSDmitry ChaginBinds all keys to
394119d2e3deSDmitry Chagin.Va emacs
394219d2e3deSDmitry Chagin(1)\-style bindings.
394319d2e3deSDmitry ChaginUnsets
394419d2e3deSDmitry Chagin.Va vimode
3945d803a9d0SBrooks Davis.It Fl v
394619d2e3deSDmitry ChaginBinds all keys to
394719d2e3deSDmitry Chagin.Va vi
394819d2e3deSDmitry Chagin(1)\-style bindings.
394919d2e3deSDmitry ChaginSets
395019d2e3deSDmitry Chagin.Va vimode
3951d803a9d0SBrooks Davis.It Fl a
395219d2e3deSDmitry ChaginLists or changes key-bindings in the alternative key map.
395319d2e3deSDmitry ChaginThis is the key map used in
395419d2e3deSDmitry Chagin.Va vimode
395519d2e3deSDmitry Chagincommand mode.
3956d803a9d0SBrooks Davis.It Fl b
395719d2e3deSDmitry Chagin.Va key
395819d2e3deSDmitry Chaginis interpreted as
395919d2e3deSDmitry Chagina control character written ^
396019d2e3deSDmitry Chagin.Va character
396119d2e3deSDmitry Chagin(e.g.,
396219d2e3deSDmitry Chagin.Sq ^A
396319d2e3deSDmitry Chagin) or
396419d2e3deSDmitry ChaginC-
396519d2e3deSDmitry Chagin.Va character
396619d2e3deSDmitry Chagin(e.g.,
396719d2e3deSDmitry Chagin.Sq C-A
396819d2e3deSDmitry Chagin),
396919d2e3deSDmitry Chagina meta character written M-
397019d2e3deSDmitry Chagin.Va character
397119d2e3deSDmitry Chagin(e.g.,
397219d2e3deSDmitry Chagin.Sq M-A
397319d2e3deSDmitry Chagin),
397419d2e3deSDmitry Chagina function key written F-
397519d2e3deSDmitry Chagin.Va string
397619d2e3deSDmitry Chagin(e.g.,
397719d2e3deSDmitry Chagin.Sq F-string
397819d2e3deSDmitry Chagin),
397919d2e3deSDmitry Chaginor an extended prefix key written X-
398019d2e3deSDmitry Chagin.Va character
398119d2e3deSDmitry Chagin(e.g.,
398219d2e3deSDmitry Chagin.Sq X-A
398319d2e3deSDmitry Chagin).
3984d803a9d0SBrooks Davis.It Fl k
398519d2e3deSDmitry Chagin.Va key
398619d2e3deSDmitry Chaginis interpreted as a symbolic arrow key name, which may be one of
398719d2e3deSDmitry Chagin`down',
398819d2e3deSDmitry Chagin.Sq up
398919d2e3deSDmitry Chagin,
399019d2e3deSDmitry Chagin.Sq left
399119d2e3deSDmitry Chaginor
399219d2e3deSDmitry Chagin.Sq right
3993d803a9d0SBrooks Davis.It Fl r
399419d2e3deSDmitry ChaginRemoves
399519d2e3deSDmitry Chagin.Va key
399619d2e3deSDmitry Chagin's binding.
399719d2e3deSDmitry ChaginBe careful:
399819d2e3deSDmitry Chagin.Sq bindkey \-r
399919d2e3deSDmitry Chagindoes
400019d2e3deSDmitry Chagin.Va not
400119d2e3deSDmitry Chaginbind
400219d2e3deSDmitry Chagin.Va key
400319d2e3deSDmitry Chaginto
400419d2e3deSDmitry Chagin.Va self-insert-command
400519d2e3deSDmitry Chagin(q.v.), it unbinds
400619d2e3deSDmitry Chagin.Va key
400719d2e3deSDmitry Chagincompletely.
4008d803a9d0SBrooks Davis.It Fl c
400919d2e3deSDmitry Chagin.Va command
401019d2e3deSDmitry Chaginis interpreted as a builtin or external command instead of an
401119d2e3deSDmitry Chagineditor command.
4012d803a9d0SBrooks Davis.It Fl s
401319d2e3deSDmitry Chagin.Va command
401419d2e3deSDmitry Chaginis taken as a literal string and treated as terminal input
401519d2e3deSDmitry Chaginwhen
401619d2e3deSDmitry Chagin.Va key
401719d2e3deSDmitry Chaginis typed.
401819d2e3deSDmitry ChaginBound keys in
401919d2e3deSDmitry Chagin.Va command
402019d2e3deSDmitry Chaginare themselves
402119d2e3deSDmitry Chaginreinterpreted, and this continues for ten levels of interpretation.
4022d803a9d0SBrooks Davis.It Fl \&-
402319d2e3deSDmitry ChaginForces a break from option processing, so the next word is taken as
402419d2e3deSDmitry Chagin.Va key
4025d803a9d0SBrooks Daviseven if it begins with '\&-'.
4026d803a9d0SBrooks Davis.It Fl u
4027d803a9d0SBrooks Davis(or any invalid option)
402819d2e3deSDmitry ChaginPrints a usage message.
4029d803a9d0SBrooks Davis.El
403019d2e3deSDmitry Chagin.Pp
403119d2e3deSDmitry Chagin.Va key
403219d2e3deSDmitry Chaginmay be a single character or a string.
403319d2e3deSDmitry ChaginIf a command is bound to a string, the first character of the string is bound to
403419d2e3deSDmitry Chagin.Va sequence-lead-in
403519d2e3deSDmitry Chaginand the entire string is bound to the command.
403619d2e3deSDmitry Chagin.Pp
403719d2e3deSDmitry ChaginControl characters in
403819d2e3deSDmitry Chagin.Va key
403919d2e3deSDmitry Chagincan be literal (they can be typed by preceding
404019d2e3deSDmitry Chaginthem with the editor command
404119d2e3deSDmitry Chagin.Va quoted-insert
404219d2e3deSDmitry Chagin, normally bound to
404319d2e3deSDmitry Chagin.Sq ^V
404419d2e3deSDmitry Chagin) or
404519d2e3deSDmitry Chaginwritten caret-character style, e.g.,
404619d2e3deSDmitry Chagin.Sq ^A
404719d2e3deSDmitry ChaginDelete is written
404819d2e3deSDmitry Chagin.Sq ^?
404919d2e3deSDmitry Chagin(caret-question mark).
405019d2e3deSDmitry Chagin.Va key
405119d2e3deSDmitry Chaginand
405219d2e3deSDmitry Chagin.Va command
405319d2e3deSDmitry Chagincan contain backslashed
405419d2e3deSDmitry Chaginescape sequences (in the style of System V
405519d2e3deSDmitry Chagin.Va echo
405619d2e3deSDmitry Chagin(1)) as follows:
4057d803a9d0SBrooks Davis.Pp
4058d803a9d0SBrooks Davis.Bl -tag -width XXXX -compact -offset indent
4059d803a9d0SBrooks Davis.It \ea
406019d2e3deSDmitry ChaginBell
4061d803a9d0SBrooks Davis.It \eb
406219d2e3deSDmitry ChaginBackspace
4063d803a9d0SBrooks Davis.It \ee
406419d2e3deSDmitry ChaginEscape
4065d803a9d0SBrooks Davis.It \ef
406619d2e3deSDmitry ChaginForm feed
4067d803a9d0SBrooks Davis.It \en
406819d2e3deSDmitry ChaginNewline
4069d803a9d0SBrooks Davis.It \er
407019d2e3deSDmitry ChaginCarriage return
4071d803a9d0SBrooks Davis.It \et
407219d2e3deSDmitry ChaginHorizontal tab
4073d803a9d0SBrooks Davis.It \ev
407419d2e3deSDmitry ChaginVertical tab
4075d803a9d0SBrooks Davis.It \e\fInnn
407619d2e3deSDmitry ChaginThe ASCII character corresponding to the octal number
407719d2e3deSDmitry Chagin.Va nnn
4078d803a9d0SBrooks Davis.El
407919d2e3deSDmitry Chagin.Pp
408019d2e3deSDmitry Chagin`\e' nullifies the special meaning of the following character, if it has
408119d2e3deSDmitry Chaginany, notably
408219d2e3deSDmitry Chagin.Sq \e
408319d2e3deSDmitry Chaginand
408419d2e3deSDmitry Chagin.Sq ^
4085d803a9d0SBrooks Davis.It bs2cmd Va bs2000-command
408619d2e3deSDmitry Chagin(+)
408719d2e3deSDmitry ChaginPasses
408819d2e3deSDmitry Chagin.Va bs2000-command
408919d2e3deSDmitry Chaginto the BS2000 command interpreter for
409019d2e3deSDmitry Chaginexecution. Only non-interactive commands can be executed, and it is
409119d2e3deSDmitry Chaginnot possible to execute any command that would overlay the image
409219d2e3deSDmitry Chaginof the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
4093d803a9d0SBrooks Davis.It break
409419d2e3deSDmitry ChaginCauses execution to resume after the
409519d2e3deSDmitry Chagin.Va end
409619d2e3deSDmitry Chaginof the nearest
409719d2e3deSDmitry Chaginenclosing
409819d2e3deSDmitry Chagin.Va foreach
409919d2e3deSDmitry Chaginor
410019d2e3deSDmitry Chagin.Va while
410119d2e3deSDmitry ChaginThe remaining commands on the
410219d2e3deSDmitry Chagincurrent line are executed.
410319d2e3deSDmitry ChaginMulti-level breaks are thus
410419d2e3deSDmitry Chaginpossible by writing them all on one line.
4105d803a9d0SBrooks Davis.It breaksw
410619d2e3deSDmitry ChaginCauses a break from a
410719d2e3deSDmitry Chagin.Va switch
410819d2e3deSDmitry Chagin, resuming after the
410919d2e3deSDmitry Chagin.Va endsw
4110d803a9d0SBrooks Davis
4111d803a9d0SBrooks Davis.It builtins \fR(+)
411219d2e3deSDmitry ChaginPrints the names of all builtin commands.
4113d803a9d0SBrooks Davis
4114d803a9d0SBrooks Davis.It bye \fR(+)
411519d2e3deSDmitry ChaginA synonym for the
411619d2e3deSDmitry Chagin.Va logout
411719d2e3deSDmitry Chaginbuiltin command.
411819d2e3deSDmitry ChaginAvailable only if the shell was so compiled;
411919d2e3deSDmitry Chaginsee the
412019d2e3deSDmitry Chagin.Va version
412119d2e3deSDmitry Chaginshell variable.
4122d803a9d0SBrooks Davis
4123d803a9d0SBrooks Davis.It case \fIlabel\fB:
412419d2e3deSDmitry ChaginA label in a
412519d2e3deSDmitry Chagin.Va switch
412619d2e3deSDmitry Chaginstatement as discussed below.
4127d803a9d0SBrooks Davis
4128d803a9d0SBrooks Davis.It cd \fR[
412919d2e3deSDmitry Chagin.Fl p\fR] [
413019d2e3deSDmitry Chagin.Fl l\fR] [
413119d2e3deSDmitry Chagin.Fl n\fR|
413219d2e3deSDmitry Chagin.Fl v\fR] [\I--\fR] [
413319d2e3deSDmitry Chagin.Va name
413419d2e3deSDmitry Chagin]
413519d2e3deSDmitry ChaginIf a directory
413619d2e3deSDmitry Chagin.Va name
413719d2e3deSDmitry Chaginis given, changes the shell's working directory
413819d2e3deSDmitry Chaginto
413919d2e3deSDmitry Chagin.Va name
414019d2e3deSDmitry ChaginIf not, changes to
414119d2e3deSDmitry Chagin.Va home
414219d2e3deSDmitry Chagin, unless the
414319d2e3deSDmitry Chagin.Va cdtohome
414419d2e3deSDmitry Chaginvariable is not set, in which case a
414519d2e3deSDmitry Chagin.Va name
414619d2e3deSDmitry Chaginis required.
414719d2e3deSDmitry ChaginIf
414819d2e3deSDmitry Chagin.Va name
414919d2e3deSDmitry Chaginis
415019d2e3deSDmitry Chagin.Sq \-
415119d2e3deSDmitry Chaginit is interpreted as the previous working directory
415219d2e3deSDmitry Chagin(see
415319d2e3deSDmitry Chagin.Va Other substitutions
415419d2e3deSDmitry Chagin).
415519d2e3deSDmitry Chagin(+)
415619d2e3deSDmitry ChaginIf
415719d2e3deSDmitry Chagin.Va name
415819d2e3deSDmitry Chaginis not a subdirectory of the current directory
415919d2e3deSDmitry Chagin(and does not begin with
416019d2e3deSDmitry Chagin.Sq /
416119d2e3deSDmitry Chagin,
416219d2e3deSDmitry Chagin.Sq ./
416319d2e3deSDmitry Chaginor
416419d2e3deSDmitry Chagin.Sq ../
416519d2e3deSDmitry Chagin), each component of the variable
416619d2e3deSDmitry Chagin.Va cdpath
416719d2e3deSDmitry Chaginis checked to see if it has a subdirectory
416819d2e3deSDmitry Chagin.Va name
416919d2e3deSDmitry ChaginFinally, if
417019d2e3deSDmitry Chaginall else fails but
417119d2e3deSDmitry Chagin.Va name
417219d2e3deSDmitry Chaginis a shell variable whose value
417319d2e3deSDmitry Chaginbegins with
417419d2e3deSDmitry Chagin.Sq /
417519d2e3deSDmitry Chaginor '.', then this is tried to see if it is a directory, and
417619d2e3deSDmitry Chaginthe
417719d2e3deSDmitry Chagin.Fl p\fR option is implied.
417819d2e3deSDmitry Chagin.RS +8
417919d2e3deSDmitry Chagin.Pp
418019d2e3deSDmitry ChaginWith
418119d2e3deSDmitry Chagin.Fl p\fR, prints the final directory stack, just like
418219d2e3deSDmitry Chagin.Va dirs
418319d2e3deSDmitry ChaginThe
418419d2e3deSDmitry Chagin.Fl l\fR,
418519d2e3deSDmitry Chagin.Fl n\fR and
418619d2e3deSDmitry Chagin.Fl v\fR flags have the same effect on
418719d2e3deSDmitry Chagin.Va cd
418819d2e3deSDmitry Chaginas on
418919d2e3deSDmitry Chagin.Va dirs
419019d2e3deSDmitry Chagin, and they imply
419119d2e3deSDmitry Chagin.Fl p\fR.
419219d2e3deSDmitry Chagin(+)
419319d2e3deSDmitry ChaginUsing
419419d2e3deSDmitry Chagin.Fl \-\fR forces a break from option processing so the next word
419519d2e3deSDmitry Chaginis taken as the directory
419619d2e3deSDmitry Chagin.Va name
419719d2e3deSDmitry Chagineven if it begins with '\-'. (+)
419819d2e3deSDmitry Chagin.Pp
419919d2e3deSDmitry ChaginSee also the
420019d2e3deSDmitry Chagin.Va implicitcd
420119d2e3deSDmitry Chaginand
420219d2e3deSDmitry Chagin.Va cdtohome
420319d2e3deSDmitry Chaginshell variables.
420419d2e3deSDmitry Chagin.RE
4205d803a9d0SBrooks Davis
4206d803a9d0SBrooks Davis.It chdir
420719d2e3deSDmitry ChaginA synonym for the
420819d2e3deSDmitry Chagin.Va cd
420919d2e3deSDmitry Chaginbuiltin command.
4210d803a9d0SBrooks Davis
4211d803a9d0SBrooks Davis.It complete \fR[
421219d2e3deSDmitry Chagin.Va command
421319d2e3deSDmitry Chagin[\fIword\fB/\fIpattern\fB/
421419d2e3deSDmitry Chagin.Va list
421519d2e3deSDmitry Chagin[\fB:
421619d2e3deSDmitry Chagin.Va select
421719d2e3deSDmitry Chagin]
421819d2e3deSDmitry Chagin.Va /
421919d2e3deSDmitry Chagin[[
422019d2e3deSDmitry Chagin.Va suffix
422119d2e3deSDmitry Chagin]
422219d2e3deSDmitry Chagin.Va /
422319d2e3deSDmitry Chagin] ...]] (+)
422419d2e3deSDmitry ChaginWithout arguments, lists all completions.
422519d2e3deSDmitry ChaginWith
422619d2e3deSDmitry Chagin.Va command
422719d2e3deSDmitry Chagin, lists completions for
422819d2e3deSDmitry Chagin.Va command
422919d2e3deSDmitry ChaginWith
423019d2e3deSDmitry Chagin.Va command
423119d2e3deSDmitry Chaginand
423219d2e3deSDmitry Chagin.Va word
423319d2e3deSDmitry Chaginetc., defines completions.
423419d2e3deSDmitry Chagin.RS +8
423519d2e3deSDmitry Chagin.Pp
423619d2e3deSDmitry Chagin.Va command
423719d2e3deSDmitry Chaginmay be a full command name or a glob-pattern
423819d2e3deSDmitry Chagin(see
423919d2e3deSDmitry Chagin.Va Filename substitution
424019d2e3deSDmitry Chagin).
424119d2e3deSDmitry ChaginIt can begin with
424219d2e3deSDmitry Chagin.Sq \-
424319d2e3deSDmitry Chaginto indicate that
424419d2e3deSDmitry Chagincompletion should be used only when
424519d2e3deSDmitry Chagin.Va command
424619d2e3deSDmitry Chaginis ambiguous.
424719d2e3deSDmitry Chagin.Pp
424819d2e3deSDmitry Chagin.Va word
424919d2e3deSDmitry Chaginspecifies which word relative to the current word
425019d2e3deSDmitry Chaginis to be completed, and may be one of the following:
425119d2e3deSDmitry Chagin.Pp
425219d2e3deSDmitry Chagin.PD 0
425319d2e3deSDmitry Chagin.RS +4
425419d2e3deSDmitry Chagin.TP 4
4255d803a9d0SBrooks Davis.It c
425619d2e3deSDmitry ChaginCurrent-word completion.
425719d2e3deSDmitry Chagin.Va pattern
425819d2e3deSDmitry Chaginis a glob-pattern which must match the beginning of the current word on
425919d2e3deSDmitry Chaginthe command line.
426019d2e3deSDmitry Chagin.Va pattern
426119d2e3deSDmitry Chaginis ignored when completing the current word.
426219d2e3deSDmitry Chagin.TP 4
4263d803a9d0SBrooks Davis.It C
426419d2e3deSDmitry ChaginLike
426519d2e3deSDmitry Chagin.Va c
426619d2e3deSDmitry Chagin, but includes
426719d2e3deSDmitry Chagin.Va pattern
426819d2e3deSDmitry Chaginwhen completing the current word.
426919d2e3deSDmitry Chagin.TP 4
4270d803a9d0SBrooks Davis.It n
427119d2e3deSDmitry ChaginNext-word completion.
427219d2e3deSDmitry Chagin.Va pattern
427319d2e3deSDmitry Chaginis a glob-pattern which must match the beginning of the previous word on
427419d2e3deSDmitry Chaginthe command line.
427519d2e3deSDmitry Chagin.TP 4
4276d803a9d0SBrooks Davis.It N
427719d2e3deSDmitry ChaginLike
427819d2e3deSDmitry Chagin.Va n
427919d2e3deSDmitry Chagin, but must match the beginning of the word two before the current word.
428019d2e3deSDmitry Chagin.TP 4
4281d803a9d0SBrooks Davis.It p
428219d2e3deSDmitry ChaginPosition-dependent completion.
428319d2e3deSDmitry Chagin.Va pattern
428419d2e3deSDmitry Chaginis a numeric range, with the same syntax used to index shell
428519d2e3deSDmitry Chaginvariables, which must include the current word.
428619d2e3deSDmitry Chagin.PD
428719d2e3deSDmitry Chagin.RE
428819d2e3deSDmitry Chagin.Pp
428919d2e3deSDmitry Chagin.Va list
429019d2e3deSDmitry Chagin, the list of possible completions, may be one of the following:
429119d2e3deSDmitry Chagin.Pp
4292d803a9d0SBrooks Davis.Bl -tag
4293d803a9d0SBrooks Davis.It a
429419d2e3deSDmitry ChaginAliases
4295d803a9d0SBrooks Davis.It b
429619d2e3deSDmitry ChaginBindings (editor commands)
4297d803a9d0SBrooks Davis.It c
429819d2e3deSDmitry ChaginCommands (builtin or external commands)
4299d803a9d0SBrooks Davis.It C
430019d2e3deSDmitry ChaginExternal commands which begin with the supplied path prefix
4301d803a9d0SBrooks Davis.It d
430219d2e3deSDmitry ChaginDirectories
4303d803a9d0SBrooks Davis.It D
430419d2e3deSDmitry ChaginDirectories which begin with the supplied path prefix
4305d803a9d0SBrooks Davis.It e
430619d2e3deSDmitry ChaginEnvironment variables
4307d803a9d0SBrooks Davis.It f
430819d2e3deSDmitry ChaginFilenames
4309d803a9d0SBrooks Davis.It F
431019d2e3deSDmitry ChaginFilenames which begin with the supplied path prefix
4311d803a9d0SBrooks Davis.It g
431219d2e3deSDmitry ChaginGroupnames
4313d803a9d0SBrooks Davis.It j
431419d2e3deSDmitry ChaginJobs
4315d803a9d0SBrooks Davis.It l
431619d2e3deSDmitry ChaginLimits
4317d803a9d0SBrooks Davis.It n
431819d2e3deSDmitry ChaginNothing
4319d803a9d0SBrooks Davis.It s
432019d2e3deSDmitry ChaginShell variables
4321d803a9d0SBrooks Davis.It S
432219d2e3deSDmitry ChaginSignals
4323d803a9d0SBrooks Davis.It t
432419d2e3deSDmitry ChaginPlain (
432519d2e3deSDmitry Chagin.Dq text )
432619d2e3deSDmitry Chaginfiles
4327d803a9d0SBrooks Davis.It T
432819d2e3deSDmitry ChaginPlain (
432919d2e3deSDmitry Chagin.Dq text )
433019d2e3deSDmitry Chaginfiles which begin with the supplied path prefix
4331d803a9d0SBrooks Davis.It v
433219d2e3deSDmitry ChaginAny variables
4333d803a9d0SBrooks Davis.It u
433419d2e3deSDmitry ChaginUsernames
4335d803a9d0SBrooks Davis.It x
433619d2e3deSDmitry ChaginLike
433719d2e3deSDmitry Chagin.Va n ,
433819d2e3deSDmitry Chaginbut prints
433919d2e3deSDmitry Chagin.Va select
434019d2e3deSDmitry Chaginwhen
434119d2e3deSDmitry Chagin.Va list-choices
434219d2e3deSDmitry Chaginis used.
4343d803a9d0SBrooks Davis.It X
434419d2e3deSDmitry ChaginCompletions
434519d2e3deSDmitry Chagin$
434619d2e3deSDmitry Chagin.Va var
434719d2e3deSDmitry ChaginWords from the variable
434819d2e3deSDmitry Chagin.Va var
434919d2e3deSDmitry Chagin(...)
435019d2e3deSDmitry ChaginWords from the given list
435119d2e3deSDmitry Chagin\`...\`
435219d2e3deSDmitry ChaginWords from the output of command
4353d803a9d0SBrooks Davis.El
435419d2e3deSDmitry Chagin.Pp
435519d2e3deSDmitry Chagin.Va select
435619d2e3deSDmitry Chaginis an optional glob-pattern.
435719d2e3deSDmitry ChaginIf given, words from only
435819d2e3deSDmitry Chagin.Va list
435919d2e3deSDmitry Chaginthat match
436019d2e3deSDmitry Chagin.Va select
436119d2e3deSDmitry Chaginare considered
436219d2e3deSDmitry Chaginand the
436319d2e3deSDmitry Chagin.Va fignore
436419d2e3deSDmitry Chaginshell variable is ignored.
436519d2e3deSDmitry ChaginThe last three types of completion may not have a
436619d2e3deSDmitry Chagin.Va select
436719d2e3deSDmitry Chaginpattern, and
436819d2e3deSDmitry Chagin.Va x
436919d2e3deSDmitry Chaginuses
437019d2e3deSDmitry Chagin.Va select
437119d2e3deSDmitry Chaginas an explanatory message when
437219d2e3deSDmitry Chaginthe
437319d2e3deSDmitry Chagin.Va list-choices
437419d2e3deSDmitry Chagineditor command is used.
437519d2e3deSDmitry Chagin.Pp
437619d2e3deSDmitry Chagin.Va suffix
437719d2e3deSDmitry Chaginis a single character to be appended to a successful
437819d2e3deSDmitry Chagincompletion.
437919d2e3deSDmitry ChaginIf null, no character is appended.
438019d2e3deSDmitry ChaginIf omitted (in which
438119d2e3deSDmitry Chagincase the fourth delimiter can also be omitted), a slash is appended to
438219d2e3deSDmitry Chagindirectories and a space to other words.
438319d2e3deSDmitry Chagin.Pp
438419d2e3deSDmitry Chagin.Va command
438519d2e3deSDmitry Chagininvoked from \`...\` version has additional environment
438619d2e3deSDmitry Chaginvariable set, the variable name is \%
438719d2e3deSDmitry Chagin.Va COMMAND_LINE
438819d2e3deSDmitry Chagin\% and
438919d2e3deSDmitry Chagincontains (as its name indicates) contents of the current (already
439019d2e3deSDmitry Chagintyped in) command line. One can examine and use contents of the
439119d2e3deSDmitry Chagin\%
439219d2e3deSDmitry Chagin.Va COMMAND_LINE
439319d2e3deSDmitry Chagin\% variable in her custom script to build more
439419d2e3deSDmitry Chaginsophisticated completions (see completion for svn(1) included in
439519d2e3deSDmitry Chaginthis package).
439619d2e3deSDmitry Chagin.Pp
439719d2e3deSDmitry ChaginNow for some examples.
439819d2e3deSDmitry ChaginSome commands take only directories as arguments,
439919d2e3deSDmitry Chaginso there's no point completing plain files.
440019d2e3deSDmitry Chagin.IP "" 4
440119d2e3deSDmitry Chagin> complete cd 'p/1/d/'
440219d2e3deSDmitry Chagin.Pp
440319d2e3deSDmitry Chagincompletes only the first word following
440419d2e3deSDmitry Chagin.Sq cd
440519d2e3deSDmitry Chagin(`p/1') with a directory.
440619d2e3deSDmitry Chagin.Va p
440719d2e3deSDmitry Chagin-type completion can also be used to narrow down command completion:
440819d2e3deSDmitry Chagin.IP "" 4
440919d2e3deSDmitry Chagin> co[^D]
441019d2e3deSDmitry Chagin.br
441119d2e3deSDmitry Chagincomplete compress
441219d2e3deSDmitry Chagin.br
441319d2e3deSDmitry Chagin> complete \-co* 'p/0/(compress)/'
441419d2e3deSDmitry Chagin.br
441519d2e3deSDmitry Chagin> co[^D]
441619d2e3deSDmitry Chagin.br
441719d2e3deSDmitry Chagin> compress
441819d2e3deSDmitry Chagin.Pp
441919d2e3deSDmitry ChaginThis completion completes commands (words in position 0,
442019d2e3deSDmitry Chagin.Sq p/0
442119d2e3deSDmitry Chagin)
442219d2e3deSDmitry Chaginwhich begin with
442319d2e3deSDmitry Chagin.Sq co
442419d2e3deSDmitry Chagin(thus matching
442519d2e3deSDmitry Chagin.Sq co*
442619d2e3deSDmitry Chagin) to
442719d2e3deSDmitry Chagin.Sq compress
442819d2e3deSDmitry Chagin(the only
442919d2e3deSDmitry Chaginword in the list).
443019d2e3deSDmitry ChaginThe leading
443119d2e3deSDmitry Chagin.Sq \-
443219d2e3deSDmitry Chaginindicates that this completion is to be used with only
443319d2e3deSDmitry Chaginambiguous commands.
443419d2e3deSDmitry Chagin.IP "" 4
443519d2e3deSDmitry Chagin> complete find 'n/\-user/u/'
443619d2e3deSDmitry Chagin.Pp
443719d2e3deSDmitry Chaginis an example of
443819d2e3deSDmitry Chagin.Va n
443919d2e3deSDmitry Chagin-type completion.
444019d2e3deSDmitry ChaginAny word following
444119d2e3deSDmitry Chagin.Sq find
444219d2e3deSDmitry Chaginand
444319d2e3deSDmitry Chaginimmediately following
444419d2e3deSDmitry Chagin.Sq \-user
444519d2e3deSDmitry Chaginis completed from the list of users.
444619d2e3deSDmitry Chagin.IP "" 4
444719d2e3deSDmitry Chagin> complete cc 'c/\-I/d/'
444819d2e3deSDmitry Chagin.Pp
444919d2e3deSDmitry Chagindemonstrates
445019d2e3deSDmitry Chagin.Va c
445119d2e3deSDmitry Chagin-type completion.
445219d2e3deSDmitry ChaginAny word following
445319d2e3deSDmitry Chagin.Sq cc
445419d2e3deSDmitry Chaginand beginning
445519d2e3deSDmitry Chaginwith
445619d2e3deSDmitry Chagin.Sq \-I
445719d2e3deSDmitry Chaginis completed as a directory.
445819d2e3deSDmitry Chagin`\-I' is not taken as part of the
445919d2e3deSDmitry Chagindirectory because we used lowercase
446019d2e3deSDmitry Chagin.Va c
446119d2e3deSDmitry Chagin.Pp
446219d2e3deSDmitry ChaginDifferent
446319d2e3deSDmitry Chagin.Va list
446419d2e3deSDmitry Chagins are useful with different commands.
446519d2e3deSDmitry Chagin.IP "" 4
446619d2e3deSDmitry Chagin> complete alias 'p/1/a/'
446719d2e3deSDmitry Chagin.br
446819d2e3deSDmitry Chagin> complete man 'p/*/c/'
446919d2e3deSDmitry Chagin.br
447019d2e3deSDmitry Chagin> complete set 'p/1/s/'
447119d2e3deSDmitry Chagin.br
447219d2e3deSDmitry Chagin> complete true 'p/1/x:Truth has no options./'
447319d2e3deSDmitry Chagin.Pp
447419d2e3deSDmitry ChaginThese complete words following
447519d2e3deSDmitry Chagin.Sq alias
447619d2e3deSDmitry Chaginwith aliases,
447719d2e3deSDmitry Chagin.Sq man
447819d2e3deSDmitry Chaginwith commands,
447919d2e3deSDmitry Chaginand
448019d2e3deSDmitry Chagin.Sq set
448119d2e3deSDmitry Chaginwith shell variables.
448219d2e3deSDmitry Chagin`true' doesn't have any options, so
448319d2e3deSDmitry Chagin.Va x
448419d2e3deSDmitry Chagindoes nothing when completion
448519d2e3deSDmitry Chaginis attempted and prints
448619d2e3deSDmitry Chagin.Sq Truth has no options.
448719d2e3deSDmitry Chaginwhen completion choices are listed.
448819d2e3deSDmitry Chagin.Pp
448919d2e3deSDmitry ChaginNote that the
449019d2e3deSDmitry Chagin.Va man
449119d2e3deSDmitry Chaginexample, and several other examples below, could
449219d2e3deSDmitry Chaginjust as well have used 'c/*' or 'n/*' as 'p/*'.
449319d2e3deSDmitry Chagin.Pp
449419d2e3deSDmitry ChaginWords can be completed from a variable evaluated at completion time,
449519d2e3deSDmitry Chagin.IP "" 4
449619d2e3deSDmitry Chagin> complete ftp 'p/1/$hostnames/'
449719d2e3deSDmitry Chagin.br
449819d2e3deSDmitry Chagin> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
449919d2e3deSDmitry Chagin.br
450019d2e3deSDmitry Chagin> ftp [^D]
450119d2e3deSDmitry Chagin.br
450219d2e3deSDmitry Chaginrtfm.mit.edu tesla.ee.cornell.edu
450319d2e3deSDmitry Chagin.br
450419d2e3deSDmitry Chagin> ftp [^C]
450519d2e3deSDmitry Chagin.br
450619d2e3deSDmitry Chagin> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
450719d2e3deSDmitry Chagin.br
450819d2e3deSDmitry Chagin> ftp [^D]
450919d2e3deSDmitry Chagin.br
451019d2e3deSDmitry Chaginrtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
451119d2e3deSDmitry Chagin.Pp
451219d2e3deSDmitry Chaginor from a command run at completion time:
451319d2e3deSDmitry Chagin.IP "" 4
451419d2e3deSDmitry Chagin> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
451519d2e3deSDmitry Chagin.br
451619d2e3deSDmitry Chagin> kill \-9 [^D]
451719d2e3deSDmitry Chagin.br
451819d2e3deSDmitry Chagin23113 23377 23380 23406 23429 23529 23530 PID
451919d2e3deSDmitry Chagin.Pp
452019d2e3deSDmitry ChaginNote that the
452119d2e3deSDmitry Chagin.Va complete
452219d2e3deSDmitry Chagincommand does not itself quote its arguments,
452319d2e3deSDmitry Chaginso the braces, space and
452419d2e3deSDmitry Chagin.Sq $
452519d2e3deSDmitry Chaginin
452619d2e3deSDmitry Chagin.Sq {print $1}
452719d2e3deSDmitry Chaginmust be quoted explicitly.
452819d2e3deSDmitry Chagin.Pp
452919d2e3deSDmitry ChaginOne command can have multiple completions:
453019d2e3deSDmitry Chagin.IP "" 4
453119d2e3deSDmitry Chagin> complete dbx 'p/2/(core)/' 'p/*/c/'
453219d2e3deSDmitry Chagin.Pp
453319d2e3deSDmitry Chagincompletes the second argument to
453419d2e3deSDmitry Chagin.Sq dbx
453519d2e3deSDmitry Chaginwith the word
453619d2e3deSDmitry Chagin.Sq core
453719d2e3deSDmitry Chaginand all other
453819d2e3deSDmitry Chaginarguments with commands.
453919d2e3deSDmitry ChaginNote that the positional completion is specified
454019d2e3deSDmitry Chaginbefore the next-word completion.
454119d2e3deSDmitry ChaginBecause completions are evaluated from left to right, if
454219d2e3deSDmitry Chaginthe next-word completion were specified first it would always match
454319d2e3deSDmitry Chaginand the positional completion would never be executed.
454419d2e3deSDmitry ChaginThis is a
454519d2e3deSDmitry Chagincommon mistake when defining a completion.
454619d2e3deSDmitry Chagin.Pp
454719d2e3deSDmitry ChaginThe
454819d2e3deSDmitry Chagin.Va select
454919d2e3deSDmitry Chaginpattern is useful when a command takes files with only
455019d2e3deSDmitry Chaginparticular forms as arguments.
455119d2e3deSDmitry ChaginFor example,
455219d2e3deSDmitry Chagin.IP "" 4
455319d2e3deSDmitry Chagin> complete cc 'p/*/f:*.[cao]/'
455419d2e3deSDmitry Chagin.Pp
455519d2e3deSDmitry Chagincompletes
455619d2e3deSDmitry Chagin.Sq cc
455719d2e3deSDmitry Chaginarguments to files ending in only
455819d2e3deSDmitry Chagin.Sq .c
455919d2e3deSDmitry Chagin,
456019d2e3deSDmitry Chagin.Sq .a
456119d2e3deSDmitry Chagin, or
456219d2e3deSDmitry Chagin.Sq .o
456319d2e3deSDmitry Chagin.Va select
456419d2e3deSDmitry Chagincan also exclude files, using negation of a glob-pattern as
456519d2e3deSDmitry Chagindescribed under
456619d2e3deSDmitry Chagin.Va Filename substitution
456719d2e3deSDmitry ChaginOne might use
456819d2e3deSDmitry Chagin.IP "" 4
456919d2e3deSDmitry Chagin> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
457019d2e3deSDmitry Chagin.Pp
457119d2e3deSDmitry Chaginto exclude precious source code from
457219d2e3deSDmitry Chagin.Sq rm
457319d2e3deSDmitry Chagincompletion.
457419d2e3deSDmitry ChaginOf course, one
457519d2e3deSDmitry Chagincould still type excluded names manually or override the completion
457619d2e3deSDmitry Chaginmechanism using the
457719d2e3deSDmitry Chagin.Va complete-word-raw
457819d2e3deSDmitry Chaginor
457919d2e3deSDmitry Chagin.Va list-choices-raw
458019d2e3deSDmitry Chagineditor commands (q.v.).
458119d2e3deSDmitry Chagin.Pp
458219d2e3deSDmitry ChaginThe
458319d2e3deSDmitry Chagin.Sq C
458419d2e3deSDmitry Chagin,
458519d2e3deSDmitry Chagin.Sq D
458619d2e3deSDmitry Chagin,
458719d2e3deSDmitry Chagin.Sq F
458819d2e3deSDmitry Chaginand
458919d2e3deSDmitry Chagin.Sq T
459019d2e3deSDmitry Chagin
459119d2e3deSDmitry Chagin.Va list
459219d2e3deSDmitry Chagins are like
459319d2e3deSDmitry Chagin.Sq c
459419d2e3deSDmitry Chagin,
459519d2e3deSDmitry Chagin.Sq d
459619d2e3deSDmitry Chagin,
459719d2e3deSDmitry Chagin.Sq f
459819d2e3deSDmitry Chaginand
459919d2e3deSDmitry Chagin.Sq t
460019d2e3deSDmitry Chaginrespectively, but they use the
460119d2e3deSDmitry Chagin.Va select
460219d2e3deSDmitry Chaginargument in a different way: to
460319d2e3deSDmitry Chaginrestrict completion to files beginning with a particular path prefix.
460419d2e3deSDmitry ChaginFor
460519d2e3deSDmitry Chaginexample, the Elm mail program uses
460619d2e3deSDmitry Chagin.Sq =
460719d2e3deSDmitry Chaginas an abbreviation for one's mail
460819d2e3deSDmitry Chagindirectory.
460919d2e3deSDmitry ChaginOne might use
461019d2e3deSDmitry Chagin.IP "" 4
461119d2e3deSDmitry Chagin> complete elm c@=@F:$HOME/Mail/@
461219d2e3deSDmitry Chagin.Pp
461319d2e3deSDmitry Chaginto complete
461419d2e3deSDmitry Chagin.Sq elm \-f =
461519d2e3deSDmitry Chaginas if it were
461619d2e3deSDmitry Chagin.Sq elm \-f ~/Mail/
461719d2e3deSDmitry ChaginNote that we used
461819d2e3deSDmitry Chagin.Sq @
461919d2e3deSDmitry Chagininstead of
462019d2e3deSDmitry Chagin.Sq /
462119d2e3deSDmitry Chaginto avoid confusion with the
462219d2e3deSDmitry Chagin.Va select
462319d2e3deSDmitry Chaginargument, and we used
462419d2e3deSDmitry Chagin`$HOME' instead of
462519d2e3deSDmitry Chagin.Sq ~
462619d2e3deSDmitry Chaginbecause home directory substitution works at only the
462719d2e3deSDmitry Chaginbeginning of a word.
462819d2e3deSDmitry Chagin.Pp
462919d2e3deSDmitry Chagin.Va suffix
463019d2e3deSDmitry Chaginis used to add a nonstandard suffix
463119d2e3deSDmitry Chagin(not space or
463219d2e3deSDmitry Chagin.Sq /
463319d2e3deSDmitry Chaginfor directories) to completed words.
463419d2e3deSDmitry Chagin.IP "" 4
463519d2e3deSDmitry Chagin> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
463619d2e3deSDmitry Chagin.Pp
463719d2e3deSDmitry Chagincompletes arguments to
463819d2e3deSDmitry Chagin.Sq finger
463919d2e3deSDmitry Chaginfrom the list of users, appends an
464019d2e3deSDmitry Chagin.Sq @
464119d2e3deSDmitry Chagin,
464219d2e3deSDmitry Chaginand then completes after the
464319d2e3deSDmitry Chagin.Sq @
464419d2e3deSDmitry Chaginfrom the
464519d2e3deSDmitry Chagin.Sq hostnames
464619d2e3deSDmitry Chaginvariable.
464719d2e3deSDmitry ChaginNote
464819d2e3deSDmitry Chaginagain the order in which the completions are specified.
464919d2e3deSDmitry Chagin.Pp
465019d2e3deSDmitry ChaginFinally, here's a complex example for inspiration:
465119d2e3deSDmitry Chagin.IP "" 4
465219d2e3deSDmitry Chagin> complete find \e
465319d2e3deSDmitry Chagin.br
465419d2e3deSDmitry Chagin\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
465519d2e3deSDmitry Chagin.br
465619d2e3deSDmitry Chagin\&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
465719d2e3deSDmitry Chagin.br
465819d2e3deSDmitry Chagin\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
465919d2e3deSDmitry Chagin.br
466019d2e3deSDmitry Chagin\&'n/\-type/(b c d f l p s)/' \e
466119d2e3deSDmitry Chagin.br
466219d2e3deSDmitry Chagin\'c/\-/(name newer cpio ncpio exec ok user \e
466319d2e3deSDmitry Chagin.br
466419d2e3deSDmitry Chagingroup fstype type atime ctime depth inum \e
466519d2e3deSDmitry Chagin.br
466619d2e3deSDmitry Chaginls mtime nogroup nouser perm print prune \e
466719d2e3deSDmitry Chagin.br
466819d2e3deSDmitry Chaginsize xdev)/' \e
466919d2e3deSDmitry Chagin.br
467019d2e3deSDmitry Chagin\&'p/*/d/'
467119d2e3deSDmitry Chagin.Pp
467219d2e3deSDmitry ChaginThis completes words following
467319d2e3deSDmitry Chagin.Sq \-name
467419d2e3deSDmitry Chagin,
467519d2e3deSDmitry Chagin.Sq \-newer
467619d2e3deSDmitry Chagin,
467719d2e3deSDmitry Chagin.Sq \-cpio
467819d2e3deSDmitry Chaginor
467919d2e3deSDmitry Chagin.Sq ncpio
468019d2e3deSDmitry Chagin(note the pattern which matches both) to files,
468119d2e3deSDmitry Chaginwords following
468219d2e3deSDmitry Chagin.Sq \-exec
468319d2e3deSDmitry Chaginor
468419d2e3deSDmitry Chagin.Sq \-ok
468519d2e3deSDmitry Chaginto commands, words following
468619d2e3deSDmitry Chagin.Sq user
468719d2e3deSDmitry Chaginand
468819d2e3deSDmitry Chagin.Sq group
468919d2e3deSDmitry Chaginto users and groups respectively
469019d2e3deSDmitry Chaginand words following
469119d2e3deSDmitry Chagin.Sq \-fstype
469219d2e3deSDmitry Chaginor
469319d2e3deSDmitry Chagin.Sq \-type
469419d2e3deSDmitry Chaginto members of the
469519d2e3deSDmitry Chagingiven lists.
469619d2e3deSDmitry ChaginIt also completes the switches themselves from the given list
469719d2e3deSDmitry Chagin(note the use of
469819d2e3deSDmitry Chagin.Va c
469919d2e3deSDmitry Chagin-type completion)
470019d2e3deSDmitry Chaginand completes anything not otherwise completed to a directory.
470119d2e3deSDmitry ChaginWhew.
470219d2e3deSDmitry Chagin.Pp
470319d2e3deSDmitry ChaginRemember that programmed completions are ignored if the word being completed
470419d2e3deSDmitry Chaginis a tilde substitution (beginning with
470519d2e3deSDmitry Chagin.Sq ~
470619d2e3deSDmitry Chagin) or a variable (beginning with
470719d2e3deSDmitry Chagin.Sq $
470819d2e3deSDmitry Chagin).
470919d2e3deSDmitry ChaginSee also the
471019d2e3deSDmitry Chagin.Va uncomplete
471119d2e3deSDmitry Chaginbuiltin command.
471219d2e3deSDmitry Chagin.RE
471319d2e3deSDmitry Chagin.TP 8
471419d2e3deSDmitry Chagin.B continue
471519d2e3deSDmitry ChaginContinues execution of the nearest enclosing
471619d2e3deSDmitry Chagin.Va while
471719d2e3deSDmitry Chaginor
471819d2e3deSDmitry Chagin.Va foreach
471919d2e3deSDmitry ChaginThe rest of the commands on the current line are executed.
472019d2e3deSDmitry Chagin.TP 8
472119d2e3deSDmitry Chagin.B default:
472219d2e3deSDmitry ChaginLabels the default case in a
472319d2e3deSDmitry Chagin.Va switch
472419d2e3deSDmitry Chaginstatement.
472519d2e3deSDmitry ChaginIt should come after all
472619d2e3deSDmitry Chagin.Va case
472719d2e3deSDmitry Chaginlabels.
472819d2e3deSDmitry Chagin.Pp
472919d2e3deSDmitry Chagin.B dirs \fR[
473019d2e3deSDmitry Chagin.Fl l\fR] [
473119d2e3deSDmitry Chagin.Fl n\fR|
473219d2e3deSDmitry Chagin.Fl v\fR]
473319d2e3deSDmitry Chagin.br
473419d2e3deSDmitry Chagin.B dirs \-S\fR|
473519d2e3deSDmitry Chagin.Fl L \fR[
473619d2e3deSDmitry Chagin.Va filename
473719d2e3deSDmitry Chagin] (+)
473819d2e3deSDmitry Chagin.PD 0
473919d2e3deSDmitry Chagin.TP 8
474019d2e3deSDmitry Chagin.B dirs \-c \fR(+)
474119d2e3deSDmitry ChaginThe first form prints the directory stack.
474219d2e3deSDmitry ChaginThe top of the stack is at the
474319d2e3deSDmitry Chaginleft and the first directory in the stack is the current directory.
474419d2e3deSDmitry ChaginWith
474519d2e3deSDmitry Chagin.Fl l\fR,
474619d2e3deSDmitry Chagin.Sq ~
474719d2e3deSDmitry Chaginor
474819d2e3deSDmitry Chagin.Sq ~\fIname\fP
474919d2e3deSDmitry Chaginin the output is expanded explicitly
475019d2e3deSDmitry Chaginto
475119d2e3deSDmitry Chagin.Va home
475219d2e3deSDmitry Chaginor the pathname of the home directory for user \fIname\fP.
475319d2e3deSDmitry Chagin(+)
475419d2e3deSDmitry ChaginWith
475519d2e3deSDmitry Chagin.Fl n\fR, entries are wrapped before they reach the edge of the screen.
475619d2e3deSDmitry Chagin(+)
475719d2e3deSDmitry ChaginWith
475819d2e3deSDmitry Chagin.Fl v\fR, entries are printed one per line, preceded by their stack positions.
475919d2e3deSDmitry Chagin(+)
476019d2e3deSDmitry ChaginIf more than one of
476119d2e3deSDmitry Chagin.Fl n\fR or
476219d2e3deSDmitry Chagin.Fl v\fR is given,
476319d2e3deSDmitry Chagin.Fl v\fR takes precedence.
476419d2e3deSDmitry Chagin.Fl p\fR is accepted but does nothing.
476519d2e3deSDmitry Chagin.PD
476619d2e3deSDmitry Chagin.RS +8
476719d2e3deSDmitry Chagin.Pp
476819d2e3deSDmitry ChaginWith
476919d2e3deSDmitry Chagin.Fl S\fR, the second form saves the directory stack to
477019d2e3deSDmitry Chagin.Va filename
477119d2e3deSDmitry Chaginas a series of
477219d2e3deSDmitry Chagin.Va cd
477319d2e3deSDmitry Chaginand
477419d2e3deSDmitry Chagin.Va pushd
477519d2e3deSDmitry Chagincommands.
477619d2e3deSDmitry ChaginWith
477719d2e3deSDmitry Chagin.Fl L\fR, the shell sources
477819d2e3deSDmitry Chagin.Va filename
477919d2e3deSDmitry Chagin, which is presumably
478019d2e3deSDmitry Chagina directory stack file saved by the
478119d2e3deSDmitry Chagin.Fl S\fR option or the
478219d2e3deSDmitry Chagin.Va savedirs
478319d2e3deSDmitry Chaginmechanism.
478419d2e3deSDmitry ChaginIn either case,
478519d2e3deSDmitry Chagin.Va dirsfile
478619d2e3deSDmitry Chaginis used if
478719d2e3deSDmitry Chagin.Va filename
478819d2e3deSDmitry Chaginis not given and
478919d2e3deSDmitry Chagin.Va ~/.cshdirs
479019d2e3deSDmitry Chaginis used if
479119d2e3deSDmitry Chagin.Va dirsfile
479219d2e3deSDmitry Chaginis unset.
479319d2e3deSDmitry Chagin.Pp
479419d2e3deSDmitry ChaginNote that login shells do the equivalent of
479519d2e3deSDmitry Chagin.Sq dirs \-L
479619d2e3deSDmitry Chaginon startup
479719d2e3deSDmitry Chaginand, if
479819d2e3deSDmitry Chagin.Va savedirs
479919d2e3deSDmitry Chaginis set,
480019d2e3deSDmitry Chagin.Sq dirs \-S
480119d2e3deSDmitry Chaginbefore exiting.
480219d2e3deSDmitry ChaginBecause only
480319d2e3deSDmitry Chagin.Va ~/.tcshrc
480419d2e3deSDmitry Chaginis normally sourced before
480519d2e3deSDmitry Chagin.Va ~/.cshdirs
480619d2e3deSDmitry Chagin,
480719d2e3deSDmitry Chagin.Va dirsfile
480819d2e3deSDmitry Chaginshould be set in
480919d2e3deSDmitry Chagin.Va ~/.tcshrc
481019d2e3deSDmitry Chaginrather than
481119d2e3deSDmitry Chagin.Va ~/.login
481219d2e3deSDmitry Chagin.Pp
481319d2e3deSDmitry ChaginThe last form clears the directory stack.
481419d2e3deSDmitry Chagin.RE
481519d2e3deSDmitry Chagin.TP 8
481619d2e3deSDmitry Chagin.B echo \fR[
481719d2e3deSDmitry Chagin.Fl n\fR]
481819d2e3deSDmitry Chagin.Va word
481919d2e3deSDmitry Chagin...
482019d2e3deSDmitry ChaginWrites each
482119d2e3deSDmitry Chagin.Va word
482219d2e3deSDmitry Chaginto the shell's standard
482319d2e3deSDmitry Chaginoutput, separated by spaces and terminated with a newline.
482419d2e3deSDmitry ChaginThe
482519d2e3deSDmitry Chagin.Va echo_style
482619d2e3deSDmitry Chaginshell variable may be set to emulate (or not) the flags and escape
482719d2e3deSDmitry Chaginsequences of the BSD and/or System V versions of
482819d2e3deSDmitry Chagin.Va echo
482919d2e3deSDmitry Chagin; see
483019d2e3deSDmitry Chagin.Va echo
483119d2e3deSDmitry Chagin(1).
483219d2e3deSDmitry Chagin.TP 8
483319d2e3deSDmitry Chagin.B echotc \fR[
483419d2e3deSDmitry Chagin.Fl sv\fR]
483519d2e3deSDmitry Chagin.Va arg
483619d2e3deSDmitry Chagin... (+)
483719d2e3deSDmitry ChaginExercises the terminal capabilities (see
483819d2e3deSDmitry Chagin.Va termcap
483919d2e3deSDmitry Chagin(5)) in
484019d2e3deSDmitry Chagin.Va args
484119d2e3deSDmitry ChaginFor example, 'echotc home' sends the cursor to the home position,
484219d2e3deSDmitry Chagin\&'echotc cm 3 10' sends it to column 3 and row 10, and
484319d2e3deSDmitry Chagin\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
484419d2e3deSDmitry Chaginin the status line.
484519d2e3deSDmitry Chagin.RS +8
484619d2e3deSDmitry Chagin.Pp
484719d2e3deSDmitry ChaginIf
484819d2e3deSDmitry Chagin.Va arg
484919d2e3deSDmitry Chaginis 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
485019d2e3deSDmitry Chaginvalue of that capability ("yes" or "no" indicating that the terminal does
485119d2e3deSDmitry Chaginor does not have that capability).
485219d2e3deSDmitry ChaginOne might use this to make the output
485319d2e3deSDmitry Chaginfrom a shell script less verbose on slow terminals, or limit command
485419d2e3deSDmitry Chaginoutput to the number of lines on the screen:
485519d2e3deSDmitry Chagin.IP "" 4
485619d2e3deSDmitry Chagin> set history=\`echotc lines\`
485719d2e3deSDmitry Chagin.br
485819d2e3deSDmitry Chagin> @ history\-\-
485919d2e3deSDmitry Chagin.Pp
486019d2e3deSDmitry ChaginTermcap strings may contain wildcards which will not echo correctly.
486119d2e3deSDmitry ChaginOne should use double quotes when setting a shell variable to a terminal
486219d2e3deSDmitry Chagincapability string, as in the following example that places the date in
486319d2e3deSDmitry Chaginthe status line:
486419d2e3deSDmitry Chagin.IP "" 4
486519d2e3deSDmitry Chagin> set tosl="\`echotc ts 0\`"
486619d2e3deSDmitry Chagin.br
486719d2e3deSDmitry Chagin> set frsl="\`echotc fs\`"
486819d2e3deSDmitry Chagin.br
486919d2e3deSDmitry Chagin> echo \-n "$tosl";date; echo \-n "$frsl"
487019d2e3deSDmitry Chagin.Pp
487119d2e3deSDmitry ChaginWith
487219d2e3deSDmitry Chagin.Fl s\fR, nonexistent capabilities return the empty string rather
487319d2e3deSDmitry Chaginthan causing an error.
487419d2e3deSDmitry ChaginWith
487519d2e3deSDmitry Chagin.Fl v\fR, messages are verbose.
487619d2e3deSDmitry Chagin.RE
487719d2e3deSDmitry Chagin.Pp
487819d2e3deSDmitry Chagin.B else
487919d2e3deSDmitry Chagin.br
488019d2e3deSDmitry Chagin.B end
488119d2e3deSDmitry Chagin.br
488219d2e3deSDmitry Chagin.B endif
488319d2e3deSDmitry Chagin.PD 0
488419d2e3deSDmitry Chagin.TP 8
488519d2e3deSDmitry Chagin.B endsw
488619d2e3deSDmitry ChaginSee the description of the
488719d2e3deSDmitry Chagin.Va foreach
488819d2e3deSDmitry Chagin,
488919d2e3deSDmitry Chagin.Va if
489019d2e3deSDmitry Chagin,
489119d2e3deSDmitry Chagin.Va switch
489219d2e3deSDmitry Chagin, and
489319d2e3deSDmitry Chagin.Va while
489419d2e3deSDmitry Chaginstatements below.
489519d2e3deSDmitry Chagin.PD
489619d2e3deSDmitry Chagin.TP 8
489719d2e3deSDmitry Chagin.B eval
489819d2e3deSDmitry Chagin.Va arg
489919d2e3deSDmitry Chagin...
490019d2e3deSDmitry ChaginTreats the arguments as input to the
490119d2e3deSDmitry Chaginshell and executes the resulting command(s) in the context
490219d2e3deSDmitry Chaginof the current shell.
490319d2e3deSDmitry ChaginThis is usually used to execute commands
490419d2e3deSDmitry Chagingenerated as the result of command or variable substitution,
490519d2e3deSDmitry Chaginbecause parsing occurs before these substitutions.
490619d2e3deSDmitry ChaginSee
490719d2e3deSDmitry Chagin.Va tset
490819d2e3deSDmitry Chagin(1) for a sample use of
490919d2e3deSDmitry Chagin.Va eval
491019d2e3deSDmitry Chagin.TP 8
491119d2e3deSDmitry Chagin.B exec
491219d2e3deSDmitry Chagin.Va command
491319d2e3deSDmitry ChaginExecutes the specified command in place of the current shell.
491419d2e3deSDmitry Chagin.TP 8
491519d2e3deSDmitry Chagin.B exit \fR[
491619d2e3deSDmitry Chagin.Va expr
491719d2e3deSDmitry Chagin]
491819d2e3deSDmitry ChaginThe shell exits either with the value of the specified
491919d2e3deSDmitry Chagin.Va expr
492019d2e3deSDmitry Chagin(an expression, as described under
492119d2e3deSDmitry Chagin.Va Expressions
492219d2e3deSDmitry Chagin)
492319d2e3deSDmitry Chaginor, without
492419d2e3deSDmitry Chagin.Va expr
492519d2e3deSDmitry Chagin, with the value 0.
492619d2e3deSDmitry Chagin.TP 8
492719d2e3deSDmitry Chagin.B fg \fR[\fB%
492819d2e3deSDmitry Chagin.Va job
492919d2e3deSDmitry Chagin...]
493019d2e3deSDmitry ChaginBrings the specified jobs (or, without arguments, the current job)
493119d2e3deSDmitry Chagininto the foreground, continuing each if it is stopped.
493219d2e3deSDmitry Chagin.Va job
493319d2e3deSDmitry Chaginmay be a number, a string,
493419d2e3deSDmitry Chagin.Sq
493519d2e3deSDmitry Chagin,
493619d2e3deSDmitry Chagin.Sq %
493719d2e3deSDmitry Chagin,
493819d2e3deSDmitry Chagin.Sq +
493919d2e3deSDmitry Chaginor
494019d2e3deSDmitry Chagin.Sq \-
494119d2e3deSDmitry Chaginas described
494219d2e3deSDmitry Chaginunder
494319d2e3deSDmitry Chagin.Va Jobs
494419d2e3deSDmitry ChaginSee also the
494519d2e3deSDmitry Chagin.Va run-fg-editor
494619d2e3deSDmitry Chagineditor command.
494719d2e3deSDmitry Chagin.TP 8
494819d2e3deSDmitry Chagin.B filetest \-
494919d2e3deSDmitry Chagin.Va op file
495019d2e3deSDmitry Chagin... (+)
495119d2e3deSDmitry ChaginApplies
495219d2e3deSDmitry Chagin.Va op
495319d2e3deSDmitry Chagin(which is a file inquiry operator as described under
495419d2e3deSDmitry Chagin.Va File inquiry operators
495519d2e3deSDmitry Chagin) to each
495619d2e3deSDmitry Chagin.Va file
495719d2e3deSDmitry Chaginand returns the results as a
495819d2e3deSDmitry Chaginspace-separated list.
495919d2e3deSDmitry Chagin.Pp
496019d2e3deSDmitry Chagin.B foreach \fIname \fB(\fIwordlist\fB)
496119d2e3deSDmitry Chagin.br
496219d2e3deSDmitry Chagin\&...
496319d2e3deSDmitry Chagin.PD 0
496419d2e3deSDmitry Chagin.TP 8
496519d2e3deSDmitry Chagin.B end
496619d2e3deSDmitry ChaginSuccessively sets the variable
496719d2e3deSDmitry Chagin.Va name
496819d2e3deSDmitry Chaginto each member of
496919d2e3deSDmitry Chagin.Va wordlist
497019d2e3deSDmitry Chaginand executes the sequence of commands between this command
497119d2e3deSDmitry Chaginand the matching
497219d2e3deSDmitry Chagin.Va end
497319d2e3deSDmitry Chagin(Both
497419d2e3deSDmitry Chagin.Va foreach
497519d2e3deSDmitry Chaginand
497619d2e3deSDmitry Chagin.Va end
497719d2e3deSDmitry Chaginmust appear alone on separate lines.)  The builtin command
497819d2e3deSDmitry Chagin.Va continue
497919d2e3deSDmitry Chaginmay be used to continue the loop prematurely and
498019d2e3deSDmitry Chaginthe builtin command
498119d2e3deSDmitry Chagin.Va break
498219d2e3deSDmitry Chaginto terminate it prematurely.
498319d2e3deSDmitry ChaginWhen this command is read from the terminal, the loop is read once
498419d2e3deSDmitry Chaginprompting with
498519d2e3deSDmitry Chagin.Sq foreach?
498619d2e3deSDmitry Chagin(or
498719d2e3deSDmitry Chagin.Va prompt2
498819d2e3deSDmitry Chagin) before any statements in
498919d2e3deSDmitry Chaginthe loop are executed.
499019d2e3deSDmitry ChaginIf you make a mistake typing in a
499119d2e3deSDmitry Chaginloop at the terminal you can rub it out.
499219d2e3deSDmitry Chagin.PD
499319d2e3deSDmitry Chagin.TP 8
499419d2e3deSDmitry Chagin.B getspath \fR(+)
499519d2e3deSDmitry ChaginPrints the system execution path.
499619d2e3deSDmitry Chagin(TCF only)
499719d2e3deSDmitry Chagin.TP 8
499819d2e3deSDmitry Chagin.B getxvers \fR(+)
499919d2e3deSDmitry ChaginPrints the experimental version prefix.
500019d2e3deSDmitry Chagin(TCF only)
500119d2e3deSDmitry Chagin.TP 8
500219d2e3deSDmitry Chagin.B glob \fIwordlist
500319d2e3deSDmitry ChaginLike
500419d2e3deSDmitry Chagin.Va echo
500519d2e3deSDmitry Chagin, but the
500619d2e3deSDmitry Chagin.Sq -n
500719d2e3deSDmitry Chaginparameter is not recognized and words are
500819d2e3deSDmitry Chagindelimited by null characters in the output.
500919d2e3deSDmitry ChaginUseful for
501019d2e3deSDmitry Chaginprograms which wish to use the shell to filename expand a list of words.
501119d2e3deSDmitry Chagin.TP 8
501219d2e3deSDmitry Chagin.B goto \fIword
501319d2e3deSDmitry Chagin.Va word
501419d2e3deSDmitry Chaginis filename and command-substituted to
501519d2e3deSDmitry Chaginyield a string of the form
501619d2e3deSDmitry Chagin.Sq label
501719d2e3deSDmitry ChaginThe shell rewinds its
501819d2e3deSDmitry Chagininput as much as possible, searches for a line of the
501919d2e3deSDmitry Chaginform
502019d2e3deSDmitry Chagin.Sq label:
502119d2e3deSDmitry Chagin, possibly preceded by blanks or tabs, and
502219d2e3deSDmitry Chagincontinues execution after that line.
502319d2e3deSDmitry Chagin.TP 8
502419d2e3deSDmitry Chagin.B hashstat
502519d2e3deSDmitry ChaginPrints a statistics line indicating how effective the
502619d2e3deSDmitry Chagininternal hash table has been at locating commands (and avoiding
502719d2e3deSDmitry Chagin.Va exec
502819d2e3deSDmitry Chagin's).
502919d2e3deSDmitry ChaginAn
503019d2e3deSDmitry Chagin.Va exec
503119d2e3deSDmitry Chaginis attempted for each component of the
503219d2e3deSDmitry Chagin.Va path
503319d2e3deSDmitry Chaginwhere the hash function indicates a possible hit, and
503419d2e3deSDmitry Chaginin each component which does not begin with a
503519d2e3deSDmitry Chagin.Sq /
503619d2e3deSDmitry Chagin.IP
503719d2e3deSDmitry ChaginOn machines without
503819d2e3deSDmitry Chagin.Va vfork
503919d2e3deSDmitry Chagin(2), prints only the number and size of
504019d2e3deSDmitry Chaginhash buckets.
504119d2e3deSDmitry Chagin.Pp
504219d2e3deSDmitry Chagin.B history \fR[
504319d2e3deSDmitry Chagin.Fl hTr\fR] [
504419d2e3deSDmitry Chagin.Va n
504519d2e3deSDmitry Chagin]
504619d2e3deSDmitry Chagin.br
504719d2e3deSDmitry Chagin.B history \-S\fR|
504819d2e3deSDmitry Chagin.Fl L|
504919d2e3deSDmitry Chagin.Fl M \fR[
505019d2e3deSDmitry Chagin.Va filename
505119d2e3deSDmitry Chagin] (+)
505219d2e3deSDmitry Chagin.PD 0
505319d2e3deSDmitry Chagin.TP 8
505419d2e3deSDmitry Chagin.B history \-c \fR(+)
505519d2e3deSDmitry ChaginThe first form prints the history event list.
505619d2e3deSDmitry ChaginIf
505719d2e3deSDmitry Chagin.Va n
505819d2e3deSDmitry Chaginis given only the
505919d2e3deSDmitry Chagin.Va n
506019d2e3deSDmitry Chaginmost recent events are printed or saved.
506119d2e3deSDmitry ChaginWith
506219d2e3deSDmitry Chagin.Fl h\fR, the history list is printed without leading numbers.
506319d2e3deSDmitry ChaginIf
506419d2e3deSDmitry Chagin.Va -T
506519d2e3deSDmitry Chaginis specified, timestamps are printed also in comment form.
506619d2e3deSDmitry Chagin(This can be used to
506719d2e3deSDmitry Chaginproduce files suitable for loading with 'history \-L' or 'source \-h'.)
506819d2e3deSDmitry ChaginWith
506919d2e3deSDmitry Chagin.Fl r\fR, the order of printing is most recent
507019d2e3deSDmitry Chaginfirst rather than oldest first.
507119d2e3deSDmitry Chagin.PD
507219d2e3deSDmitry Chagin.RS +8
507319d2e3deSDmitry Chagin.Pp
507419d2e3deSDmitry ChaginWith
507519d2e3deSDmitry Chagin.Fl S\fR, the second form saves the history list to
507619d2e3deSDmitry Chagin.Va filename
507719d2e3deSDmitry ChaginIf the first word of the
507819d2e3deSDmitry Chagin.Va savehist
507919d2e3deSDmitry Chaginshell variable is set to a
508019d2e3deSDmitry Chaginnumber, at most that many lines are saved.
508119d2e3deSDmitry ChaginIf the second word of
508219d2e3deSDmitry Chagin.Va savehist
508319d2e3deSDmitry Chaginis set to
508419d2e3deSDmitry Chagin.Sq merge
508519d2e3deSDmitry Chagin, the history list is merged with the
508619d2e3deSDmitry Chaginexisting history file instead of replacing it (if there is one) and
508719d2e3deSDmitry Chaginsorted by time stamp.
508819d2e3deSDmitry Chagin(+) Merging is intended for an environment like
508919d2e3deSDmitry Chaginthe X Window System
509019d2e3deSDmitry Chaginwith several shells in simultaneous use.
509119d2e3deSDmitry ChaginIf the second word of
509219d2e3deSDmitry Chagin.Va savehist
509319d2e3deSDmitry Chaginis
509419d2e3deSDmitry Chagin.Sq merge
509519d2e3deSDmitry Chaginand the third word is set to
509619d2e3deSDmitry Chagin.Sq lock
509719d2e3deSDmitry Chagin, the history file update
509819d2e3deSDmitry Chaginwill be serialized with other shell sessions that would possibly like
509919d2e3deSDmitry Chaginto merge history at exactly the same time.
510019d2e3deSDmitry Chagin.Pp
510119d2e3deSDmitry ChaginWith
510219d2e3deSDmitry Chagin.Fl L\fR, the shell appends
510319d2e3deSDmitry Chagin.Va filename
510419d2e3deSDmitry Chagin, which is presumably a
510519d2e3deSDmitry Chaginhistory list saved by the
510619d2e3deSDmitry Chagin.Fl S\fR option or the
510719d2e3deSDmitry Chagin.Va savehist
510819d2e3deSDmitry Chaginmechanism,
510919d2e3deSDmitry Chaginto the history list.
511019d2e3deSDmitry Chagin.Fl M\fR is like
511119d2e3deSDmitry Chagin.Fl L\fR, but the contents of
511219d2e3deSDmitry Chagin.Va filename
511319d2e3deSDmitry Chaginare merged
511419d2e3deSDmitry Chagininto the history list and sorted by timestamp.
511519d2e3deSDmitry ChaginIn either case,
511619d2e3deSDmitry Chagin.Va histfile
511719d2e3deSDmitry Chaginis used if
511819d2e3deSDmitry Chagin.Va filename
511919d2e3deSDmitry Chaginis not given and
512019d2e3deSDmitry Chagin.Va ~/.history
512119d2e3deSDmitry Chaginis used if
512219d2e3deSDmitry Chagin.Va histfile
512319d2e3deSDmitry Chaginis unset.
512419d2e3deSDmitry Chagin`history \-L' is exactly like 'source \-h' except that it does not require a
512519d2e3deSDmitry Chaginfilename.
512619d2e3deSDmitry Chagin.Pp
512719d2e3deSDmitry ChaginNote that login shells do the equivalent of
512819d2e3deSDmitry Chagin.Sq history \-L
512919d2e3deSDmitry Chaginon startup
513019d2e3deSDmitry Chaginand, if
513119d2e3deSDmitry Chagin.Va savehist
513219d2e3deSDmitry Chaginis set,
513319d2e3deSDmitry Chagin.Sq history \-S
513419d2e3deSDmitry Chaginbefore exiting.
513519d2e3deSDmitry ChaginBecause only
513619d2e3deSDmitry Chagin.Va ~/.tcshrc
513719d2e3deSDmitry Chaginis normally sourced before
513819d2e3deSDmitry Chagin.Va ~/.history
513919d2e3deSDmitry Chagin,
514019d2e3deSDmitry Chagin.Va histfile
514119d2e3deSDmitry Chaginshould be set in
514219d2e3deSDmitry Chagin.Va ~/.tcshrc
514319d2e3deSDmitry Chaginrather than
514419d2e3deSDmitry Chagin.Va ~/.login
514519d2e3deSDmitry Chagin.Pp
514619d2e3deSDmitry ChaginIf
514719d2e3deSDmitry Chagin.Va histlit
514819d2e3deSDmitry Chaginis set, the first and second forms print and save the literal
514919d2e3deSDmitry Chagin(unexpanded) form of the history list.
515019d2e3deSDmitry Chagin.Pp
515119d2e3deSDmitry ChaginThe last form clears the history list.
515219d2e3deSDmitry Chagin.RE
515319d2e3deSDmitry Chagin.TP 8
515419d2e3deSDmitry Chagin.B hup \fR[
515519d2e3deSDmitry Chagin.Va command
515619d2e3deSDmitry Chagin] \fR(+)
515719d2e3deSDmitry ChaginWith
515819d2e3deSDmitry Chagin.Va command
515919d2e3deSDmitry Chagin, runs
516019d2e3deSDmitry Chagin.Va command
516119d2e3deSDmitry Chaginsuch that it will exit on a hangup
516219d2e3deSDmitry Chaginsignal and arranges for the shell to send it a hangup signal when the shell
516319d2e3deSDmitry Chaginexits.
516419d2e3deSDmitry ChaginNote that commands may set their own response to hangups, overriding
516519d2e3deSDmitry Chagin.Va hup
516619d2e3deSDmitry ChaginWithout an argument, causes the non-interactive shell only to
516719d2e3deSDmitry Chaginexit on a hangup for the remainder of the script.
516819d2e3deSDmitry ChaginSee also
516919d2e3deSDmitry Chagin.Va Signal handling
517019d2e3deSDmitry Chaginand the
517119d2e3deSDmitry Chagin.Va nohup
517219d2e3deSDmitry Chaginbuiltin command.
517319d2e3deSDmitry Chagin.TP 8
517419d2e3deSDmitry Chagin.B if (\fIexpr\fB) \fIcommand
517519d2e3deSDmitry ChaginIf
517619d2e3deSDmitry Chagin.Va expr
517719d2e3deSDmitry Chagin(an expression, as described under
517819d2e3deSDmitry Chagin.Va Expressions
517919d2e3deSDmitry Chagin)
518019d2e3deSDmitry Chaginevaluates true, then
518119d2e3deSDmitry Chagin.Va command
518219d2e3deSDmitry Chaginis executed.
518319d2e3deSDmitry ChaginVariable substitution on
518419d2e3deSDmitry Chagin.Va command
518519d2e3deSDmitry Chaginhappens early, at the same time it
518619d2e3deSDmitry Chagindoes for the rest of the
518719d2e3deSDmitry Chagin.Va if
518819d2e3deSDmitry Chagincommand.
518919d2e3deSDmitry Chagin.Va command
519019d2e3deSDmitry Chaginmust be a simple command, not an alias, a pipeline, a command list
519119d2e3deSDmitry Chaginor a parenthesized command list, but it may have arguments.
519219d2e3deSDmitry ChaginInput/output redirection occurs even if
519319d2e3deSDmitry Chagin.Va expr
519419d2e3deSDmitry Chaginis
519519d2e3deSDmitry Chaginfalse and
519619d2e3deSDmitry Chagin.Va command
519719d2e3deSDmitry Chaginis thus
519819d2e3deSDmitry Chagin.Va not
519919d2e3deSDmitry Chaginexecuted; this is a bug.
520019d2e3deSDmitry Chagin.Pp
520119d2e3deSDmitry Chagin.B if (\fIexpr\fB) then
520219d2e3deSDmitry Chagin.br
520319d2e3deSDmitry Chagin\&...
520419d2e3deSDmitry Chagin.br
520519d2e3deSDmitry Chagin.B else if (\fIexpr2\fB) then
520619d2e3deSDmitry Chagin.br
520719d2e3deSDmitry Chagin\&...
520819d2e3deSDmitry Chagin.br
520919d2e3deSDmitry Chagin.B else
521019d2e3deSDmitry Chagin.br
521119d2e3deSDmitry Chagin\&...
521219d2e3deSDmitry Chagin.PD 0
521319d2e3deSDmitry Chagin.TP 8
521419d2e3deSDmitry Chagin.B endif
521519d2e3deSDmitry ChaginIf the specified
521619d2e3deSDmitry Chagin.Va expr
521719d2e3deSDmitry Chaginis true then the commands to the
521819d2e3deSDmitry Chaginfirst
521919d2e3deSDmitry Chagin.Va else
522019d2e3deSDmitry Chaginare executed; otherwise if
522119d2e3deSDmitry Chagin.Va expr2
522219d2e3deSDmitry Chaginis true then
522319d2e3deSDmitry Chaginthe commands to the second
522419d2e3deSDmitry Chagin.Va else
522519d2e3deSDmitry Chaginare executed, etc.
522619d2e3deSDmitry ChaginAny
522719d2e3deSDmitry Chaginnumber of
522819d2e3deSDmitry Chagin.Va else-if
522919d2e3deSDmitry Chaginpairs are possible; only one
523019d2e3deSDmitry Chagin.Va endif
523119d2e3deSDmitry Chaginis
523219d2e3deSDmitry Chaginneeded.
523319d2e3deSDmitry ChaginThe
523419d2e3deSDmitry Chagin.Va else
523519d2e3deSDmitry Chaginpart is likewise optional.
523619d2e3deSDmitry Chagin(The words
523719d2e3deSDmitry Chagin.Va else
523819d2e3deSDmitry Chaginand
523919d2e3deSDmitry Chagin.Va endif
524019d2e3deSDmitry Chaginmust appear at the beginning of input lines;
524119d2e3deSDmitry Chaginthe
524219d2e3deSDmitry Chagin.Va if
524319d2e3deSDmitry Chaginmust appear alone on its input line or after an
524419d2e3deSDmitry Chagin.Va else
524519d2e3deSDmitry Chagin.)
524619d2e3deSDmitry Chagin.PD
524719d2e3deSDmitry Chagin.TP 8
524819d2e3deSDmitry Chagin.B inlib
524919d2e3deSDmitry Chagin.Va shared-library
525019d2e3deSDmitry Chagin... (+)
525119d2e3deSDmitry ChaginAdds each
525219d2e3deSDmitry Chagin.Va shared-library
525319d2e3deSDmitry Chaginto the current environment.
525419d2e3deSDmitry ChaginThere is no way
525519d2e3deSDmitry Chaginto remove a shared library.
525619d2e3deSDmitry Chagin(Domain/OS only)
525719d2e3deSDmitry Chagin.TP 8
525819d2e3deSDmitry Chagin.B jobs \fR[
525919d2e3deSDmitry Chagin.Fl l\fR]
526019d2e3deSDmitry ChaginLists the active jobs.
526119d2e3deSDmitry ChaginWith
526219d2e3deSDmitry Chagin.Fl l\fR, lists process
526319d2e3deSDmitry ChaginIDs in addition to the normal information.
526419d2e3deSDmitry ChaginOn TCF systems, prints
526519d2e3deSDmitry Chaginthe site on which each job is executing.
526619d2e3deSDmitry Chagin.Pp
526719d2e3deSDmitry Chagin.PD 0
526819d2e3deSDmitry Chagin.TP 8
526919d2e3deSDmitry Chagin.B kill \fR[
527019d2e3deSDmitry Chagin.Fl s
527119d2e3deSDmitry Chagin.Va signal
527219d2e3deSDmitry Chagin] \fB%
527319d2e3deSDmitry Chagin.Va job
527419d2e3deSDmitry Chagin|
527519d2e3deSDmitry Chagin.Va pid
527619d2e3deSDmitry Chagin...
527719d2e3deSDmitry Chagin.PD 0
527819d2e3deSDmitry Chagin.TP 8
527919d2e3deSDmitry Chagin.B kill \-l
528019d2e3deSDmitry ChaginThe first and second forms sends the specified
528119d2e3deSDmitry Chagin.Va signal
528219d2e3deSDmitry Chagin(or, if none
528319d2e3deSDmitry Chaginis given, the TERM (terminate) signal) to the specified jobs or processes.
528419d2e3deSDmitry Chagin.Va job
528519d2e3deSDmitry Chaginmay be a number, a string,
528619d2e3deSDmitry Chagin.Sq
528719d2e3deSDmitry Chagin,
528819d2e3deSDmitry Chagin.Sq %
528919d2e3deSDmitry Chagin,
529019d2e3deSDmitry Chagin.Sq +
529119d2e3deSDmitry Chaginor
529219d2e3deSDmitry Chagin.Sq \-
529319d2e3deSDmitry Chaginas described
529419d2e3deSDmitry Chaginunder
529519d2e3deSDmitry Chagin.Va Jobs
529619d2e3deSDmitry ChaginSignals are either given by number or by name (as given in
529719d2e3deSDmitry Chagin.Va /usr/include/signal.h
529819d2e3deSDmitry Chagin, stripped of the prefix
529919d2e3deSDmitry Chagin.Sq SIG
530019d2e3deSDmitry Chagin).
530119d2e3deSDmitry ChaginThere is no default
530219d2e3deSDmitry Chagin.Va job
530319d2e3deSDmitry Chagin; saying just
530419d2e3deSDmitry Chagin.Sq kill
530519d2e3deSDmitry Chagindoes not send a signal
530619d2e3deSDmitry Chaginto the current job.
530719d2e3deSDmitry ChaginIf the signal being sent is TERM (terminate)
530819d2e3deSDmitry Chaginor HUP (hangup), then the job or process is sent a
530919d2e3deSDmitry ChaginCONT (continue) signal as well.
531019d2e3deSDmitry ChaginThe third form lists the signal names.
531119d2e3deSDmitry Chagin.PD
531219d2e3deSDmitry Chagin.TP 8
531319d2e3deSDmitry Chagin.B limit \fR[
531419d2e3deSDmitry Chagin.Fl h\fR] [
531519d2e3deSDmitry Chagin.Va resource
531619d2e3deSDmitry Chagin[
531719d2e3deSDmitry Chagin.Va maximum-use
531819d2e3deSDmitry Chagin]]
531919d2e3deSDmitry ChaginLimits the consumption by the current process and each
532019d2e3deSDmitry Chaginprocess it creates to not individually exceed
532119d2e3deSDmitry Chagin.Va maximum-use
532219d2e3deSDmitry Chaginon
532319d2e3deSDmitry Chaginthe specified
532419d2e3deSDmitry Chagin.Va resource
532519d2e3deSDmitry ChaginIf no
532619d2e3deSDmitry Chagin.Va maximum-use
532719d2e3deSDmitry Chaginis given, then
532819d2e3deSDmitry Chaginthe current limit is printed; if no
532919d2e3deSDmitry Chagin.Va resource
533019d2e3deSDmitry Chaginis given, then
533119d2e3deSDmitry Chaginall limitations are given.
533219d2e3deSDmitry ChaginIf the
533319d2e3deSDmitry Chagin.Fl h\fR flag is given, the
533419d2e3deSDmitry Chaginhard limits are used instead of the current limits.
533519d2e3deSDmitry ChaginThe
533619d2e3deSDmitry Chaginhard limits impose a ceiling on the values of the current
533719d2e3deSDmitry Chaginlimits.
533819d2e3deSDmitry ChaginOnly the super-user may raise the hard limits, but
533919d2e3deSDmitry Chagina user may lower or raise the current limits within the legal range.
534019d2e3deSDmitry Chagin.Pp
534119d2e3deSDmitry ChaginControllable resources currently include (if supported by the OS):
534219d2e3deSDmitry Chagin.Bl -tag -width pseudoterminals -compact -offset indent
534319d2e3deSDmitry Chagin.It Va cputime
534419d2e3deSDmitry Chaginthe maximum number of cpu-seconds to be used by each process
534519d2e3deSDmitry Chagin.It Va filesize
534619d2e3deSDmitry Chaginthe largest single file which can be created
534719d2e3deSDmitry Chagin.It Va datasize
534819d2e3deSDmitry Chaginthe maximum growth of the data+stack region via sbrk(2) beyond
534919d2e3deSDmitry Chaginthe end of the program text
535019d2e3deSDmitry Chagin.It Va stacksize
535119d2e3deSDmitry Chaginthe maximum size of the automatically-extended stack region
535219d2e3deSDmitry Chagin.It Va coredumpsize
535319d2e3deSDmitry Chaginthe size of the largest core dump that will be created
535419d2e3deSDmitry Chagin.It Va memoryuse
535519d2e3deSDmitry Chaginthe maximum amount of physical memory a process
535619d2e3deSDmitry Chaginmay have allocated to it at a given time
535719d2e3deSDmitry Chagin.It Va vmemoryuse
535819d2e3deSDmitry Chaginthe maximum amount of virtual memory a process
535919d2e3deSDmitry Chaginmay have allocated to it at a given time (address space)
536019d2e3deSDmitry Chagin.It Va vmemoryuse
536119d2e3deSDmitry Chaginthe maximum amount of virtual memory a process
536219d2e3deSDmitry Chaginmay have allocated to it at a given time
536319d2e3deSDmitry Chagin.It Va heapsize
536419d2e3deSDmitry Chaginthe maximum amount of memory a process
536519d2e3deSDmitry Chaginmay allocate per
536619d2e3deSDmitry Chagin.Xr brk 2
536719d2e3deSDmitry Chaginsystem call
536819d2e3deSDmitry Chagin.It Va descriptors
536919d2e3deSDmitry Chaginor
537019d2e3deSDmitry Chagin.It Va openfiles
537119d2e3deSDmitry Chaginthe maximum number of open files for this process
537219d2e3deSDmitry Chagin.It Va pseudoterminals
537319d2e3deSDmitry Chaginthe maximum number of pseudo-terminals for this user
537419d2e3deSDmitry Chagin.It Va kqueues
537519d2e3deSDmitry Chaginthe maximum number of kqueues allocated for this process
537619d2e3deSDmitry Chagin.It Va concurrency
537719d2e3deSDmitry Chaginthe maximum number of threads for this process
537819d2e3deSDmitry Chagin.It Va memorylocked
537919d2e3deSDmitry Chaginthe maximum size which a process may lock into memory using mlock(2)
538019d2e3deSDmitry Chagin.It Va maxproc
538119d2e3deSDmitry Chaginthe maximum number of simultaneous processes for this user id
538219d2e3deSDmitry Chagin.It Va maxthread
538319d2e3deSDmitry Chaginthe maximum number of simultaneous threads (lightweight processes) for this
538419d2e3deSDmitry Chaginuser id
538519d2e3deSDmitry Chagin.It Va threads
538619d2e3deSDmitry Chaginthe maximum number of threads for this process
538719d2e3deSDmitry Chagin.It Va sbsize
538819d2e3deSDmitry Chaginthe maximum size of socket buffer usage for this user
538919d2e3deSDmitry Chagin.It Va swapsize
539019d2e3deSDmitry Chaginthe maximum amount of swap space reserved or used for this user
539119d2e3deSDmitry Chagin.It Va maxlocks
539219d2e3deSDmitry Chaginthe maximum number of locks for this user
539319d2e3deSDmitry Chagin.It Va posixlocks
539419d2e3deSDmitry Chaginthe maximum number of POSIX advisory locks for this user
539519d2e3deSDmitry Chagin.It Va maxsignal
539619d2e3deSDmitry Chaginthe maximum number of pending signals for this user
539719d2e3deSDmitry Chagin.It Va maxmessage
539819d2e3deSDmitry Chaginthe maximum number of bytes in POSIX mqueues for this user
539919d2e3deSDmitry Chagin.It Va maxnice
540019d2e3deSDmitry Chaginthe maximum nice priority the user is allowed to raise mapped from [19...-20]
540119d2e3deSDmitry Chaginto [0...39] for this user
540219d2e3deSDmitry Chagin.It Va maxrtprio
540319d2e3deSDmitry Chaginthe maximum realtime priority for this user
540419d2e3deSDmitry Chagin.It Va maxrttime
540519d2e3deSDmitry Chaginthe timeout for RT tasks in microseconds for this user.
540619d2e3deSDmitry Chagin.El
540719d2e3deSDmitry Chagin.Pp
540819d2e3deSDmitry Chagin.Va maximum-use
540919d2e3deSDmitry Chaginmay be given as a (floating point or
541019d2e3deSDmitry Chagininteger) number followed by a scale factor.
541119d2e3deSDmitry ChaginFor all limits
541219d2e3deSDmitry Chaginother than
541319d2e3deSDmitry Chagin.Va cputime
541419d2e3deSDmitry Chaginthe default scale is
541519d2e3deSDmitry Chagin.Sq k
541619d2e3deSDmitry Chaginor
541719d2e3deSDmitry Chagin.Sq kilobytes
541819d2e3deSDmitry Chagin(1024 bytes); a scale factor of
541919d2e3deSDmitry Chagin.Sq m
542019d2e3deSDmitry Chaginor
542119d2e3deSDmitry Chagin.Sq megabytes
542219d2e3deSDmitry Chaginor
542319d2e3deSDmitry Chagin.Sq g
542419d2e3deSDmitry Chaginor
542519d2e3deSDmitry Chagin.Sq gigabytes
542619d2e3deSDmitry Chaginmay also be used.
542719d2e3deSDmitry ChaginFor
542819d2e3deSDmitry Chagin.Va cputime
542919d2e3deSDmitry Chaginthe default scaling is
543019d2e3deSDmitry Chagin.Sq seconds ,
543119d2e3deSDmitry Chaginwhile
543219d2e3deSDmitry Chagin.Sq m
543319d2e3deSDmitry Chaginfor minutes or
543419d2e3deSDmitry Chagin.Sq h
543519d2e3deSDmitry Chaginfor hours, or a time of the
543619d2e3deSDmitry Chaginform
543719d2e3deSDmitry Chagin.Sq mm:ss
543819d2e3deSDmitry Chagingiving minutes and seconds may be used.
543919d2e3deSDmitry Chagin.Pp
544019d2e3deSDmitry ChaginIf
544119d2e3deSDmitry Chagin.Va maximum-use
544219d2e3deSDmitry Chaginis
544319d2e3deSDmitry Chagin.Sq unlimited ,
544419d2e3deSDmitry Chaginthen the limitation on the specified
544519d2e3deSDmitry Chagin.Va resource
544619d2e3deSDmitry Chaginis removed (this is equivalent to the
544719d2e3deSDmitry Chagin.Va unlimit
544819d2e3deSDmitry Chaginbuiltin command).
544919d2e3deSDmitry Chagin.Pp
545019d2e3deSDmitry ChaginFor both
545119d2e3deSDmitry Chagin.Va resource
545219d2e3deSDmitry Chaginnames and scale factors, unambiguous
545319d2e3deSDmitry Chaginprefixes of the names suffice.
545419d2e3deSDmitry Chagin.RE
545519d2e3deSDmitry Chagin.TP 8
545619d2e3deSDmitry Chagin.B log \fR(+)
545719d2e3deSDmitry ChaginPrints the
545819d2e3deSDmitry Chagin.Va watch
545919d2e3deSDmitry Chaginshell variable and reports on each user indicated
546019d2e3deSDmitry Chaginin
546119d2e3deSDmitry Chagin.Va watch
546219d2e3deSDmitry Chaginwho is logged in, regardless of when they last logged in.
546319d2e3deSDmitry ChaginSee also
546419d2e3deSDmitry Chagin.Va watchlog
546519d2e3deSDmitry Chagin.TP 8
546619d2e3deSDmitry Chagin.B login
546719d2e3deSDmitry ChaginTerminates a login shell, replacing it with an instance of
546819d2e3deSDmitry Chagin.Va /bin/login
546919d2e3deSDmitry Chagin. This is one way to log off, included for
547019d2e3deSDmitry Chagincompatibility with
547119d2e3deSDmitry Chagin.Xr sh 1 .
547219d2e3deSDmitry Chagin.TP 8
547319d2e3deSDmitry Chagin.B logout
547419d2e3deSDmitry ChaginTerminates a login shell.
547519d2e3deSDmitry ChaginEspecially useful if
547619d2e3deSDmitry Chagin.Va ignoreeof
547719d2e3deSDmitry Chaginis set.
547819d2e3deSDmitry Chagin.TP 8
547919d2e3deSDmitry Chagin.B ls\-F \fR[\-
548019d2e3deSDmitry Chagin.Va switch
548119d2e3deSDmitry Chagin...] [
548219d2e3deSDmitry Chagin.Va file
548319d2e3deSDmitry Chagin...] (+)
548419d2e3deSDmitry ChaginLists files like
548519d2e3deSDmitry Chagin.Sq ls \-F
548619d2e3deSDmitry Chagin, but much faster.
548719d2e3deSDmitry ChaginIt identifies each type of
548819d2e3deSDmitry Chaginspecial file in the listing with a special character:
548919d2e3deSDmitry Chagin.Bl -tag -width x -offset indent -compact
549019d2e3deSDmitry Chagin.It Dv /
549119d2e3deSDmitry ChaginDirectory
549219d2e3deSDmitry Chagin.It Dv *
549319d2e3deSDmitry ChaginExecutable
549419d2e3deSDmitry Chagin.It Dv #
549519d2e3deSDmitry ChaginBlock device
549619d2e3deSDmitry Chagin.It Dv %
549719d2e3deSDmitry ChaginCharacter device
549819d2e3deSDmitry Chagin.It Dv |
549919d2e3deSDmitry ChaginNamed pipe (systems with named pipes only)
550019d2e3deSDmitry Chagin.It Dv =
550119d2e3deSDmitry ChaginSocket (systems with sockets only)
550219d2e3deSDmitry Chagin.It Dv @
550319d2e3deSDmitry ChaginSymbolic link (systems with symbolic links only)
550419d2e3deSDmitry Chagin.It Dv +
550519d2e3deSDmitry ChaginHidden directory (AIX only) or context dependent (HP/UX only)
550619d2e3deSDmitry Chagin.It Dv :
550719d2e3deSDmitry ChaginNetwork special (HP/UX only)
550819d2e3deSDmitry Chagin.El
550919d2e3deSDmitry Chagin.Pp
551019d2e3deSDmitry ChaginIf the
551119d2e3deSDmitry Chagin.Va listlinks
551219d2e3deSDmitry Chaginshell variable is set, symbolic links are identified
551319d2e3deSDmitry Chaginin more detail (on only systems that have them, of course):
551419d2e3deSDmitry Chagin.Pp
551519d2e3deSDmitry Chagin.PD 0
551619d2e3deSDmitry Chagin.TP 4
551719d2e3deSDmitry Chagin@
551819d2e3deSDmitry ChaginSymbolic link to a non-directory
551919d2e3deSDmitry Chagin.TP 4
552019d2e3deSDmitry Chagin>
552119d2e3deSDmitry ChaginSymbolic link to a directory
552219d2e3deSDmitry Chagin.TP 4
552319d2e3deSDmitry Chagin&
552419d2e3deSDmitry ChaginSymbolic link to nowhere
552519d2e3deSDmitry Chagin.PD
552619d2e3deSDmitry Chagin.Pp
552719d2e3deSDmitry Chagin.Va listlinks
552819d2e3deSDmitry Chaginalso slows down \fIls\-F\fR and causes partitions holding
552919d2e3deSDmitry Chaginfiles pointed to by symbolic links to be mounted.
553019d2e3deSDmitry Chagin.Pp
553119d2e3deSDmitry ChaginIf the
553219d2e3deSDmitry Chagin.Va listflags
553319d2e3deSDmitry Chaginshell variable is set to
553419d2e3deSDmitry Chagin.Sq x
553519d2e3deSDmitry Chagin,
553619d2e3deSDmitry Chagin.Sq a
553719d2e3deSDmitry Chaginor
553819d2e3deSDmitry Chagin.Sq A
553919d2e3deSDmitry Chagin, or any
554019d2e3deSDmitry Chagincombination thereof (e.g.,
554119d2e3deSDmitry Chagin.Sq xA
554219d2e3deSDmitry Chagin), they are used as flags to \fIls\-F\fR,
554319d2e3deSDmitry Chaginmaking it act like
554419d2e3deSDmitry Chagin.Sq ls \-xF
554519d2e3deSDmitry Chagin,
554619d2e3deSDmitry Chagin.Sq ls \-Fa
554719d2e3deSDmitry Chagin,
554819d2e3deSDmitry Chagin.Sq ls \-FA
554919d2e3deSDmitry Chaginor a combination
555019d2e3deSDmitry Chagin(e.g.,
555119d2e3deSDmitry Chagin.Sq ls \-FxA
555219d2e3deSDmitry Chagin).
555319d2e3deSDmitry ChaginOn machines where
555419d2e3deSDmitry Chagin.Sq ls \-C
555519d2e3deSDmitry Chaginis not the default, \fIls\-F\fR acts like
555619d2e3deSDmitry Chagin.Sq ls \-CF
555719d2e3deSDmitry Chagin,
555819d2e3deSDmitry Chaginunless
555919d2e3deSDmitry Chagin.Va listflags
556019d2e3deSDmitry Chagincontains an
556119d2e3deSDmitry Chagin.Sq x
556219d2e3deSDmitry Chagin, in which case it acts like
556319d2e3deSDmitry Chagin.Sq ls \-xF
556419d2e3deSDmitry Chagin\fIls\-F\fR passes its arguments to
556519d2e3deSDmitry Chagin.Va ls
556619d2e3deSDmitry Chagin(1) if it is given any switches,
556719d2e3deSDmitry Chaginso
556819d2e3deSDmitry Chagin.Sq alias ls ls\-F
556919d2e3deSDmitry Chagingenerally does the right thing.
557019d2e3deSDmitry Chagin.Pp
557119d2e3deSDmitry ChaginThe \fBls\-F\fR builtin can list files using different colors depending on the
557219d2e3deSDmitry Chaginfiletype or extension.
557319d2e3deSDmitry ChaginSee the
557419d2e3deSDmitry Chagin.Va color
557519d2e3deSDmitry Chaginshell variable and the
557619d2e3deSDmitry Chagin.Va LS_COLORS
557719d2e3deSDmitry Chaginenvironment variable.
557819d2e3deSDmitry Chagin.RE
557919d2e3deSDmitry Chagin.Pp
558019d2e3deSDmitry Chagin.B migrate \fR[
558119d2e3deSDmitry Chagin.Fl
558219d2e3deSDmitry Chagin.Va site
558319d2e3deSDmitry Chagin]
558419d2e3deSDmitry Chagin.Va pid
558519d2e3deSDmitry Chagin|\fB%
558619d2e3deSDmitry Chagin.Va jobid
558719d2e3deSDmitry Chagin... (+)
558819d2e3deSDmitry Chagin.PD 0
558919d2e3deSDmitry Chagin.TP 8
559019d2e3deSDmitry Chagin.B migrate \-
559119d2e3deSDmitry Chagin.Va site
559219d2e3deSDmitry Chagin(+)
559319d2e3deSDmitry ChaginThe first form migrates the process or job to the site specified or the
559419d2e3deSDmitry Chagindefault site determined by the system path.
559519d2e3deSDmitry ChaginThe second form is equivalent to
559619d2e3deSDmitry Chagin.Sq migrate \-
559719d2e3deSDmitry Chagin.Va site
559819d2e3deSDmitry Chagin$$
559919d2e3deSDmitry Chagin: it migrates the
560019d2e3deSDmitry Chagincurrent process to the specified site.
560119d2e3deSDmitry ChaginMigrating the shell
560219d2e3deSDmitry Chaginitself can cause unexpected behavior, because the shell
560319d2e3deSDmitry Chagindoes not like to lose its tty.
560419d2e3deSDmitry Chagin(TCF only)
560519d2e3deSDmitry Chagin.PD
560619d2e3deSDmitry Chagin.TP 8
560719d2e3deSDmitry Chagin.B newgrp \fR[
560819d2e3deSDmitry Chagin.Fl \fR]
560919d2e3deSDmitry Chagin.Va [group]
561019d2e3deSDmitry Chagin(+)
561119d2e3deSDmitry ChaginEquivalent to
561219d2e3deSDmitry Chagin.Sq exec newgrp
561319d2e3deSDmitry Chagin; see
561419d2e3deSDmitry Chagin.Va newgrp
561519d2e3deSDmitry Chagin(1).
561619d2e3deSDmitry ChaginAvailable only if the shell was so compiled;
561719d2e3deSDmitry Chaginsee the
561819d2e3deSDmitry Chagin.Va version
561919d2e3deSDmitry Chaginshell variable.
562019d2e3deSDmitry Chagin.TP 8
562119d2e3deSDmitry Chagin.B nice \fR[\fB+
562219d2e3deSDmitry Chagin.Va number
562319d2e3deSDmitry Chagin] [
562419d2e3deSDmitry Chagin.Va command
562519d2e3deSDmitry Chagin]
562619d2e3deSDmitry ChaginSets the scheduling priority for the shell to
562719d2e3deSDmitry Chagin.Va number
562819d2e3deSDmitry Chagin, or, without
562919d2e3deSDmitry Chagin.Va number
563019d2e3deSDmitry Chagin, to 4.
563119d2e3deSDmitry ChaginWith
563219d2e3deSDmitry Chagin.Va command ,
563319d2e3deSDmitry Chaginruns
563419d2e3deSDmitry Chagin.Va command
563519d2e3deSDmitry Chaginat the appropriate
563619d2e3deSDmitry Chaginpriority.
563719d2e3deSDmitry ChaginThe greater the
563819d2e3deSDmitry Chagin.Va number
563919d2e3deSDmitry Chagin, the less cpu
564019d2e3deSDmitry Chaginthe process gets.
564119d2e3deSDmitry ChaginThe super-user may specify negative
564219d2e3deSDmitry Chaginpriority by using
564319d2e3deSDmitry Chagin.Sq nice \-number ...
564419d2e3deSDmitry ChaginCommand is always
564519d2e3deSDmitry Chaginexecuted in a sub-shell, and the restrictions placed on
564619d2e3deSDmitry Chagincommands in simple
564719d2e3deSDmitry Chagin.Va if
564819d2e3deSDmitry Chaginstatements apply.
564919d2e3deSDmitry Chagin.TP 8
565019d2e3deSDmitry Chagin.B nohup \fR[
565119d2e3deSDmitry Chagin.Va command
565219d2e3deSDmitry Chagin]
565319d2e3deSDmitry ChaginWith
565419d2e3deSDmitry Chagin.Va command
565519d2e3deSDmitry Chagin, runs
565619d2e3deSDmitry Chagin.Va command
565719d2e3deSDmitry Chaginsuch that it will ignore hangup signals.
565819d2e3deSDmitry ChaginNote that commands may set their own response to hangups, overriding
565919d2e3deSDmitry Chagin.Va nohup
566019d2e3deSDmitry ChaginWithout an argument, causes the non-interactive shell only to
566119d2e3deSDmitry Chaginignore hangups for the remainder of the script.
566219d2e3deSDmitry ChaginSee also
566319d2e3deSDmitry Chagin.Va Signal handling
566419d2e3deSDmitry Chaginand the
566519d2e3deSDmitry Chagin.Va hup
566619d2e3deSDmitry Chaginbuiltin command.
566719d2e3deSDmitry Chagin.TP 8
566819d2e3deSDmitry Chagin.B notify \fR[\fB%
566919d2e3deSDmitry Chagin.Va job
567019d2e3deSDmitry Chagin...]
567119d2e3deSDmitry ChaginCauses the shell to notify the user asynchronously when the status of any
567219d2e3deSDmitry Chaginof the specified jobs (or, without %
567319d2e3deSDmitry Chagin.Va job
567419d2e3deSDmitry Chagin, the current job) changes,
567519d2e3deSDmitry Chagininstead of waiting until the next prompt as is usual.
567619d2e3deSDmitry Chagin.Va job
567719d2e3deSDmitry Chaginmay be a number, a string,
567819d2e3deSDmitry Chagin.Sq
567919d2e3deSDmitry Chagin,
568019d2e3deSDmitry Chagin.Sq %
568119d2e3deSDmitry Chagin,
568219d2e3deSDmitry Chagin.Sq +
568319d2e3deSDmitry Chaginor
568419d2e3deSDmitry Chagin.Sq \-
568519d2e3deSDmitry Chaginas described
568619d2e3deSDmitry Chaginunder
568719d2e3deSDmitry Chagin.Va Jobs
568819d2e3deSDmitry ChaginSee also the
568919d2e3deSDmitry Chagin.Va notify
569019d2e3deSDmitry Chaginshell variable.
569119d2e3deSDmitry Chagin.TP 8
569219d2e3deSDmitry Chagin.B onintr \fR[
569319d2e3deSDmitry Chagin.Fl \fR|
569419d2e3deSDmitry Chagin.Va label
569519d2e3deSDmitry Chagin]
569619d2e3deSDmitry ChaginControls the action of the shell on interrupts.
569719d2e3deSDmitry ChaginWithout arguments,
569819d2e3deSDmitry Chaginrestores the default action of the shell on interrupts,
569919d2e3deSDmitry Chaginwhich is to terminate shell scripts or to return to the
570019d2e3deSDmitry Chaginterminal command input level.
570119d2e3deSDmitry ChaginWith
570219d2e3deSDmitry Chagin.Sq \-
570319d2e3deSDmitry Chagin, causes all interrupts to be ignored.
570419d2e3deSDmitry ChaginWith
570519d2e3deSDmitry Chagin.Va label
570619d2e3deSDmitry Chagin, causes the shell to execute a
570719d2e3deSDmitry Chagin.Sq goto
570819d2e3deSDmitry Chagin.Va label
570919d2e3deSDmitry Chaginwhen an interrupt is received or a child process terminates because it was
571019d2e3deSDmitry Chagininterrupted.
571119d2e3deSDmitry Chagin.IP "" 8
571219d2e3deSDmitry Chagin.Va onintr
571319d2e3deSDmitry Chaginis ignored if the shell is running detached and in system
571419d2e3deSDmitry Chaginstartup files (see
571519d2e3deSDmitry Chagin.Va FILES
571619d2e3deSDmitry Chagin), where interrupts are disabled anyway.
571719d2e3deSDmitry Chagin.TP 8
571819d2e3deSDmitry Chagin.B popd \fR[
571919d2e3deSDmitry Chagin.Fl p\fR] [
572019d2e3deSDmitry Chagin.Fl l\fR] [
572119d2e3deSDmitry Chagin.Fl n\fR|
572219d2e3deSDmitry Chagin.Fl v\fR] \fR[\fB+
572319d2e3deSDmitry Chagin.Va n
572419d2e3deSDmitry Chagin]
572519d2e3deSDmitry ChaginWithout arguments, pops the directory stack and returns to the new top directory.
572619d2e3deSDmitry ChaginWith a number
572719d2e3deSDmitry Chagin.Sq +
572819d2e3deSDmitry Chagin.Va n
572919d2e3deSDmitry Chagin, discards the
573019d2e3deSDmitry Chagin.Va n
573119d2e3deSDmitry Chagin'th entry in the stack.
573219d2e3deSDmitry Chagin.IP "" 8
573319d2e3deSDmitry ChaginFinally, all forms of
573419d2e3deSDmitry Chagin.Va popd
573519d2e3deSDmitry Chaginprint the final directory stack,
573619d2e3deSDmitry Chaginjust like
573719d2e3deSDmitry Chagin.Va dirs
573819d2e3deSDmitry ChaginThe
573919d2e3deSDmitry Chagin.Va pushdsilent
574019d2e3deSDmitry Chaginshell variable can be set to
574119d2e3deSDmitry Chaginprevent this and the
574219d2e3deSDmitry Chagin.Fl p\fR flag can be given to override
574319d2e3deSDmitry Chagin.Va pushdsilent
574419d2e3deSDmitry ChaginThe
574519d2e3deSDmitry Chagin.Fl l\fR,
574619d2e3deSDmitry Chagin.Fl n\fR and
574719d2e3deSDmitry Chagin.Fl v\fR flags have the same effect on
574819d2e3deSDmitry Chagin.Va popd
574919d2e3deSDmitry Chaginas on
575019d2e3deSDmitry Chagin.Va dirs
575119d2e3deSDmitry Chagin(+)
575219d2e3deSDmitry Chagin.TP 8
575319d2e3deSDmitry Chagin.B printenv \fR[
575419d2e3deSDmitry Chagin.Va name
575519d2e3deSDmitry Chagin] (+)
575619d2e3deSDmitry ChaginPrints the names and values of all environment variables or,
575719d2e3deSDmitry Chaginwith
575819d2e3deSDmitry Chagin.Va name
575919d2e3deSDmitry Chagin, the value of the environment variable
576019d2e3deSDmitry Chagin.Va name
576119d2e3deSDmitry Chagin.TP 8
576219d2e3deSDmitry Chagin.B pushd \fR[
576319d2e3deSDmitry Chagin.Fl p\fR] [
576419d2e3deSDmitry Chagin.Fl l\fR] [
576519d2e3deSDmitry Chagin.Fl n\fR|
576619d2e3deSDmitry Chagin.Fl v\fR] [
576719d2e3deSDmitry Chagin.Va name
576819d2e3deSDmitry Chagin|\fB+
576919d2e3deSDmitry Chagin.Va n
577019d2e3deSDmitry Chagin]
577119d2e3deSDmitry ChaginWithout arguments, exchanges the top two elements of the directory stack.
577219d2e3deSDmitry ChaginIf
577319d2e3deSDmitry Chagin.Va pushdtohome
577419d2e3deSDmitry Chaginis set,
577519d2e3deSDmitry Chagin.Va pushd
577619d2e3deSDmitry Chaginwithout arguments does
577719d2e3deSDmitry Chagin.Sq pushd ~
577819d2e3deSDmitry Chagin,
577919d2e3deSDmitry Chaginlike
578019d2e3deSDmitry Chagin.Va cd
578119d2e3deSDmitry Chagin(+)
578219d2e3deSDmitry ChaginWith
578319d2e3deSDmitry Chagin.Va name
578419d2e3deSDmitry Chagin, pushes the current working directory onto the directory
578519d2e3deSDmitry Chaginstack and changes to
578619d2e3deSDmitry Chagin.Va name
578719d2e3deSDmitry ChaginIf
578819d2e3deSDmitry Chagin.Va name
578919d2e3deSDmitry Chaginis
579019d2e3deSDmitry Chagin.Sq \-
579119d2e3deSDmitry Chaginit is interpreted as the previous working directory
579219d2e3deSDmitry Chagin(see
579319d2e3deSDmitry Chagin.Va Filename substitution
579419d2e3deSDmitry Chagin).
579519d2e3deSDmitry Chagin(+)
579619d2e3deSDmitry ChaginIf
579719d2e3deSDmitry Chagin.Va dunique
579819d2e3deSDmitry Chaginis set,
579919d2e3deSDmitry Chagin.Va pushd
580019d2e3deSDmitry Chaginremoves any instances of
580119d2e3deSDmitry Chagin.Va name
580219d2e3deSDmitry Chaginfrom the stack before pushing it onto the stack.
580319d2e3deSDmitry Chagin(+)
580419d2e3deSDmitry ChaginWith a number
580519d2e3deSDmitry Chagin.Sq +
580619d2e3deSDmitry Chagin.Va n
580719d2e3deSDmitry Chagin, rotates the
580819d2e3deSDmitry Chagin.Va n
580919d2e3deSDmitry Chaginth element of the
581019d2e3deSDmitry Chagindirectory stack around to be the top element and changes to it.
581119d2e3deSDmitry ChaginIf
581219d2e3deSDmitry Chagin.Va dextract
581319d2e3deSDmitry Chaginis set, however,
581419d2e3deSDmitry Chagin.Sq pushd +
581519d2e3deSDmitry Chagin.Va n
581619d2e3deSDmitry Chaginextracts the
581719d2e3deSDmitry Chagin.Va n
581819d2e3deSDmitry Chaginth
581919d2e3deSDmitry Chagindirectory, pushes it onto the top of the stack and changes to it.
582019d2e3deSDmitry Chagin(+)
582119d2e3deSDmitry Chagin.IP "" 8
582219d2e3deSDmitry ChaginFinally, all forms of
582319d2e3deSDmitry Chagin.Va pushd
582419d2e3deSDmitry Chaginprint the final directory stack,
582519d2e3deSDmitry Chaginjust like
582619d2e3deSDmitry Chagin.Va dirs
582719d2e3deSDmitry ChaginThe
582819d2e3deSDmitry Chagin.Va pushdsilent
582919d2e3deSDmitry Chaginshell variable can be set to
583019d2e3deSDmitry Chaginprevent this and the
583119d2e3deSDmitry Chagin.Fl p\fR flag can be given to override
583219d2e3deSDmitry Chagin.Va pushdsilent
583319d2e3deSDmitry ChaginThe
583419d2e3deSDmitry Chagin.Fl l\fR,
583519d2e3deSDmitry Chagin.Fl n\fR and
583619d2e3deSDmitry Chagin.Fl v\fR flags have the same effect on
583719d2e3deSDmitry Chagin.Va pushd
583819d2e3deSDmitry Chaginas on
583919d2e3deSDmitry Chagin.Va dirs
584019d2e3deSDmitry Chagin(+)
584119d2e3deSDmitry Chagin.TP 8
584219d2e3deSDmitry Chagin.B rehash
584319d2e3deSDmitry ChaginCauses the internal hash table of the contents of the
584419d2e3deSDmitry Chagindirectories in the
584519d2e3deSDmitry Chagin.Va path
584619d2e3deSDmitry Chaginvariable to be recomputed.
584719d2e3deSDmitry ChaginThis is
584819d2e3deSDmitry Chaginneeded if the
584919d2e3deSDmitry Chagin.Va autorehash
585019d2e3deSDmitry Chaginshell variable is not set and new
585119d2e3deSDmitry Chagincommands are added to directories in
585219d2e3deSDmitry Chagin.Va path
585319d2e3deSDmitry Chaginwhile you are logged
585419d2e3deSDmitry Chaginin.
585519d2e3deSDmitry ChaginWith
585619d2e3deSDmitry Chagin.Va autorehash
585719d2e3deSDmitry Chagin, a new command will be found
585819d2e3deSDmitry Chaginautomatically, except in the special case where another command of
585919d2e3deSDmitry Chaginthe same name which is located in a different directory already
586019d2e3deSDmitry Chaginexists in the hash table.
586119d2e3deSDmitry ChaginAlso flushes the cache of home directories
586219d2e3deSDmitry Chaginbuilt by tilde expansion.
586319d2e3deSDmitry Chagin.TP 8
586419d2e3deSDmitry Chagin.B repeat \fIcount command
586519d2e3deSDmitry ChaginThe specified
586619d2e3deSDmitry Chagin.Va command
586719d2e3deSDmitry Chagin,
586819d2e3deSDmitry Chaginwhich is subject to the same restrictions as the
586919d2e3deSDmitry Chagin.Va command
587019d2e3deSDmitry Chaginin the one line
587119d2e3deSDmitry Chagin.Va if
587219d2e3deSDmitry Chaginstatement above, is executed
587319d2e3deSDmitry Chagin.Va count
587419d2e3deSDmitry Chagintimes.
587519d2e3deSDmitry ChaginI/O redirections occur exactly once, even if
587619d2e3deSDmitry Chagin.Va count
587719d2e3deSDmitry Chaginis 0.
587819d2e3deSDmitry Chagin.TP 8
587919d2e3deSDmitry Chagin.B rootnode //
588019d2e3deSDmitry Chagin.Va nodename
588119d2e3deSDmitry Chagin(+)
588219d2e3deSDmitry ChaginChanges the rootnode to //
588319d2e3deSDmitry Chagin.Va nodename
588419d2e3deSDmitry Chagin, so that
588519d2e3deSDmitry Chagin.Sq /
588619d2e3deSDmitry Chaginwill be interpreted
588719d2e3deSDmitry Chaginas
588819d2e3deSDmitry Chagin.Sq //
588919d2e3deSDmitry Chagin.Va nodename
589019d2e3deSDmitry Chagin(Domain/OS only)
589119d2e3deSDmitry Chagin.Pp
589219d2e3deSDmitry Chagin.B sched \fR(+)
589319d2e3deSDmitry Chagin.br
589419d2e3deSDmitry Chagin.B sched \fR[
589519d2e3deSDmitry Chagin.Va +
589619d2e3deSDmitry Chagin]
589719d2e3deSDmitry Chagin.Va hh:mm command
589819d2e3deSDmitry Chagin\fR(+)
589919d2e3deSDmitry Chagin.PD 0
590019d2e3deSDmitry Chagin.TP 8
590119d2e3deSDmitry Chagin.B sched \-
590219d2e3deSDmitry Chagin.Va n
590319d2e3deSDmitry Chagin(+)
590419d2e3deSDmitry ChaginThe first form prints the scheduled-event list.
590519d2e3deSDmitry ChaginThe
590619d2e3deSDmitry Chagin.Va sched
590719d2e3deSDmitry Chaginshell variable may be set to define the format in which
590819d2e3deSDmitry Chaginthe scheduled-event list is printed.
590919d2e3deSDmitry ChaginThe second form adds
591019d2e3deSDmitry Chagin.Va command
591119d2e3deSDmitry Chaginto the scheduled-event list.
591219d2e3deSDmitry ChaginFor example,
591319d2e3deSDmitry Chagin.PD
591419d2e3deSDmitry Chagin.RS +8
591519d2e3deSDmitry Chagin.IP "" 4
591619d2e3deSDmitry Chagin> sched 11:00 echo It\e's eleven o\e'clock.
591719d2e3deSDmitry Chagin.Pp
591819d2e3deSDmitry Chagincauses the shell to echo
591919d2e3deSDmitry Chagin.Sq It's eleven o'clock .
592019d2e3deSDmitry Chaginat 11 AM.
592119d2e3deSDmitry ChaginThe time may be in 12-hour AM/PM format
592219d2e3deSDmitry Chagin.IP "" 4
592319d2e3deSDmitry Chagin.\" TODO
592419d2e3deSDmitry Chagin> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
592519d2e3deSDmitry Chagin.Pp
592619d2e3deSDmitry Chaginor may be relative to the current time:
592719d2e3deSDmitry Chagin.IP "" 4
592819d2e3deSDmitry Chagin> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
592919d2e3deSDmitry Chagin.Pp
593019d2e3deSDmitry ChaginA relative time specification may not use AM/PM format.
593119d2e3deSDmitry ChaginThe third form removes item
593219d2e3deSDmitry Chagin.Va n
593319d2e3deSDmitry Chaginfrom the event list:
593419d2e3deSDmitry Chagin.Bd -literal -offset indent
593519d2e3deSDmitry Chagin> sched
593619d2e3deSDmitry Chagin	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
593719d2e3deSDmitry Chagin	2  Wed Apr  4 17:00  set prompt=[%h] It's after 5; go home: >
593819d2e3deSDmitry Chagin> sched \-2
593919d2e3deSDmitry Chagin> sched
594019d2e3deSDmitry Chagin	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
594119d2e3deSDmitry Chagin.Ed
594219d2e3deSDmitry Chagin.Pp
594319d2e3deSDmitry ChaginA command in the scheduled-event list is executed just before the first
594419d2e3deSDmitry Chaginprompt is printed after the time when the command is scheduled.
594519d2e3deSDmitry ChaginIt is possible to miss the exact time when the command is to be run, but
594619d2e3deSDmitry Chaginan overdue command will execute at the next prompt.
594719d2e3deSDmitry ChaginA command which comes due while the shell
594819d2e3deSDmitry Chaginis waiting for user input is executed immediately.
594919d2e3deSDmitry ChaginHowever, normal operation of an already-running command will not
595019d2e3deSDmitry Chaginbe interrupted so that a scheduled-event list element may be run.
595119d2e3deSDmitry Chagin.Pp
595219d2e3deSDmitry ChaginThis mechanism is similar to, but not the same as, the
595319d2e3deSDmitry Chagin.Va at
595419d2e3deSDmitry Chagin(1)
595519d2e3deSDmitry Chagincommand on some Unix systems.
595619d2e3deSDmitry ChaginIts major disadvantage is that it may not run a command at exactly the
595719d2e3deSDmitry Chaginspecified time.
595819d2e3deSDmitry ChaginIts major advantage is that because
595919d2e3deSDmitry Chagin.Va sched
596019d2e3deSDmitry Chaginruns directly from
596119d2e3deSDmitry Chaginthe shell, it has access to shell variables and other structures.
596219d2e3deSDmitry ChaginThis provides a mechanism for changing one's working environment
596319d2e3deSDmitry Chaginbased on the time of day.
596419d2e3deSDmitry Chagin.RE
596519d2e3deSDmitry Chagin.Pp
596619d2e3deSDmitry Chagin.B set
596719d2e3deSDmitry Chagin.br
596819d2e3deSDmitry Chagin.B set
596919d2e3deSDmitry Chagin.Va name
597019d2e3deSDmitry Chagin...
597119d2e3deSDmitry Chagin.br
597219d2e3deSDmitry Chagin.B set
597319d2e3deSDmitry Chagin.Va name
597419d2e3deSDmitry Chagin\fB=
597519d2e3deSDmitry Chagin.Va word
597619d2e3deSDmitry Chagin...
597719d2e3deSDmitry Chagin.br
597819d2e3deSDmitry Chagin.B set [\-r] [\-f|\-l]
597919d2e3deSDmitry Chagin.Va name
598019d2e3deSDmitry Chagin\fB=(\fIwordlist
598119d2e3deSDmitry Chagin.Va )
598219d2e3deSDmitry Chagin... (+)
598319d2e3deSDmitry Chagin.br
598419d2e3deSDmitry Chagin.B set
598519d2e3deSDmitry Chagin.Va name[index]
598619d2e3deSDmitry Chagin\fB=
598719d2e3deSDmitry Chagin.Va word
598819d2e3deSDmitry Chagin...
598919d2e3deSDmitry Chagin.br
599019d2e3deSDmitry Chagin.B set \-r \fR(+)
599119d2e3deSDmitry Chagin.br
599219d2e3deSDmitry Chagin.B set \-r
599319d2e3deSDmitry Chagin.Va name
599419d2e3deSDmitry Chagin... (+)
599519d2e3deSDmitry Chagin.PD 0
599619d2e3deSDmitry Chagin.TP 8
599719d2e3deSDmitry Chagin.B set \-r
599819d2e3deSDmitry Chagin.Va name
599919d2e3deSDmitry Chagin\fB=
600019d2e3deSDmitry Chagin.Va word
600119d2e3deSDmitry Chagin... (+)
600219d2e3deSDmitry ChaginThe first form of the command prints the value of all shell variables.
600319d2e3deSDmitry ChaginVariables which contain more than a single word print as a
600419d2e3deSDmitry Chaginparenthesized word list.
600519d2e3deSDmitry ChaginThe second form sets
600619d2e3deSDmitry Chagin.Va name
600719d2e3deSDmitry Chaginto the null string.
600819d2e3deSDmitry ChaginThe third form sets
600919d2e3deSDmitry Chagin.Va name
601019d2e3deSDmitry Chaginto the single
601119d2e3deSDmitry Chagin.Va word
601219d2e3deSDmitry ChaginThe fourth form sets
601319d2e3deSDmitry Chagin.Va name
601419d2e3deSDmitry Chaginto the list of words in
601519d2e3deSDmitry Chagin.Va wordlist
601619d2e3deSDmitry ChaginIn all cases the value is command and filename expanded.
601719d2e3deSDmitry ChaginIf
601819d2e3deSDmitry Chagin.Fl r\fR is specified, the value is set read-only.
601919d2e3deSDmitry ChaginIf
602019d2e3deSDmitry Chagin.Fl f\fR or
602119d2e3deSDmitry Chagin.Fl l\fR are specified, set only unique words keeping their order.
602219d2e3deSDmitry Chagin.Fl f\fR prefers the first occurrence of a word, and
602319d2e3deSDmitry Chagin.Fl l\fR the last.
602419d2e3deSDmitry ChaginThe fifth form sets the
602519d2e3deSDmitry Chagin.Va index
602619d2e3deSDmitry Chagin'th component of
602719d2e3deSDmitry Chagin.Va name
602819d2e3deSDmitry Chaginto
602919d2e3deSDmitry Chagin.Va word
603019d2e3deSDmitry Chagin;
603119d2e3deSDmitry Chaginthis component must already exist.
603219d2e3deSDmitry ChaginThe sixth form lists only the names of all shell variables that are read-only.
603319d2e3deSDmitry ChaginThe seventh form makes
603419d2e3deSDmitry Chagin.Va name
603519d2e3deSDmitry Chaginread-only, whether or not it has a value.
603619d2e3deSDmitry ChaginThe eighth form is the same as the third form, but
603719d2e3deSDmitry Chaginmake
603819d2e3deSDmitry Chagin.Va name
603919d2e3deSDmitry Chaginread-only at the same time.
604019d2e3deSDmitry Chagin.PD
604119d2e3deSDmitry Chagin.IP "" 8
604219d2e3deSDmitry ChaginThese arguments can be repeated to set and/or make read-only multiple variables
604319d2e3deSDmitry Chaginin a single set command.
604419d2e3deSDmitry ChaginNote, however, that variable expansion
604519d2e3deSDmitry Chaginhappens for all arguments before any setting occurs.
604619d2e3deSDmitry ChaginNote also that
604719d2e3deSDmitry Chagin.Sq =
604819d2e3deSDmitry Chagincan
604919d2e3deSDmitry Chaginbe adjacent to both
605019d2e3deSDmitry Chagin.Va name
605119d2e3deSDmitry Chaginand
605219d2e3deSDmitry Chagin.Va word
605319d2e3deSDmitry Chaginor separated from both by
605419d2e3deSDmitry Chaginwhitespace, but cannot be adjacent to only one or the other.
605519d2e3deSDmitry ChaginSee also the
605619d2e3deSDmitry Chagin.Va unset
605719d2e3deSDmitry Chaginbuiltin command.
605819d2e3deSDmitry Chagin.TP 8
605919d2e3deSDmitry Chagin.B setenv \fR[
606019d2e3deSDmitry Chagin.Va name
606119d2e3deSDmitry Chagin[
606219d2e3deSDmitry Chagin.Va value
606319d2e3deSDmitry Chagin]]
606419d2e3deSDmitry ChaginWithout arguments, prints the names and values of all environment variables.
606519d2e3deSDmitry ChaginGiven
606619d2e3deSDmitry Chagin.Va name
606719d2e3deSDmitry Chagin, sets the environment variable
606819d2e3deSDmitry Chagin.Va name
606919d2e3deSDmitry Chaginto
607019d2e3deSDmitry Chagin.Va value
607119d2e3deSDmitry Chaginor, without
607219d2e3deSDmitry Chagin.Va value
607319d2e3deSDmitry Chagin, to the null string.
607419d2e3deSDmitry Chagin.TP 8
607519d2e3deSDmitry Chagin.B setpath
607619d2e3deSDmitry Chagin.Va path
607719d2e3deSDmitry Chagin(+)
607819d2e3deSDmitry ChaginEquivalent to
607919d2e3deSDmitry Chagin.Va setpath
608019d2e3deSDmitry Chagin(1).
608119d2e3deSDmitry Chagin(Mach only)
608219d2e3deSDmitry Chagin.TP 8
608319d2e3deSDmitry Chagin.B setspath\fR LOCAL|
608419d2e3deSDmitry Chagin.Va site
608519d2e3deSDmitry Chagin|
608619d2e3deSDmitry Chagin.Va cpu
608719d2e3deSDmitry Chagin...
608819d2e3deSDmitry Chagin(+)
608919d2e3deSDmitry ChaginSets the system execution path.
609019d2e3deSDmitry Chagin(TCF only)
609119d2e3deSDmitry Chagin.TP 8
609219d2e3deSDmitry Chagin.B settc
609319d2e3deSDmitry Chagin.Va cap value
609419d2e3deSDmitry Chagin(+)
609519d2e3deSDmitry ChaginTells the shell to believe that the terminal capability
609619d2e3deSDmitry Chagin.Va cap
609719d2e3deSDmitry Chagin(as defined in
609819d2e3deSDmitry Chagin.Va termcap
609919d2e3deSDmitry Chagin(5)) has the value
610019d2e3deSDmitry Chagin.Va value
610119d2e3deSDmitry ChaginNo sanity checking is done.
610219d2e3deSDmitry ChaginConcept terminal users may have to
610319d2e3deSDmitry Chagin.Sq settc xn no
610419d2e3deSDmitry Chaginto get proper
610519d2e3deSDmitry Chaginwrapping at the rightmost column.
610619d2e3deSDmitry Chagin.TP 8
610719d2e3deSDmitry Chagin.B setty \fR[
610819d2e3deSDmitry Chagin.Fl d\fR|
610919d2e3deSDmitry Chagin.Fl q\fR|
611019d2e3deSDmitry Chagin.Fl x\fR] [
611119d2e3deSDmitry Chagin.Fl a\fR] [[
611219d2e3deSDmitry Chagin.Va +
611319d2e3deSDmitry Chagin|
611419d2e3deSDmitry Chagin.Fl \fR]
611519d2e3deSDmitry Chagin.Va mode
611619d2e3deSDmitry Chagin] (+)
611719d2e3deSDmitry ChaginControls which tty modes (see
611819d2e3deSDmitry Chagin.Va Terminal management
611919d2e3deSDmitry Chagin)
612019d2e3deSDmitry Chaginthe shell does not allow to change.
612119d2e3deSDmitry Chagin.Fl d\fR,
612219d2e3deSDmitry Chagin.Fl q\fR or
612319d2e3deSDmitry Chagin.Fl x\fR tells
612419d2e3deSDmitry Chagin.Va setty
612519d2e3deSDmitry Chaginto act
612619d2e3deSDmitry Chaginon the
612719d2e3deSDmitry Chagin.Sq edit
612819d2e3deSDmitry Chagin,
612919d2e3deSDmitry Chagin.Sq quote
613019d2e3deSDmitry Chaginor
613119d2e3deSDmitry Chagin.Sq execute
613219d2e3deSDmitry Chaginset of tty modes respectively; without
613319d2e3deSDmitry Chagin.Fl d\fR,
613419d2e3deSDmitry Chagin.Fl q\fR or
613519d2e3deSDmitry Chagin.Fl x\fR,
613619d2e3deSDmitry Chagin.Sq execute
613719d2e3deSDmitry Chaginis used.
613819d2e3deSDmitry Chagin.IP "" 8
613919d2e3deSDmitry ChaginWithout other arguments,
614019d2e3deSDmitry Chagin.Va setty
614119d2e3deSDmitry Chaginlists the modes in the chosen set
614219d2e3deSDmitry Chaginwhich are fixed on (`+mode') or off (`\-mode').
614319d2e3deSDmitry ChaginThe available modes, and thus the display, vary from system to system.
614419d2e3deSDmitry ChaginWith
614519d2e3deSDmitry Chagin.Fl a\fR, lists all tty modes in the chosen set
614619d2e3deSDmitry Chaginwhether or not they are fixed.
614719d2e3deSDmitry ChaginWith \fB+
614819d2e3deSDmitry Chagin.Va mode
614919d2e3deSDmitry Chagin,
615019d2e3deSDmitry Chagin.Fl
615119d2e3deSDmitry Chagin.Va mode
615219d2e3deSDmitry Chaginor
615319d2e3deSDmitry Chagin.Va mode
615419d2e3deSDmitry Chagin, fixes
615519d2e3deSDmitry Chagin.Va mode
615619d2e3deSDmitry Chaginon or off
615719d2e3deSDmitry Chaginor removes control from
615819d2e3deSDmitry Chagin.Va mode
615919d2e3deSDmitry Chaginin the chosen set.
616019d2e3deSDmitry ChaginFor example,
616119d2e3deSDmitry Chagin.Sq setty +echok echoe
616219d2e3deSDmitry Chaginfixes
616319d2e3deSDmitry Chagin.Sq echok
616419d2e3deSDmitry Chaginmode on and allows commands
616519d2e3deSDmitry Chaginto turn
616619d2e3deSDmitry Chagin.Sq echoe
616719d2e3deSDmitry Chaginmode on or off, both when the shell is executing commands.
616819d2e3deSDmitry Chagin.TP 8
616919d2e3deSDmitry Chagin.B setxvers\fR [
617019d2e3deSDmitry Chagin.Va string
617119d2e3deSDmitry Chagin] (+)
617219d2e3deSDmitry ChaginSet the experimental version prefix to
617319d2e3deSDmitry Chagin.Va string
617419d2e3deSDmitry Chagin, or removes it
617519d2e3deSDmitry Chaginif
617619d2e3deSDmitry Chagin.Va string
617719d2e3deSDmitry Chaginis omitted.
617819d2e3deSDmitry Chagin(TCF only)
617919d2e3deSDmitry Chagin.TP 8
618019d2e3deSDmitry Chagin.B shift \fR[
618119d2e3deSDmitry Chagin.Va variable
618219d2e3deSDmitry Chagin]
618319d2e3deSDmitry ChaginWithout arguments, discards
618419d2e3deSDmitry Chagin.Va argv
618519d2e3deSDmitry Chagin[1] and shifts the members of
618619d2e3deSDmitry Chagin.Va argv
618719d2e3deSDmitry Chaginto the left.
618819d2e3deSDmitry ChaginIt is an error for
618919d2e3deSDmitry Chagin.Va argv
619019d2e3deSDmitry Chaginnot to be set or to have
619119d2e3deSDmitry Chaginless than one word as value.
619219d2e3deSDmitry ChaginWith
619319d2e3deSDmitry Chagin.Va variable
619419d2e3deSDmitry Chagin, performs the
619519d2e3deSDmitry Chaginsame function on
619619d2e3deSDmitry Chagin.Va variable
619719d2e3deSDmitry Chagin.TP 8
619819d2e3deSDmitry Chagin.B source \fR[
619919d2e3deSDmitry Chagin.Fl h\fR]
620019d2e3deSDmitry Chagin.Va name
620119d2e3deSDmitry Chagin[
620219d2e3deSDmitry Chagin.Va args
620319d2e3deSDmitry Chagin...]
620419d2e3deSDmitry ChaginThe shell reads and executes commands from
620519d2e3deSDmitry Chagin.Va name
620619d2e3deSDmitry ChaginThe commands are not placed on the history list.
620719d2e3deSDmitry ChaginIf any
620819d2e3deSDmitry Chagin.Va args
620919d2e3deSDmitry Chaginare given, they are placed in
621019d2e3deSDmitry Chagin.Va argv
621119d2e3deSDmitry Chagin(+)
621219d2e3deSDmitry Chagin.Va source
621319d2e3deSDmitry Chagincommands may be nested;
621419d2e3deSDmitry Chaginif they are nested too deeply the shell may run out of file descriptors.
621519d2e3deSDmitry ChaginAn error in a
621619d2e3deSDmitry Chagin.Va source
621719d2e3deSDmitry Chaginat any level terminates all nested
621819d2e3deSDmitry Chagin.Va source
621919d2e3deSDmitry Chagincommands.
622019d2e3deSDmitry ChaginWith
622119d2e3deSDmitry Chagin.Fl h\fR, commands are placed on the history list instead of being
622219d2e3deSDmitry Chaginexecuted, much like
622319d2e3deSDmitry Chagin.Sq history \-L
622419d2e3deSDmitry Chagin.TP 8
622519d2e3deSDmitry Chagin.B stop \fB%
622619d2e3deSDmitry Chagin.Va job
622719d2e3deSDmitry Chagin|
622819d2e3deSDmitry Chagin.Va pid
622919d2e3deSDmitry Chagin...
623019d2e3deSDmitry ChaginStops the specified jobs or processes which are executing in the background.
623119d2e3deSDmitry Chagin.Va job
623219d2e3deSDmitry Chaginmay be a number, a string,
623319d2e3deSDmitry Chagin.Sq
623419d2e3deSDmitry Chagin,
623519d2e3deSDmitry Chagin.Sq %
623619d2e3deSDmitry Chagin,
623719d2e3deSDmitry Chagin.Sq +
623819d2e3deSDmitry Chaginor
623919d2e3deSDmitry Chagin.Sq \-
624019d2e3deSDmitry Chaginas described
624119d2e3deSDmitry Chaginunder
624219d2e3deSDmitry Chagin.Va Jobs
624319d2e3deSDmitry ChaginThere is no default
624419d2e3deSDmitry Chagin.Va job
624519d2e3deSDmitry Chagin; saying just
624619d2e3deSDmitry Chagin.Sq stop
624719d2e3deSDmitry Chagindoes not stop
624819d2e3deSDmitry Chaginthe current job.
624919d2e3deSDmitry Chagin.TP 8
625019d2e3deSDmitry Chagin.B suspend
625119d2e3deSDmitry ChaginCauses the shell to stop in its tracks, much as if it had
625219d2e3deSDmitry Chaginbeen sent a stop signal with
625319d2e3deSDmitry Chagin.Va ^Z
625419d2e3deSDmitry ChaginThis is most often used to
625519d2e3deSDmitry Chaginstop shells started by
625619d2e3deSDmitry Chagin.Va su
625719d2e3deSDmitry Chagin(1).
625819d2e3deSDmitry Chagin.Pp
625919d2e3deSDmitry Chagin.B switch (\fIstring\fB)
626019d2e3deSDmitry Chagin.br
626119d2e3deSDmitry Chagin.B case \fIstr1\fB:
626219d2e3deSDmitry Chagin.PD 0
626319d2e3deSDmitry Chagin.IP "" 4
626419d2e3deSDmitry Chagin\&...
626519d2e3deSDmitry Chagin.br
626619d2e3deSDmitry Chagin.B breaksw
626719d2e3deSDmitry Chagin.Pp
626819d2e3deSDmitry Chagin\&...
626919d2e3deSDmitry Chagin.Pp
627019d2e3deSDmitry Chagin.B default:
627119d2e3deSDmitry Chagin.IP "" 4
627219d2e3deSDmitry Chagin\&...
627319d2e3deSDmitry Chagin.br
627419d2e3deSDmitry Chagin.B breaksw
627519d2e3deSDmitry Chagin.TP 8
627619d2e3deSDmitry Chagin.B endsw
627719d2e3deSDmitry ChaginEach case label is successively matched, against the
627819d2e3deSDmitry Chaginspecified
627919d2e3deSDmitry Chagin.Va string
628019d2e3deSDmitry Chaginwhich is first command and filename expanded.
628119d2e3deSDmitry ChaginThe file metacharacters
628219d2e3deSDmitry Chagin.Sq *
628319d2e3deSDmitry Chagin,
628419d2e3deSDmitry Chagin.Sq \&?
628519d2e3deSDmitry Chaginand
628619d2e3deSDmitry Chagin.Sq [...]
628719d2e3deSDmitry Chaginmay be used
628819d2e3deSDmitry Chaginin the case labels, which are variable expanded.
628919d2e3deSDmitry ChaginIf none
629019d2e3deSDmitry Chaginof the labels match before a
629119d2e3deSDmitry Chagin.Sq default
629219d2e3deSDmitry Chaginlabel is found, then
629319d2e3deSDmitry Chaginthe execution begins after the default label.
629419d2e3deSDmitry ChaginEach case
629519d2e3deSDmitry Chaginlabel and the default label must appear at the beginning of
629619d2e3deSDmitry Chagina line.
629719d2e3deSDmitry ChaginThe command
629819d2e3deSDmitry Chagin.Va breaksw
629919d2e3deSDmitry Chagincauses execution to continue
630019d2e3deSDmitry Chaginafter the
630119d2e3deSDmitry Chagin.Va endsw
630219d2e3deSDmitry ChaginOtherwise control may fall through case
630319d2e3deSDmitry Chaginlabels and default labels as in C.
630419d2e3deSDmitry ChaginIf no label matches and
630519d2e3deSDmitry Chaginthere is no default, execution continues after the
630619d2e3deSDmitry Chagin.Va endsw
630719d2e3deSDmitry Chagin.PD
630819d2e3deSDmitry Chagin.TP 8
630919d2e3deSDmitry Chagin.B telltc \fR(+)
631019d2e3deSDmitry ChaginLists the values of all terminal capabilities (see
631119d2e3deSDmitry Chagin.Va termcap
631219d2e3deSDmitry Chagin(5)).
631319d2e3deSDmitry Chagin.TP 8
631419d2e3deSDmitry Chagin.B termname \fR[
631519d2e3deSDmitry Chagin.Va terminal type
631619d2e3deSDmitry Chagin] \fR(+)
631719d2e3deSDmitry ChaginTests if
631819d2e3deSDmitry Chagin.Va terminal type
631919d2e3deSDmitry Chagin(or the current value of
632019d2e3deSDmitry Chagin.Va TERM
632119d2e3deSDmitry Chaginif no
632219d2e3deSDmitry Chagin.Va terminal type
632319d2e3deSDmitry Chaginis given) has an entry in the hosts termcap(5) or
632419d2e3deSDmitry Chaginterminfo(5) database. Prints the terminal type to stdout and returns 0
632519d2e3deSDmitry Chaginif an entry is present otherwise returns 1.
632619d2e3deSDmitry Chagin.TP 8
632719d2e3deSDmitry Chagin.B time \fR[
632819d2e3deSDmitry Chagin.Va command
632919d2e3deSDmitry Chagin]
633019d2e3deSDmitry ChaginExecutes
633119d2e3deSDmitry Chagin.Va command
633219d2e3deSDmitry Chagin(which must be a simple command, not an alias,
633319d2e3deSDmitry Chagina pipeline, a command list or a parenthesized command list)
633419d2e3deSDmitry Chaginand prints a time summary as described under the
633519d2e3deSDmitry Chagin.Va time
633619d2e3deSDmitry Chaginvariable.
633719d2e3deSDmitry ChaginIf necessary, an extra shell is created to print the time statistic when
633819d2e3deSDmitry Chaginthe command completes.
633919d2e3deSDmitry ChaginWithout
634019d2e3deSDmitry Chagin.Va command
634119d2e3deSDmitry Chagin, prints a time summary for the current shell and its
634219d2e3deSDmitry Chaginchildren.
634319d2e3deSDmitry Chagin.TP 8
634419d2e3deSDmitry Chagin.B umask \fR[
634519d2e3deSDmitry Chagin.Va value
634619d2e3deSDmitry Chagin]
634719d2e3deSDmitry ChaginSets the file creation mask to
634819d2e3deSDmitry Chagin.Va value
634919d2e3deSDmitry Chagin, which is given in octal.
635019d2e3deSDmitry ChaginCommon values for the mask are
635119d2e3deSDmitry Chagin002, giving all access to the group and read and execute access to others, and
635219d2e3deSDmitry Chagin022, giving read and execute access to the group and others.
635319d2e3deSDmitry ChaginWithout
635419d2e3deSDmitry Chagin.Va value
635519d2e3deSDmitry Chagin, prints the current file creation mask.
635619d2e3deSDmitry Chagin.TP 8
635719d2e3deSDmitry Chagin.B unalias
635819d2e3deSDmitry Chagin.Va pattern
635919d2e3deSDmitry Chagin.br
636019d2e3deSDmitry ChaginRemoves all aliases whose names match
636119d2e3deSDmitry Chagin.Va pattern
636219d2e3deSDmitry Chagin`unalias *' thus removes all aliases.
636319d2e3deSDmitry ChaginIt is not an error for nothing to be
636419d2e3deSDmitry Chagin.Va unalias
636519d2e3deSDmitry Chagined.
636619d2e3deSDmitry Chagin.TP 8
636719d2e3deSDmitry Chagin.B uncomplete
636819d2e3deSDmitry Chagin.Va pattern
636919d2e3deSDmitry Chagin(+)
637019d2e3deSDmitry ChaginRemoves all completions whose names match
637119d2e3deSDmitry Chagin.Va pattern
637219d2e3deSDmitry Chagin`uncomplete *' thus removes all completions.
637319d2e3deSDmitry ChaginIt is not an error for nothing to be
637419d2e3deSDmitry Chagin.Va uncomplete
637519d2e3deSDmitry Chagind.
637619d2e3deSDmitry Chagin.TP 8
637719d2e3deSDmitry Chagin.B unhash
637819d2e3deSDmitry ChaginDisables use of the internal hash table to speed location of
637919d2e3deSDmitry Chaginexecuted programs.
638019d2e3deSDmitry Chagin.TP 8
638119d2e3deSDmitry Chagin.B universe
638219d2e3deSDmitry Chagin.Va universe
638319d2e3deSDmitry Chagin(+)
638419d2e3deSDmitry ChaginSets the universe to
638519d2e3deSDmitry Chagin.Va universe
638619d2e3deSDmitry Chagin(Masscomp/RTU only)
638719d2e3deSDmitry Chagin.TP 8
638819d2e3deSDmitry Chagin.B unlimit \fR[
638919d2e3deSDmitry Chagin.Fl hf\fR] [
639019d2e3deSDmitry Chagin.Va resource
639119d2e3deSDmitry Chagin]
639219d2e3deSDmitry ChaginRemoves the limitation on
639319d2e3deSDmitry Chagin.Va resource
639419d2e3deSDmitry Chaginor, if no
639519d2e3deSDmitry Chagin.Va resource
639619d2e3deSDmitry Chaginis
639719d2e3deSDmitry Chaginspecified, all
639819d2e3deSDmitry Chagin.Va resource
639919d2e3deSDmitry Chaginlimitations.
640019d2e3deSDmitry ChaginWith
640119d2e3deSDmitry Chagin.Fl h\fR, the corresponding hard limits are removed.
640219d2e3deSDmitry ChaginOnly the super-user may do this.
640319d2e3deSDmitry ChaginNote that
640419d2e3deSDmitry Chagin.Va unlimit
640519d2e3deSDmitry Chaginmay not exit successful, since most systems
640619d2e3deSDmitry Chagindo not allow
640719d2e3deSDmitry Chagin.Va descriptors
640819d2e3deSDmitry Chaginto be unlimited.
640919d2e3deSDmitry ChaginWith
641019d2e3deSDmitry Chagin.Fl f\fR errors are ignored.
641119d2e3deSDmitry Chagin.TP 8
641219d2e3deSDmitry Chagin.B unset \fIpattern
641319d2e3deSDmitry ChaginRemoves all variables whose names match
641419d2e3deSDmitry Chagin.Va pattern
641519d2e3deSDmitry Chagin, unless they are read-only.
641619d2e3deSDmitry Chagin`unset *' thus removes all variables unless they are read-only;
641719d2e3deSDmitry Chaginthis is a bad idea.
641819d2e3deSDmitry ChaginIt is not an error for nothing to be
641919d2e3deSDmitry Chagin.Va unset
642019d2e3deSDmitry Chagin.TP 8
642119d2e3deSDmitry Chagin.B unsetenv \fIpattern
642219d2e3deSDmitry ChaginRemoves all environment variables whose names match
642319d2e3deSDmitry Chagin.Va pattern
642419d2e3deSDmitry Chagin`unsetenv *' thus removes all environment variables;
642519d2e3deSDmitry Chaginthis is a bad idea.
642619d2e3deSDmitry ChaginIt is not an error for nothing to be
642719d2e3deSDmitry Chagin.Va unsetenv
642819d2e3deSDmitry Chagined.
642919d2e3deSDmitry Chagin.TP 8
643019d2e3deSDmitry Chagin.B ver \fR[
643119d2e3deSDmitry Chagin.Va systype
643219d2e3deSDmitry Chagin[
643319d2e3deSDmitry Chagin.Va command
643419d2e3deSDmitry Chagin]] (+)
643519d2e3deSDmitry ChaginWithout arguments, prints
643619d2e3deSDmitry Chagin.Va SYSTYPE
643719d2e3deSDmitry ChaginWith
643819d2e3deSDmitry Chagin.Va systype
643919d2e3deSDmitry Chagin, sets
644019d2e3deSDmitry Chagin.Va SYSTYPE
644119d2e3deSDmitry Chaginto
644219d2e3deSDmitry Chagin.Va systype
644319d2e3deSDmitry ChaginWith
644419d2e3deSDmitry Chagin.Va systype
644519d2e3deSDmitry Chaginand
644619d2e3deSDmitry Chagin.Va command
644719d2e3deSDmitry Chagin, executes
644819d2e3deSDmitry Chagin.Va command
644919d2e3deSDmitry Chaginunder
645019d2e3deSDmitry Chagin.Va systype
645119d2e3deSDmitry Chagin.Va systype
645219d2e3deSDmitry Chaginmay be
645319d2e3deSDmitry Chagin.Sq bsd4.3
645419d2e3deSDmitry Chaginor
645519d2e3deSDmitry Chagin.Sq sys5.3
645619d2e3deSDmitry Chagin(Domain/OS only)
645719d2e3deSDmitry Chagin.TP 8
645819d2e3deSDmitry Chagin.B wait
645919d2e3deSDmitry ChaginThe shell waits for all background jobs.
646019d2e3deSDmitry ChaginIf the shell is interactive, an
646119d2e3deSDmitry Chagininterrupt will disrupt the wait and cause the shell to print the names and job
646219d2e3deSDmitry Chaginnumbers of all outstanding jobs.
646319d2e3deSDmitry Chagin.TP 8
646419d2e3deSDmitry Chagin.B warp
646519d2e3deSDmitry Chagin.Va universe
646619d2e3deSDmitry Chagin(+)
646719d2e3deSDmitry ChaginSets the universe to
646819d2e3deSDmitry Chagin.Va universe
646919d2e3deSDmitry Chagin(Convex/OS only)
647019d2e3deSDmitry Chagin.TP 8
647119d2e3deSDmitry Chagin.B watchlog \fR(+)
647219d2e3deSDmitry ChaginAn alternate name for the
647319d2e3deSDmitry Chagin.Va log
647419d2e3deSDmitry Chaginbuiltin command (q.v.).
647519d2e3deSDmitry ChaginAvailable only if the shell was so compiled;
647619d2e3deSDmitry Chaginsee the
647719d2e3deSDmitry Chagin.Va version
647819d2e3deSDmitry Chaginshell variable.
647919d2e3deSDmitry Chagin.TP 8
648019d2e3deSDmitry Chagin.B where
648119d2e3deSDmitry Chagin.Va command
648219d2e3deSDmitry Chagin(+)
648319d2e3deSDmitry ChaginReports all known instances of
648419d2e3deSDmitry Chagin.Va command
648519d2e3deSDmitry Chagin, including aliases, builtins and
648619d2e3deSDmitry Chaginexecutables in
648719d2e3deSDmitry Chagin.Va path
648819d2e3deSDmitry Chagin.TP 8
648919d2e3deSDmitry Chagin.B which\fR
649019d2e3deSDmitry Chagin.Va command
649119d2e3deSDmitry Chagin(+)
649219d2e3deSDmitry ChaginDisplays the command that will be executed by the shell after substitutions,
649319d2e3deSDmitry Chagin.Va path
649419d2e3deSDmitry Chaginsearching, etc.
649519d2e3deSDmitry ChaginThe builtin command is just like
649619d2e3deSDmitry Chagin.Va which
649719d2e3deSDmitry Chagin(1), but it correctly reports
649819d2e3deSDmitry Chagin.Nm
649919d2e3deSDmitry Chaginaliases and builtins and is 10 to 100 times faster.
650019d2e3deSDmitry ChaginSee also the
650119d2e3deSDmitry Chagin.Va which-command
650219d2e3deSDmitry Chagineditor command.
650319d2e3deSDmitry Chagin.Pp
650419d2e3deSDmitry Chagin.B while (\fIexpr
650519d2e3deSDmitry Chagin.Va )
650619d2e3deSDmitry Chagin.br
650719d2e3deSDmitry Chagin\&...
650819d2e3deSDmitry Chagin.PD 0
650919d2e3deSDmitry Chagin.TP 8
651019d2e3deSDmitry Chagin.B end
651119d2e3deSDmitry ChaginExecutes the commands between the
651219d2e3deSDmitry Chagin.Va while
651319d2e3deSDmitry Chaginand the matching
651419d2e3deSDmitry Chagin.Va end
651519d2e3deSDmitry Chaginwhile
651619d2e3deSDmitry Chagin.Va expr
651719d2e3deSDmitry Chagin(an expression, as described under
651819d2e3deSDmitry Chagin.Va Expressions
651919d2e3deSDmitry Chagin)
652019d2e3deSDmitry Chaginevaluates non-zero.
652119d2e3deSDmitry Chagin.Va while
652219d2e3deSDmitry Chaginand
652319d2e3deSDmitry Chagin.Va end
652419d2e3deSDmitry Chaginmust appear alone on their input lines.
652519d2e3deSDmitry Chagin.Va break
652619d2e3deSDmitry Chaginand
652719d2e3deSDmitry Chagin.Va continue
652819d2e3deSDmitry Chaginmay be used to terminate or continue the
652919d2e3deSDmitry Chaginloop prematurely.
653019d2e3deSDmitry ChaginIf the input is a terminal, the user is prompted the first time
653119d2e3deSDmitry Chaginthrough the loop as with
653219d2e3deSDmitry Chagin.Va foreach
653319d2e3deSDmitry Chagin.PD
653419d2e3deSDmitry Chagin.Ss "Special aliases (+)"
653519d2e3deSDmitry ChaginIf set, each of these aliases executes automatically at the indicated time.
653619d2e3deSDmitry ChaginThey are all initially undefined.
653719d2e3deSDmitry Chagin.TP 8
653819d2e3deSDmitry Chagin.B beepcmd
653919d2e3deSDmitry ChaginRuns when the shell wants to ring the terminal bell.
654019d2e3deSDmitry Chagin.TP 8
654119d2e3deSDmitry Chagin.B cwdcmd
654219d2e3deSDmitry ChaginRuns after every change of working directory.
654319d2e3deSDmitry ChaginFor example, if the user is
654419d2e3deSDmitry Chaginworking on an X window system using
654519d2e3deSDmitry Chagin.Va xterm
654619d2e3deSDmitry Chagin(1) and a re-parenting window
654719d2e3deSDmitry Chaginmanager that supports title bars such as
654819d2e3deSDmitry Chagin.Va twm
654919d2e3deSDmitry Chagin(1) and does
655019d2e3deSDmitry Chagin.RS +8
655119d2e3deSDmitry Chagin.IP "" 4
655219d2e3deSDmitry Chagin> alias cwdcmd  'echo \-n "^[]2;${HOST}:$cwd ^G"'
655319d2e3deSDmitry Chagin.Pp
655419d2e3deSDmitry Chaginthen the shell will change the title of the running
655519d2e3deSDmitry Chagin.Va xterm
655619d2e3deSDmitry Chagin(1)
655719d2e3deSDmitry Chaginto be the name of the host, a colon, and the full current working directory.
655819d2e3deSDmitry ChaginA fancier way to do that is
655919d2e3deSDmitry Chagin.IP "" 4
656019d2e3deSDmitry Chagin> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
656119d2e3deSDmitry Chagin.Pp
656219d2e3deSDmitry ChaginThis will put the hostname and working directory on the title bar but
656319d2e3deSDmitry Chaginonly the hostname in the icon manager menu.
656419d2e3deSDmitry Chagin.Pp
656519d2e3deSDmitry ChaginNote that putting a
656619d2e3deSDmitry Chagin.Va cd
656719d2e3deSDmitry Chagin,
656819d2e3deSDmitry Chagin.Va pushd
656919d2e3deSDmitry Chaginor
657019d2e3deSDmitry Chagin.Va popd
657119d2e3deSDmitry Chaginin
657219d2e3deSDmitry Chagin.Va cwdcmd
657319d2e3deSDmitry Chaginmay cause an infinite loop.
657419d2e3deSDmitry ChaginIt is the author's opinion that anyone doing
657519d2e3deSDmitry Chaginso will get what they deserve.
657619d2e3deSDmitry Chagin.RE
657719d2e3deSDmitry Chagin.TP 8
657819d2e3deSDmitry Chagin.B jobcmd
657919d2e3deSDmitry ChaginRuns before each command gets executed, or when the command changes state.
658019d2e3deSDmitry ChaginThis is similar to
658119d2e3deSDmitry Chagin.Va postcmd
658219d2e3deSDmitry Chagin, but it does not print builtins.
658319d2e3deSDmitry Chagin.RS +8
658419d2e3deSDmitry Chagin.IP "" 4
658519d2e3deSDmitry Chagin> alias jobcmd  'echo \-n "^[]2\e;\e!#:q^G"'
658619d2e3deSDmitry Chagin.Pp
658719d2e3deSDmitry Chaginthen executing
658819d2e3deSDmitry Chagin.Va vi foo.c
658919d2e3deSDmitry Chaginwill put the command string in the xterm title bar.
659019d2e3deSDmitry Chagin.RE
659119d2e3deSDmitry Chagin.TP 8
659219d2e3deSDmitry Chagin.B helpcommand
659319d2e3deSDmitry ChaginInvoked by the
659419d2e3deSDmitry Chagin.Va run-help
659519d2e3deSDmitry Chagineditor command.
659619d2e3deSDmitry ChaginThe command name for which help
659719d2e3deSDmitry Chaginis sought is passed as sole argument.
659819d2e3deSDmitry ChaginFor example, if one does
659919d2e3deSDmitry Chagin.RS +8
660019d2e3deSDmitry Chagin.IP "" 4
660119d2e3deSDmitry Chagin> alias helpcommand '\e!:1 --help'
660219d2e3deSDmitry Chagin.Pp
660319d2e3deSDmitry Chaginthen the help display of the command itself will be invoked, using the GNU
660419d2e3deSDmitry Chaginhelp calling convention.
660519d2e3deSDmitry ChaginCurrently there is no easy way to account for various calling conventions (e.g.,
660619d2e3deSDmitry Chaginthe customary Unix
660719d2e3deSDmitry Chagin.Sq -h
660819d2e3deSDmitry Chagin), except by using a table of many commands.
660919d2e3deSDmitry Chagin.RE
661019d2e3deSDmitry Chagin.TP 8
661119d2e3deSDmitry Chagin.B periodic
661219d2e3deSDmitry ChaginRuns every
661319d2e3deSDmitry Chagin.Va tperiod
661419d2e3deSDmitry Chaginminutes.
661519d2e3deSDmitry ChaginThis provides a convenient means for
661619d2e3deSDmitry Chaginchecking on common but infrequent changes such as new mail.
661719d2e3deSDmitry ChaginFor example,
661819d2e3deSDmitry Chaginif one does
661919d2e3deSDmitry Chagin.RS +8
662019d2e3deSDmitry Chagin.IP "" 4
662119d2e3deSDmitry Chagin> set tperiod = 30
662219d2e3deSDmitry Chagin.br
662319d2e3deSDmitry Chagin> alias periodic checknews
662419d2e3deSDmitry Chagin.Pp
662519d2e3deSDmitry Chaginthen the
662619d2e3deSDmitry Chagin.Va checknews
662719d2e3deSDmitry Chagin(1) program runs every 30 minutes.
662819d2e3deSDmitry ChaginIf
662919d2e3deSDmitry Chagin.Va periodic
663019d2e3deSDmitry Chaginis set but
663119d2e3deSDmitry Chagin.Va tperiod
663219d2e3deSDmitry Chaginis unset or set to 0,
663319d2e3deSDmitry Chagin.Va periodic
663419d2e3deSDmitry Chaginbehaves like
663519d2e3deSDmitry Chagin.Va precmd
663619d2e3deSDmitry Chagin.RE
663719d2e3deSDmitry Chagin.TP 8
663819d2e3deSDmitry Chagin.B precmd
663919d2e3deSDmitry ChaginRuns just before each prompt is printed.
664019d2e3deSDmitry ChaginFor example, if one does
664119d2e3deSDmitry Chagin.RS +8
664219d2e3deSDmitry Chagin.IP "" 4
664319d2e3deSDmitry Chagin> alias precmd date
664419d2e3deSDmitry Chagin.Pp
664519d2e3deSDmitry Chaginthen
664619d2e3deSDmitry Chagin.Va date
664719d2e3deSDmitry Chagin(1) runs just before the shell prompts for each command.
664819d2e3deSDmitry ChaginThere are no limits on what
664919d2e3deSDmitry Chagin.Va precmd
665019d2e3deSDmitry Chagincan be set to do, but discretion
665119d2e3deSDmitry Chaginshould be used.
665219d2e3deSDmitry Chagin.RE
665319d2e3deSDmitry Chagin.TP 8
665419d2e3deSDmitry Chagin.B postcmd
665519d2e3deSDmitry ChaginRuns before each command gets executed.
665619d2e3deSDmitry Chagin.RS +8
665719d2e3deSDmitry Chagin.IP "" 4
665819d2e3deSDmitry Chagin> alias postcmd  'echo \-n "^[]2\e;\e!#:q^G"'
665919d2e3deSDmitry Chagin.Pp
666019d2e3deSDmitry Chaginthen executing
666119d2e3deSDmitry Chagin.Va vi foo.c
666219d2e3deSDmitry Chaginwill put the command string in the xterm title bar.
666319d2e3deSDmitry Chagin.RE
666419d2e3deSDmitry Chagin.TP 8
666519d2e3deSDmitry Chagin.B shell
666619d2e3deSDmitry ChaginSpecifies the interpreter for executable scripts which do not themselves
666719d2e3deSDmitry Chaginspecify an interpreter.
666819d2e3deSDmitry ChaginThe first word should be a full path name to the
666919d2e3deSDmitry Chagindesired interpreter (e.g.,
667019d2e3deSDmitry Chagin.Sq /bin/csh
667119d2e3deSDmitry Chaginor
667219d2e3deSDmitry Chagin.Sq /usr/local/bin/tcsh
667319d2e3deSDmitry Chagin).
667419d2e3deSDmitry Chagin.Ss "Special shell variables"
667519d2e3deSDmitry ChaginThe variables described in this section have special meaning to the shell.
667619d2e3deSDmitry Chagin.Pp
667719d2e3deSDmitry ChaginThe shell sets
667819d2e3deSDmitry Chagin.Va addsuffix ,
667919d2e3deSDmitry Chagin.Va argv ,
668019d2e3deSDmitry Chagin.Va autologout ,
668119d2e3deSDmitry Chagin.Va csubstnonl ,
668219d2e3deSDmitry Chagin.Va command ,
668319d2e3deSDmitry Chagin.Va echo_style ,
668419d2e3deSDmitry Chagin.Va edit ,
668519d2e3deSDmitry Chagin.Va gid ,
668619d2e3deSDmitry Chagin.Va group ,
668719d2e3deSDmitry Chagin.Va home ,
668819d2e3deSDmitry Chagin.Va loginsh ,
668919d2e3deSDmitry Chagin.Va oid ,
669019d2e3deSDmitry Chagin.Va path ,
669119d2e3deSDmitry Chagin.Va prompt ,
669219d2e3deSDmitry Chagin.Va prompt2 ,
669319d2e3deSDmitry Chagin.Va prompt3 ,
669419d2e3deSDmitry Chagin.Va shell ,
669519d2e3deSDmitry Chagin.Va shlvl ,
669619d2e3deSDmitry Chagin.Va tcsh ,
669719d2e3deSDmitry Chagin.Va term ,
669819d2e3deSDmitry Chagin.Va tty ,
669919d2e3deSDmitry Chagin.Va uid ,
670019d2e3deSDmitry Chagin.Va user
670119d2e3deSDmitry Chaginand
670219d2e3deSDmitry Chagin.Va version
670319d2e3deSDmitry Chaginat
670419d2e3deSDmitry Chaginstartup; they do not change thereafter unless changed by the user.
670519d2e3deSDmitry ChaginThe shell updates
670619d2e3deSDmitry Chagin.Va cwd ,
670719d2e3deSDmitry Chagin.Va dirstack ,
670819d2e3deSDmitry Chagin.Va owd
670919d2e3deSDmitry Chaginand
671019d2e3deSDmitry Chagin.Va status
671119d2e3deSDmitry Chaginwhen necessary,
671219d2e3deSDmitry Chaginand sets
671319d2e3deSDmitry Chagin.Va logout
671419d2e3deSDmitry Chaginon logout.
671519d2e3deSDmitry Chagin.Pp
671619d2e3deSDmitry ChaginThe shell synchronizes
671719d2e3deSDmitry Chagin.Va group ,
671819d2e3deSDmitry Chagin.Va home ,
671919d2e3deSDmitry Chagin.Va path ,
672019d2e3deSDmitry Chagin.Va shlvl ,
672119d2e3deSDmitry Chagin.Va term and
672219d2e3deSDmitry Chagin.Va user
672319d2e3deSDmitry Chaginwith the environment variables of the same names:
672419d2e3deSDmitry Chaginwhenever the environment variable changes the shell changes the corresponding
672519d2e3deSDmitry Chaginshell variable to match (unless the shell variable is read-only) and vice
672619d2e3deSDmitry Chaginversa.
672719d2e3deSDmitry ChaginNote that although
672819d2e3deSDmitry Chagin.Va cwd
672919d2e3deSDmitry Chaginand
673019d2e3deSDmitry Chagin.Va PWD
673119d2e3deSDmitry Chaginhave identical meanings, they
673219d2e3deSDmitry Chaginare not synchronized in this manner, and that the shell automatically
673319d2e3deSDmitry Chaginconverts between the different formats of
673419d2e3deSDmitry Chagin.Va path
673519d2e3deSDmitry Chaginand
673619d2e3deSDmitry Chagin.Va PATH
673719d2e3deSDmitry Chagin.TP 8
673819d2e3deSDmitry Chagin.B addsuffix \fR(+)
673919d2e3deSDmitry ChaginIf set, filename completion adds
674019d2e3deSDmitry Chagin.Sq /
674119d2e3deSDmitry Chaginto the end of directories and a space
674219d2e3deSDmitry Chaginto the end of normal files when they are matched exactly.
674319d2e3deSDmitry ChaginSet by default.
674419d2e3deSDmitry Chagin.TP 8
674519d2e3deSDmitry Chagin.B afsuser \fR(+)
674619d2e3deSDmitry ChaginIf set,
674719d2e3deSDmitry Chagin.Va autologout
674819d2e3deSDmitry Chagin's autolock feature uses its value instead of
674919d2e3deSDmitry Chaginthe local username for kerberos authentication.
675019d2e3deSDmitry Chagin.TP 8
675119d2e3deSDmitry Chagin.B ampm \fR(+)
675219d2e3deSDmitry ChaginIf set, all times are shown in 12-hour AM/PM format.
675319d2e3deSDmitry Chagin.TP 8
675419d2e3deSDmitry Chagin.B anyerror \fR(+)
675519d2e3deSDmitry ChaginThis variable selects what is propagated to the value of the
675619d2e3deSDmitry Chagin.Va status
675719d2e3deSDmitry Chaginvariable. For more information see the description of the
675819d2e3deSDmitry Chagin.Va status
675919d2e3deSDmitry Chaginvariable below.
676019d2e3deSDmitry Chagin.TP 8
676119d2e3deSDmitry Chagin.B argv
676219d2e3deSDmitry ChaginThe arguments to the shell.
676319d2e3deSDmitry ChaginPositional parameters are taken from
676419d2e3deSDmitry Chagin.Va argv
676519d2e3deSDmitry Chagin,
676619d2e3deSDmitry Chagini.e.,
676719d2e3deSDmitry Chagin.Sq $1
676819d2e3deSDmitry Chaginis replaced by
676919d2e3deSDmitry Chagin.Sq $argv[1]
677019d2e3deSDmitry Chagin, etc.
677119d2e3deSDmitry ChaginSet by default, but usually empty in interactive shells.
677219d2e3deSDmitry Chagin.TP 8
677319d2e3deSDmitry Chagin.B autocorrect \fR(+)
677419d2e3deSDmitry ChaginIf set, the
677519d2e3deSDmitry Chagin.Va spell-word
677619d2e3deSDmitry Chagineditor command is invoked automatically before
677719d2e3deSDmitry Chagineach completion attempt.
677819d2e3deSDmitry Chagin.TP 8
677919d2e3deSDmitry Chagin.B autoexpand \fR(+)
678019d2e3deSDmitry ChaginIf set, the
678119d2e3deSDmitry Chagin.Va expand-history
678219d2e3deSDmitry Chagineditor command is invoked automatically
678319d2e3deSDmitry Chaginbefore each completion attempt. If this is set to
678419d2e3deSDmitry Chagin.Va onlyhistory
678519d2e3deSDmitry Chagin, then
678619d2e3deSDmitry Chaginonly history will be expanded and a second completion will expand filenames.
678719d2e3deSDmitry Chagin.TP 8
678819d2e3deSDmitry Chagin.B autolist \fR(+)
678919d2e3deSDmitry ChaginIf set, possibilities are listed after an ambiguous completion.
679019d2e3deSDmitry ChaginIf set to
679119d2e3deSDmitry Chagin.Sq ambiguous
679219d2e3deSDmitry Chagin, possibilities are listed only when no new
679319d2e3deSDmitry Chagincharacters are added by completion.
679419d2e3deSDmitry Chagin.TP 8
679519d2e3deSDmitry Chagin.B autologout \fR(+)
679619d2e3deSDmitry ChaginThe first word is the number of minutes of inactivity before automatic
679719d2e3deSDmitry Chaginlogout.
679819d2e3deSDmitry ChaginThe optional second word is the number of minutes of inactivity
679919d2e3deSDmitry Chaginbefore automatic locking.
680019d2e3deSDmitry ChaginWhen the shell automatically logs out, it prints
680119d2e3deSDmitry Chagin.Sq auto-logout
680219d2e3deSDmitry Chagin, sets the
680319d2e3deSDmitry Chaginvariable
680419d2e3deSDmitry Chagin.Va logout
680519d2e3deSDmitry Chaginto
680619d2e3deSDmitry Chagin.Sq automatic
680719d2e3deSDmitry Chaginand exits.
680819d2e3deSDmitry ChaginWhen the shell automatically locks, the user is required to enter his password
680919d2e3deSDmitry Chaginto continue working.
681019d2e3deSDmitry ChaginFive incorrect attempts result in automatic logout.
681119d2e3deSDmitry ChaginSet to
681219d2e3deSDmitry Chagin.Sq 60
681319d2e3deSDmitry Chagin(automatic logout after 60 minutes, and no locking) by default
681419d2e3deSDmitry Chaginin login and superuser shells, but not if the shell thinks it is running
681519d2e3deSDmitry Chaginunder a window system (i.e., the
681619d2e3deSDmitry Chagin.Va DISPLAY
681719d2e3deSDmitry Chaginenvironment variable is set),
681819d2e3deSDmitry Chaginthe tty is a pseudo-tty (pty) or the shell was not so compiled (see the
681919d2e3deSDmitry Chagin.Va version
682019d2e3deSDmitry Chaginshell variable).
6821*5224c2a3SDmitry ChaginUnset
6822*5224c2a3SDmitry Chagin.Va autologout or set it to
6823*5224c2a3SDmitry Chagin.Dv 0
6824*5224c2a3SDmitry Chaginto disable automatic logout.
682519d2e3deSDmitry ChaginSee also the
682619d2e3deSDmitry Chagin.Va afsuser
682719d2e3deSDmitry Chaginand
682819d2e3deSDmitry Chagin.Va logout
682919d2e3deSDmitry Chaginshell variables.
683019d2e3deSDmitry Chagin.TP 8
683119d2e3deSDmitry Chagin.B autorehash \fR(+)
683219d2e3deSDmitry ChaginIf set, the internal hash table of the contents of the directories in the
683319d2e3deSDmitry Chagin.Va path
683419d2e3deSDmitry Chaginvariable will be recomputed if a command is not found in the hash
683519d2e3deSDmitry Chagintable.
683619d2e3deSDmitry ChaginIn addition, the list of available commands will be rebuilt for each
683719d2e3deSDmitry Chagincommand completion or spelling correction attempt if set to
683819d2e3deSDmitry Chagin.Sq complete
683919d2e3deSDmitry Chaginor
684019d2e3deSDmitry Chagin`correct' respectively; if set to
684119d2e3deSDmitry Chagin.Sq always
684219d2e3deSDmitry Chagin, this will be done for both
684319d2e3deSDmitry Chagincases.
684419d2e3deSDmitry Chagin.TP 8
684519d2e3deSDmitry Chagin.B backslash_quote \fR(+)
684619d2e3deSDmitry Chagin.\" TODO
684719d2e3deSDmitry ChaginIf set, backslashes (`\e') always quote
684819d2e3deSDmitry Chagin.Sq \e
684919d2e3deSDmitry Chagin,
685019d2e3deSDmitry Chagin.Sq \&' ,
685119d2e3deSDmitry Chaginand
685219d2e3deSDmitry Chagin.Sq \&"
685319d2e3deSDmitry ChaginThis may make
685419d2e3deSDmitry Chagincomplex quoting tasks easier, but it can cause syntax errors in
685519d2e3deSDmitry Chagin.Xr csh 1
685619d2e3deSDmitry Chaginscripts.
685719d2e3deSDmitry Chagin.TP 8
685819d2e3deSDmitry Chagin.B catalog
685919d2e3deSDmitry ChaginThe file name of the message catalog.
686019d2e3deSDmitry ChaginIf set, tcsh use
686119d2e3deSDmitry Chagin.Sq tcsh.${catalog}
686219d2e3deSDmitry Chaginas a message catalog instead of
686319d2e3deSDmitry Chagindefault
686419d2e3deSDmitry Chagin.Sq tcsh
686519d2e3deSDmitry Chagin.TP 8
686619d2e3deSDmitry Chagin.B cdpath
686719d2e3deSDmitry ChaginA list of directories in which
686819d2e3deSDmitry Chagin.Va cd
686919d2e3deSDmitry Chaginshould search for
687019d2e3deSDmitry Chaginsubdirectories if they aren't found in the current directory.
687119d2e3deSDmitry Chagin.TP 8
687219d2e3deSDmitry Chagin.B cdtohome \fR(+)
687319d2e3deSDmitry ChaginIf not set,
687419d2e3deSDmitry Chagin.Va cd
687519d2e3deSDmitry Chaginrequires a directory
687619d2e3deSDmitry Chagin.Va name
687719d2e3deSDmitry Chagin, and will not go to the
687819d2e3deSDmitry Chagin.Va home
687919d2e3deSDmitry Chagindirectory if it's omitted.
688019d2e3deSDmitry ChaginThis is set by default.
688119d2e3deSDmitry Chagin.TP 8
688219d2e3deSDmitry Chagin.B color
688319d2e3deSDmitry ChaginIf set, it enables color display for the builtin \fBls\-F\fR and it passes
688419d2e3deSDmitry Chagin.Fl \-color=auto\fR to
688519d2e3deSDmitry Chagin.Va ls
688619d2e3deSDmitry ChaginAlternatively, it can be set to only
688719d2e3deSDmitry Chagin\fBls\-F\fR or only
688819d2e3deSDmitry Chagin.Va ls
688919d2e3deSDmitry Chaginto enable color to only one command.
689019d2e3deSDmitry ChaginSetting
689119d2e3deSDmitry Chaginit to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
689219d2e3deSDmitry Chagin.TP 8
689319d2e3deSDmitry Chagin.B colorcat
689419d2e3deSDmitry ChaginIf set, it enables color escape sequence for NLS message files.
689519d2e3deSDmitry ChaginAnd display colorful NLS messages.
689619d2e3deSDmitry Chagin.TP 8
689719d2e3deSDmitry Chagin.B command \fR(+)
689819d2e3deSDmitry ChaginIf set, the command which was passed to the shell with the
689919d2e3deSDmitry Chagin.Va -c
690019d2e3deSDmitry Chaginflag (q.v.).
690119d2e3deSDmitry Chagin.TP 8
690219d2e3deSDmitry Chagin.B compat_expr \fR(+)
690319d2e3deSDmitry ChaginIf set, the shell will evaluate expressions right to left, like the original
690419d2e3deSDmitry Chagin.Xr csh 1
690519d2e3deSDmitry Chagin.TP 8
690619d2e3deSDmitry Chagin.B complete \fR(+)
690719d2e3deSDmitry ChaginIf set to
690819d2e3deSDmitry Chagin.Sq igncase
690919d2e3deSDmitry Chagin, the completion becomes case insensitive.
691019d2e3deSDmitry ChaginIf set to
691119d2e3deSDmitry Chagin.Sq enhance
691219d2e3deSDmitry Chagin, completion ignores case and considers
691319d2e3deSDmitry Chaginhyphens and underscores to be equivalent; it will also treat
691419d2e3deSDmitry Chaginperiods, hyphens and underscores (`.',
691519d2e3deSDmitry Chagin.Sq \-
691619d2e3deSDmitry Chaginand
691719d2e3deSDmitry Chagin.Sq _
691819d2e3deSDmitry Chagin) as word
691919d2e3deSDmitry Chaginseparators.
692019d2e3deSDmitry ChaginIf set to
692119d2e3deSDmitry Chagin.Sq Enhance
692219d2e3deSDmitry Chagin, completion matches uppercase and underscore
692319d2e3deSDmitry Chagincharacters explicitly and matches lowercase and hyphens in a
692419d2e3deSDmitry Chagincase-insensitive manner; it will treat periods, hyphens and underscores
692519d2e3deSDmitry Chaginas word separators.
692619d2e3deSDmitry Chagin.TP 8
692719d2e3deSDmitry Chagin.B continue \fR(+)
692819d2e3deSDmitry ChaginIf set to a list of commands, the shell will continue the listed
692919d2e3deSDmitry Chagincommands, instead of starting a new one.
693019d2e3deSDmitry Chagin.TP 8
693119d2e3deSDmitry Chagin.B continue_args \fR(+)
693219d2e3deSDmitry ChaginSame as continue, but the shell will execute:
693319d2e3deSDmitry Chagin.RS +8
693419d2e3deSDmitry Chagin.IP "" 4
693519d2e3deSDmitry Chaginecho \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
693619d2e3deSDmitry Chagin.RE
693719d2e3deSDmitry Chagin.TP 8
693819d2e3deSDmitry Chagin.B correct \fR(+)
693919d2e3deSDmitry ChaginIf set to
694019d2e3deSDmitry Chagin.Sq cmd
694119d2e3deSDmitry Chagin, commands are automatically spelling-corrected.
694219d2e3deSDmitry ChaginIf set to
694319d2e3deSDmitry Chagin.Sq complete
694419d2e3deSDmitry Chagin, commands are automatically completed.
694519d2e3deSDmitry ChaginIf set to
694619d2e3deSDmitry Chagin.Sq all
694719d2e3deSDmitry Chagin, the entire command line is corrected.
694819d2e3deSDmitry Chagin.TP 8
694919d2e3deSDmitry Chagin.B csubstnonl \fR(+)
695019d2e3deSDmitry ChaginIf set, newlines and carriage returns in command substitution are
695119d2e3deSDmitry Chaginreplaced by spaces.
695219d2e3deSDmitry ChaginSet by default.
695319d2e3deSDmitry Chagin.TP 8
695419d2e3deSDmitry Chagin.B cwd
695519d2e3deSDmitry ChaginThe full pathname of the current directory.
695619d2e3deSDmitry ChaginSee also the
695719d2e3deSDmitry Chagin.Va dirstack
695819d2e3deSDmitry Chaginand
695919d2e3deSDmitry Chagin.Va owd
696019d2e3deSDmitry Chaginshell variables.
696119d2e3deSDmitry Chagin.TP 8
696219d2e3deSDmitry Chagin.B dextract \fR(+)
696319d2e3deSDmitry ChaginIf set,
696419d2e3deSDmitry Chagin.Sq pushd +
696519d2e3deSDmitry Chagin.Va n
696619d2e3deSDmitry Chaginextracts the
696719d2e3deSDmitry Chagin.Va n
696819d2e3deSDmitry Chaginth directory from the directory
696919d2e3deSDmitry Chaginstack rather than rotating it to the top.
697019d2e3deSDmitry Chagin.TP 8
697119d2e3deSDmitry Chagin.B dirsfile \fR(+)
697219d2e3deSDmitry ChaginThe default location in which
697319d2e3deSDmitry Chagin.Sq dirs \-S
697419d2e3deSDmitry Chaginand
697519d2e3deSDmitry Chagin.Sq dirs \-L
697619d2e3deSDmitry Chaginlook for
697719d2e3deSDmitry Chagina history file.
697819d2e3deSDmitry ChaginIf unset,
697919d2e3deSDmitry Chagin.Va ~/.cshdirs
698019d2e3deSDmitry Chaginis used.
698119d2e3deSDmitry ChaginBecause only
698219d2e3deSDmitry Chagin.Va ~/.tcshrc
698319d2e3deSDmitry Chaginis normally sourced before
698419d2e3deSDmitry Chagin.Va ~/.cshdirs
698519d2e3deSDmitry Chagin,
698619d2e3deSDmitry Chagin.Va dirsfile
698719d2e3deSDmitry Chaginshould be set in
698819d2e3deSDmitry Chagin.Va ~/.tcshrc
698919d2e3deSDmitry Chaginrather than
699019d2e3deSDmitry Chagin.Va ~/.login
699119d2e3deSDmitry Chagin.TP 8
699219d2e3deSDmitry Chagin.B dirstack \fR(+)
699319d2e3deSDmitry ChaginAn array of all the directories on the directory stack.
699419d2e3deSDmitry Chagin`$dirstack[1]' is the current working directory,
699519d2e3deSDmitry Chagin.Sq $dirstack[2]
699619d2e3deSDmitry Chaginthe first directory on the stack, etc.
699719d2e3deSDmitry ChaginNote that the current working directory is
699819d2e3deSDmitry Chagin.Sq $dirstack[1]
699919d2e3deSDmitry Chaginbut
700019d2e3deSDmitry Chagin.Sq =0
700119d2e3deSDmitry Chaginin
700219d2e3deSDmitry Chagindirectory stack substitutions, etc.
700319d2e3deSDmitry ChaginOne can change the stack arbitrarily by setting
700419d2e3deSDmitry Chagin.Va dirstack
700519d2e3deSDmitry Chagin,
700619d2e3deSDmitry Chaginbut the first element (the current working directory) is always correct.
700719d2e3deSDmitry ChaginSee also the
700819d2e3deSDmitry Chagin.Va cwd
700919d2e3deSDmitry Chaginand
701019d2e3deSDmitry Chagin.Va owd
701119d2e3deSDmitry Chaginshell variables.
701219d2e3deSDmitry Chagin.TP 8
701319d2e3deSDmitry Chagin.B dspmbyte \fR(+)
701419d2e3deSDmitry ChaginHas an effect iff 'dspm' is listed as part of the
701519d2e3deSDmitry Chagin.Va version
701619d2e3deSDmitry Chaginshell variable.
701719d2e3deSDmitry ChaginIf set to
701819d2e3deSDmitry Chagin.Sq euc
701919d2e3deSDmitry Chagin, it enables display and editing EUC-kanji(Japanese) code.
702019d2e3deSDmitry ChaginIf set to
702119d2e3deSDmitry Chagin.Sq sjis
702219d2e3deSDmitry Chagin, it enables display and editing Shift-JIS(Japanese) code.
702319d2e3deSDmitry ChaginIf set to
702419d2e3deSDmitry Chagin.Sq big5
702519d2e3deSDmitry Chagin, it enables display and editing Big5(Chinese) code.
702619d2e3deSDmitry ChaginIf set to
702719d2e3deSDmitry Chagin.Sq utf8
702819d2e3deSDmitry Chagin, it enables display and editing Utf8(Unicode) code.
702919d2e3deSDmitry ChaginIf set to the following format, it enables display and editing of original
703019d2e3deSDmitry Chaginmulti-byte code format:
703119d2e3deSDmitry Chagin.RS +8
703219d2e3deSDmitry Chagin.IP "" 4
703319d2e3deSDmitry Chagin> set dspmbyte = 0000....(256 bytes)....0000
703419d2e3deSDmitry Chagin.Pp
703519d2e3deSDmitry ChaginThe table requires
703619d2e3deSDmitry Chagin.Va just
703719d2e3deSDmitry Chagin256 bytes.
703819d2e3deSDmitry ChaginEach character of 256 characters
703919d2e3deSDmitry Chagincorresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
704019d2e3deSDmitry ChaginEach
704119d2e3deSDmitry Chagincharacter
704219d2e3deSDmitry Chagin.\" (position in this table?)
704319d2e3deSDmitry Chaginis set to number 0,1,2 and 3.
704419d2e3deSDmitry ChaginEach number has the following meaning:
704519d2e3deSDmitry Chagin.br
704619d2e3deSDmitry Chagin0 ... not used for multi-byte characters.
704719d2e3deSDmitry Chagin.br
704819d2e3deSDmitry Chagin1 ... used for the first byte of a multi-byte character.
704919d2e3deSDmitry Chagin.br
705019d2e3deSDmitry Chagin2 ... used for the second byte of a multi-byte character.
705119d2e3deSDmitry Chagin.br
705219d2e3deSDmitry Chagin3 ... used for both the first byte and second byte of a multi-byte character.
705319d2e3deSDmitry Chagin.\" SHK: I tried my best to get the following to be grammatically correct.
705419d2e3deSDmitry Chagin.\" However, I still don't understand what's going on here.
705519d2e3deSDmitry ChaginIn the
705619d2e3deSDmitry Chagin.\" following example, there are three bytes, but the text seems to refer to
705719d2e3deSDmitry Chagin.\" each nybble as a character.
705819d2e3deSDmitry ChaginWhat's going on here?  It this 3-byte code
705919d2e3deSDmitry Chagin.\" in the table?  The text above seems to imply that there are 256
706019d2e3deSDmitry Chagin.\" characters/bytes in the table.
706119d2e3deSDmitry ChaginIf I get some more info on this (perhaps
706219d2e3deSDmitry Chagin.\" a complete example), I could fix the text to be grammatically correct.
706319d2e3deSDmitry Chagin.\" (steve.kelem@xilinx.com 1999/09/13)
706419d2e3deSDmitry Chagin.Pp
706519d2e3deSDmitry ChaginExample:
706619d2e3deSDmitry Chagin.br
706719d2e3deSDmitry ChaginIf set to
706819d2e3deSDmitry Chagin.Sq 001322
706919d2e3deSDmitry Chagin, the first character (means 0x00 of the ASCII code) and
707019d2e3deSDmitry Chaginsecond character (means 0x01 of ASCII code) are set to
707119d2e3deSDmitry Chagin.Sq 0
707219d2e3deSDmitry ChaginThen, it is not
707319d2e3deSDmitry Chaginused for multi-byte characters.
707419d2e3deSDmitry ChaginThe 3rd character (0x02) is set to '1',
707519d2e3deSDmitry Chaginindicating that it is used for the first byte of a multi-byte character.
707619d2e3deSDmitry ChaginThe 4th character(0x03) is set '3'.
707719d2e3deSDmitry ChaginIt is used for both the first byte and
707819d2e3deSDmitry Chaginthe second byte of a multi-byte character.
707919d2e3deSDmitry ChaginThe 5th and 6th characters
708019d2e3deSDmitry Chagin(0x04,0x05) are set to '2', indicating that they are used for the second
708119d2e3deSDmitry Chaginbyte of a multi-byte character.
708219d2e3deSDmitry Chagin.Pp
708319d2e3deSDmitry ChaginThe GNU fileutils version of ls cannot display multi-byte
708419d2e3deSDmitry Chaginfilenames without the -N ( --literal ) option.
708519d2e3deSDmitry ChaginIf you are using
708619d2e3deSDmitry Chaginthis version, set the second word of dspmbyte to "ls".
708719d2e3deSDmitry ChaginIf not, for
708819d2e3deSDmitry Chaginexample, "ls-F -l" cannot display multi-byte filenames.
708919d2e3deSDmitry Chagin.Pp
709019d2e3deSDmitry ChaginNote:
709119d2e3deSDmitry Chagin.br
709219d2e3deSDmitry ChaginThis variable can only be used if KANJI and DSPMBYTE has been defined at
709319d2e3deSDmitry Chagincompile time.
709419d2e3deSDmitry Chagin.RE
709519d2e3deSDmitry Chagin.TP 8
709619d2e3deSDmitry Chagin.B dunique \fR(+)
709719d2e3deSDmitry ChaginIf set,
709819d2e3deSDmitry Chagin.Va pushd
709919d2e3deSDmitry Chaginremoves any instances of
710019d2e3deSDmitry Chagin.Va name
710119d2e3deSDmitry Chaginfrom the stack before pushing it onto the stack.
710219d2e3deSDmitry Chagin.TP 8
710319d2e3deSDmitry Chagin.B echo
710419d2e3deSDmitry ChaginIf set, each command with its arguments is echoed just before it is
710519d2e3deSDmitry Chaginexecuted.
710619d2e3deSDmitry ChaginFor non-builtin commands all expansions occur before
710719d2e3deSDmitry Chaginechoing.
710819d2e3deSDmitry ChaginBuiltin commands are echoed before command and filename
710919d2e3deSDmitry Chaginsubstitution, because these substitutions are then done selectively.
711019d2e3deSDmitry ChaginSet by the
711119d2e3deSDmitry Chagin.Fl x\fR command line option.
711219d2e3deSDmitry Chagin.TP 8
711319d2e3deSDmitry Chagin.B echo_style \fR(+)
711419d2e3deSDmitry ChaginThe style of the
711519d2e3deSDmitry Chagin.Va echo
711619d2e3deSDmitry Chaginbuiltin.
711719d2e3deSDmitry ChaginMay be set to
711819d2e3deSDmitry Chagin.Pp
711919d2e3deSDmitry Chagin.RS +8
712019d2e3deSDmitry Chagin.PD 0
712119d2e3deSDmitry Chagin.TP 8
712219d2e3deSDmitry Chaginbsd
712319d2e3deSDmitry ChaginDon't echo a newline if the first argument is
712419d2e3deSDmitry Chagin.Sq \-n ;
712519d2e3deSDmitry Chaginthe default for
712619d2e3deSDmitry Chagin.Xr csh 1
712719d2e3deSDmitry Chagin.TP 8
712819d2e3deSDmitry Chaginsysv
712919d2e3deSDmitry ChaginRecognize backslashed escape sequences in echo strings.
713019d2e3deSDmitry Chagin.TP 8
713119d2e3deSDmitry Chaginboth
713219d2e3deSDmitry ChaginRecognize both the
713319d2e3deSDmitry Chagin.Sq \-n
713419d2e3deSDmitry Chaginflag and backslashed escape sequences; the default
713519d2e3deSDmitry Chaginfor
713619d2e3deSDmitry Chagin.Nm
713719d2e3deSDmitry Chagin.TP 8
713819d2e3deSDmitry Chaginnone
713919d2e3deSDmitry ChaginRecognize neither.
714019d2e3deSDmitry Chagin.PD
714119d2e3deSDmitry Chagin.Pp
714219d2e3deSDmitry ChaginSet by default to the local system default.
714319d2e3deSDmitry ChaginThe BSD and System V
714419d2e3deSDmitry Chaginoptions are described in the
714519d2e3deSDmitry Chagin.Va echo
714619d2e3deSDmitry Chagin(1) man pages on the appropriate
714719d2e3deSDmitry Chaginsystems.
714819d2e3deSDmitry Chagin.RE
714919d2e3deSDmitry Chagin.TP 8
715019d2e3deSDmitry Chagin.B edit \fR(+)
715119d2e3deSDmitry ChaginIf set, the command-line editor is used.
715219d2e3deSDmitry ChaginSet by default in interactive
715319d2e3deSDmitry Chaginshells.
715419d2e3deSDmitry Chagin.TP 8
715519d2e3deSDmitry Chagin.B editors \fR(+)
715619d2e3deSDmitry ChaginA list of command names for the
715719d2e3deSDmitry Chagin.Va run-fg-editor
715819d2e3deSDmitry Chagineditor command to match.
715919d2e3deSDmitry ChaginIf not set, the
716019d2e3deSDmitry Chagin.Va EDITOR
716119d2e3deSDmitry Chagin(`ed' if unset) and
716219d2e3deSDmitry Chagin.Va VISUAL
716319d2e3deSDmitry Chagin(`vi' if unset)
716419d2e3deSDmitry Chaginenvironment variables will be used instead.
716519d2e3deSDmitry Chagin.TP 8
716619d2e3deSDmitry Chagin.B ellipsis \fR(+)
716719d2e3deSDmitry ChaginIf set, the
716819d2e3deSDmitry Chagin.Sq %c
716919d2e3deSDmitry Chagin/`%.' and
717019d2e3deSDmitry Chagin.Sq %C
717119d2e3deSDmitry Chaginprompt sequences (see the
717219d2e3deSDmitry Chagin.Va prompt
717319d2e3deSDmitry Chaginshell variable) indicate skipped directories with an ellipsis (`...')
717419d2e3deSDmitry Chagininstead of
717519d2e3deSDmitry Chagin.Sq /<skipped>
717619d2e3deSDmitry Chagin.TP 8
717719d2e3deSDmitry Chagin.B euid \fR(+)
717819d2e3deSDmitry ChaginThe user's effective user ID.
717919d2e3deSDmitry Chagin.TP 8
718019d2e3deSDmitry Chagin.B euser \fR(+)
718119d2e3deSDmitry ChaginThe first matching passwd entry name corresponding to the effective user ID.
718219d2e3deSDmitry Chagin.TP 8
718319d2e3deSDmitry Chagin.B fignore \fR(+)
718419d2e3deSDmitry ChaginLists file name suffixes to be ignored by completion.
718519d2e3deSDmitry Chagin.TP 8
718619d2e3deSDmitry Chagin.B filec
718719d2e3deSDmitry ChaginIn
718819d2e3deSDmitry Chagin.Nm
718919d2e3deSDmitry Chagin, completion is always used and this variable is ignored
719019d2e3deSDmitry Chaginby default. If
719119d2e3deSDmitry Chagin.B edit
719219d2e3deSDmitry Chaginis unset, then the traditional
719319d2e3deSDmitry Chagin.Xr csh 1
719419d2e3deSDmitry Chagincompletion is used.
719519d2e3deSDmitry ChaginIf set in
719619d2e3deSDmitry Chagin.Xr csh 1
719719d2e3deSDmitry Chagin, filename completion is used.
719819d2e3deSDmitry Chagin.TP 8
719919d2e3deSDmitry Chagin.B gid \fR(+)
720019d2e3deSDmitry ChaginThe user's real group ID.
720119d2e3deSDmitry Chagin.TP 8
720219d2e3deSDmitry Chagin.B globdot \fR(+)
720319d2e3deSDmitry ChaginIf set, wild-card glob patterns will match files and directories beginning
720419d2e3deSDmitry Chaginwith
720519d2e3deSDmitry Chagin.Sq .
720619d2e3deSDmitry Chaginexcept for
720719d2e3deSDmitry Chagin.Sq .
720819d2e3deSDmitry Chaginand
720919d2e3deSDmitry Chagin.Sq ..
721019d2e3deSDmitry Chagin.TP 8
721119d2e3deSDmitry Chagin.B globstar \fR(+)
721219d2e3deSDmitry ChaginIf set, the
721319d2e3deSDmitry Chagin.Sq **
721419d2e3deSDmitry Chaginand
721519d2e3deSDmitry Chagin.Sq ***
721619d2e3deSDmitry Chaginfile glob patterns will match any string of
721719d2e3deSDmitry Chagincharacters including
721819d2e3deSDmitry Chagin.Sq /
721919d2e3deSDmitry Chagintraversing any existing sub-directories.
722019d2e3deSDmitry Chagin(e.g.
722119d2e3deSDmitry Chagin`ls **.c' will list all the .c files in the current directory tree).
722219d2e3deSDmitry ChaginIf used by itself, it will match zero or more sub-directories
722319d2e3deSDmitry Chagin(e.g.
722419d2e3deSDmitry Chagin.Sq ls /usr/include/**/time.h
722519d2e3deSDmitry Chaginwill list any file named
722619d2e3deSDmitry Chagin.Sq time.h
722719d2e3deSDmitry Chaginin the /usr/include directory tree; whereas
722819d2e3deSDmitry Chagin.Sq ls /usr/include/**time.h
722919d2e3deSDmitry Chaginwill match any file in the /usr/include directory tree ending in
723019d2e3deSDmitry Chagin.Sq time.h
723119d2e3deSDmitry Chagin).
723219d2e3deSDmitry ChaginTo prevent problems with recursion, the
723319d2e3deSDmitry Chagin.Sq **
723419d2e3deSDmitry Chaginglob-pattern will not
723519d2e3deSDmitry Chagindescend into a symbolic link containing a directory.
723619d2e3deSDmitry ChaginTo override this,
723719d2e3deSDmitry Chaginuse
723819d2e3deSDmitry Chagin.Sq ***
723919d2e3deSDmitry Chagin.TP 8
724019d2e3deSDmitry Chagin.B group \fR(+)
724119d2e3deSDmitry ChaginThe user's group name.
724219d2e3deSDmitry Chagin.TP 8
724319d2e3deSDmitry Chagin.B highlight
724419d2e3deSDmitry ChaginIf set, the incremental search match (in
724519d2e3deSDmitry Chagin.Va i-search-back
724619d2e3deSDmitry Chaginand
724719d2e3deSDmitry Chagin.Va i-search-fwd
724819d2e3deSDmitry Chagin) and the region between the mark and the cursor are
724919d2e3deSDmitry Chaginhighlighted in reverse video.
725019d2e3deSDmitry Chagin.IP "" 8
725119d2e3deSDmitry ChaginHighlighting requires more frequent terminal writes, which introduces extra
725219d2e3deSDmitry Chaginoverhead. If you care about terminal performance, you may want to leave this
725319d2e3deSDmitry Chaginunset.
725419d2e3deSDmitry Chagin.TP 8
725519d2e3deSDmitry Chagin.B histchars
725619d2e3deSDmitry ChaginA string value determining the characters used in \fBHistory
725719d2e3deSDmitry Chaginsubstitution\fR (q.v.).
725819d2e3deSDmitry ChaginThe first character of its value is used as
725919d2e3deSDmitry Chaginthe history substitution character, replacing the default character
726019d2e3deSDmitry Chagin`!'.
726119d2e3deSDmitry ChaginThe second character of its value replaces the character
726219d2e3deSDmitry Chagin.Sq ^
726319d2e3deSDmitry Chaginin
726419d2e3deSDmitry Chaginquick substitutions.
726519d2e3deSDmitry Chagin.TP 8
726619d2e3deSDmitry Chagin.B histdup \fR(+)
726719d2e3deSDmitry ChaginControls handling of duplicate entries in the history list.
726819d2e3deSDmitry ChaginIf set to
726919d2e3deSDmitry Chagin`all' only unique history events are entered in the history list.
727019d2e3deSDmitry ChaginIf
727119d2e3deSDmitry Chaginset to
727219d2e3deSDmitry Chagin.Sq prev
727319d2e3deSDmitry Chaginand the last history event is the same as the current
727419d2e3deSDmitry Chagincommand, then the current command is not entered in the history.
727519d2e3deSDmitry ChaginIf
727619d2e3deSDmitry Chaginset to
727719d2e3deSDmitry Chagin.Sq erase
727819d2e3deSDmitry Chaginand the same event is found in the history list, that
727919d2e3deSDmitry Chaginold event gets erased and the current one gets inserted.
728019d2e3deSDmitry ChaginNote that the
728119d2e3deSDmitry Chagin`prev' and
728219d2e3deSDmitry Chagin.Sq all
728319d2e3deSDmitry Chaginoptions renumber history events so there are no gaps.
728419d2e3deSDmitry Chagin.TP 8
728519d2e3deSDmitry Chagin.B histfile \fR(+)
728619d2e3deSDmitry ChaginThe default location in which
728719d2e3deSDmitry Chagin.Sq history \-S
728819d2e3deSDmitry Chaginand
728919d2e3deSDmitry Chagin.Sq history \-L
729019d2e3deSDmitry Chaginlook for
729119d2e3deSDmitry Chagina history file.
729219d2e3deSDmitry ChaginIf unset,
729319d2e3deSDmitry Chagin.Va ~/.history
729419d2e3deSDmitry Chaginis used.
729519d2e3deSDmitry Chagin.Va histfile
729619d2e3deSDmitry Chaginis
729719d2e3deSDmitry Chaginuseful when sharing the same home directory between different machines,
729819d2e3deSDmitry Chaginor when saving separate histories on different terminals.
729919d2e3deSDmitry ChaginBecause only
730019d2e3deSDmitry Chagin.Va ~/.tcshrc
730119d2e3deSDmitry Chaginis normally sourced before
730219d2e3deSDmitry Chagin.Va ~/.history
730319d2e3deSDmitry Chagin,
730419d2e3deSDmitry Chagin.Va histfile
730519d2e3deSDmitry Chaginshould be set in
730619d2e3deSDmitry Chagin.Va ~/.tcshrc
730719d2e3deSDmitry Chaginrather than
730819d2e3deSDmitry Chagin.Va ~/.login
730919d2e3deSDmitry Chagin.TP 8
731019d2e3deSDmitry Chagin.B histlit \fR(+)
731119d2e3deSDmitry ChaginIf set, builtin and editor commands and the
731219d2e3deSDmitry Chagin.Va savehist
731319d2e3deSDmitry Chaginmechanism
731419d2e3deSDmitry Chaginuse the literal (unexpanded) form of lines in the history list.
731519d2e3deSDmitry ChaginSee
731619d2e3deSDmitry Chaginalso the
731719d2e3deSDmitry Chagin.Va toggle-literal-history
731819d2e3deSDmitry Chagineditor command.
731919d2e3deSDmitry Chagin.TP 8
732019d2e3deSDmitry Chagin.B history
732119d2e3deSDmitry ChaginThe first word indicates the number of history events to save.
732219d2e3deSDmitry ChaginThe
732319d2e3deSDmitry Chaginoptional second word (+) indicates the format in which history is
732419d2e3deSDmitry Chaginprinted; if not given,
732519d2e3deSDmitry Chagin.Sq %h\et%T\et%R\en
732619d2e3deSDmitry Chaginis used.
732719d2e3deSDmitry ChaginThe format sequences
732819d2e3deSDmitry Chaginare described below under
732919d2e3deSDmitry Chagin.Va prompt
733019d2e3deSDmitry Chagin; note the variable meaning of
733119d2e3deSDmitry Chagin`%R'.
733219d2e3deSDmitry ChaginSet to
733319d2e3deSDmitry Chagin.Sq 100
733419d2e3deSDmitry Chaginby default.
733519d2e3deSDmitry Chagin.TP 8
733619d2e3deSDmitry Chagin.B home
733719d2e3deSDmitry ChaginInitialized to the home directory of the invoker.
733819d2e3deSDmitry ChaginThe filename
733919d2e3deSDmitry Chaginexpansion of
734019d2e3deSDmitry Chagin.Sq
734119d2e3deSDmitry Chagin.Va ~
734219d2e3deSDmitry Chaginrefers to this variable.
734319d2e3deSDmitry Chagin.TP 8
734419d2e3deSDmitry Chagin.B ignoreeof
734519d2e3deSDmitry ChaginIf set to the empty string or
734619d2e3deSDmitry Chagin.Sq 0
734719d2e3deSDmitry Chaginand the input device is a terminal,
734819d2e3deSDmitry Chaginthe
734919d2e3deSDmitry Chagin.Va end-of-file
735019d2e3deSDmitry Chagincommand (usually generated by the user by typing
735119d2e3deSDmitry Chagin`^D' on an empty line) causes the shell to print `Use "exit" to leave
735219d2e3deSDmitry Chagintcsh.' instead of exiting.
735319d2e3deSDmitry ChaginThis prevents the shell from accidentally
735419d2e3deSDmitry Chaginbeing killed.
735519d2e3deSDmitry ChaginHistorically this setting exited after 26 successive
735619d2e3deSDmitry ChaginEOF's to avoid infinite loops.
735719d2e3deSDmitry ChaginIf set to a number
735819d2e3deSDmitry Chagin.Va n
735919d2e3deSDmitry Chagin, the shell
736019d2e3deSDmitry Chaginignores
736119d2e3deSDmitry Chagin.Va n - 1
736219d2e3deSDmitry Chaginconsecutive
736319d2e3deSDmitry Chagin.Va end-of-file
736419d2e3deSDmitry Chagins and exits on the
736519d2e3deSDmitry Chagin.Va n
736619d2e3deSDmitry Chaginth.
736719d2e3deSDmitry Chagin(+) If unset,
736819d2e3deSDmitry Chagin.Sq 1
736919d2e3deSDmitry Chaginis used, i.e., the shell exits on a
737019d2e3deSDmitry Chaginsingle
737119d2e3deSDmitry Chagin.Sq ^D
737219d2e3deSDmitry Chagin.TP 8
737319d2e3deSDmitry Chagin.B implicitcd \fR(+)
737419d2e3deSDmitry ChaginIf set, the shell treats a directory name typed as a command as though
737519d2e3deSDmitry Chaginit were a request to change to that directory.
737619d2e3deSDmitry ChaginIf set to
737719d2e3deSDmitry Chagin.Va verbose
737819d2e3deSDmitry Chagin,
737919d2e3deSDmitry Chaginthe change of directory is echoed to the standard output.
738019d2e3deSDmitry ChaginThis behavior
738119d2e3deSDmitry Chaginis inhibited in non-interactive shell scripts, or for command strings
738219d2e3deSDmitry Chaginwith more than one word.
738319d2e3deSDmitry ChaginChanging directory takes precedence over
738419d2e3deSDmitry Chaginexecuting a like-named command, but it is done after alias
738519d2e3deSDmitry Chaginsubstitutions.
738619d2e3deSDmitry ChaginTilde and variable expansions work as expected.
738719d2e3deSDmitry Chagin.TP 8
738819d2e3deSDmitry Chagin.B inputmode \fR(+)
738919d2e3deSDmitry ChaginIf set to
739019d2e3deSDmitry Chagin.Sq insert
739119d2e3deSDmitry Chaginor
739219d2e3deSDmitry Chagin.Sq overwrite
739319d2e3deSDmitry Chagin, puts the editor into that input mode
739419d2e3deSDmitry Chaginat the beginning of each line.
739519d2e3deSDmitry Chagin.TP 8
739619d2e3deSDmitry Chagin.B killdup \fR(+)
739719d2e3deSDmitry ChaginControls handling of duplicate entries in the kill ring.
739819d2e3deSDmitry ChaginIf set to
739919d2e3deSDmitry Chagin`all' only unique strings are entered in the kill ring.
740019d2e3deSDmitry ChaginIf set to
740119d2e3deSDmitry Chagin`prev' and the last killed string is the same as the current killed
740219d2e3deSDmitry Chaginstring, then the current string is not entered in the ring.
740319d2e3deSDmitry ChaginIf set
740419d2e3deSDmitry Chaginto
740519d2e3deSDmitry Chagin.Sq erase
740619d2e3deSDmitry Chaginand the same string is found in the kill ring, the old
740719d2e3deSDmitry Chaginstring is erased and the current one is inserted.
740819d2e3deSDmitry Chagin.TP 8
740919d2e3deSDmitry Chagin.B killring \fR(+)
741019d2e3deSDmitry ChaginIndicates the number of killed strings to keep in memory.
741119d2e3deSDmitry ChaginSet to
741219d2e3deSDmitry Chagin.Sq 30
741319d2e3deSDmitry Chaginby default.
741419d2e3deSDmitry ChaginIf unset or set to less than
741519d2e3deSDmitry Chagin.Sq 2
741619d2e3deSDmitry Chagin, the shell will only
741719d2e3deSDmitry Chaginkeep the most recently killed string.
741819d2e3deSDmitry ChaginStrings are put in the killring by the editor commands that delete
741919d2e3deSDmitry Chagin(kill) strings of text, e.g.
742019d2e3deSDmitry Chagin.Va backward-delete-word
742119d2e3deSDmitry Chagin,
742219d2e3deSDmitry Chagin.Va kill-line
742319d2e3deSDmitry Chagin, etc, as well as the
742419d2e3deSDmitry Chagin.Va copy-region-as-kill
742519d2e3deSDmitry Chagincommand.
742619d2e3deSDmitry ChaginThe
742719d2e3deSDmitry Chagin.Va yank
742819d2e3deSDmitry Chagineditor command will yank the most recently killed string
742919d2e3deSDmitry Chagininto the command-line, while
743019d2e3deSDmitry Chagin.Va yank-pop
743119d2e3deSDmitry Chagin(see
743219d2e3deSDmitry Chagin.Va Editor commands
743319d2e3deSDmitry Chagin)
743419d2e3deSDmitry Chagincan be used to yank earlier killed strings.
743519d2e3deSDmitry Chagin.TP 8
743619d2e3deSDmitry Chagin.B listflags \fR(+)
743719d2e3deSDmitry ChaginIf set to
743819d2e3deSDmitry Chagin.Sq x
743919d2e3deSDmitry Chagin,
744019d2e3deSDmitry Chagin.Sq a
744119d2e3deSDmitry Chaginor
744219d2e3deSDmitry Chagin.Sq A
744319d2e3deSDmitry Chagin, or any combination thereof (e.g.,
744419d2e3deSDmitry Chagin.Sq xA
744519d2e3deSDmitry Chagin), they
744619d2e3deSDmitry Chaginare used as flags to \fIls\-F\fR, making it act like
744719d2e3deSDmitry Chagin.Sq ls \-xF
744819d2e3deSDmitry Chagin, `ls
744919d2e3deSDmitry Chagin\-Fa',
745019d2e3deSDmitry Chagin.Sq ls \-FA
745119d2e3deSDmitry Chaginor a combination (e.g.,
745219d2e3deSDmitry Chagin.Sq ls \-FxA
745319d2e3deSDmitry Chagin):
745419d2e3deSDmitry Chagin.Sq a
745519d2e3deSDmitry Chaginshows all
745619d2e3deSDmitry Chaginfiles (even if they start with a
745719d2e3deSDmitry Chagin.Sq .
745819d2e3deSDmitry Chagin),
745919d2e3deSDmitry Chagin.Sq A
746019d2e3deSDmitry Chaginshows all files but
746119d2e3deSDmitry Chagin.Sq .
746219d2e3deSDmitry Chaginand
746319d2e3deSDmitry Chagin`..', and
746419d2e3deSDmitry Chagin.Sq x
746519d2e3deSDmitry Chaginsorts across instead of down.
746619d2e3deSDmitry ChaginIf the second word of
746719d2e3deSDmitry Chagin.Va listflags
746819d2e3deSDmitry Chaginis set, it is used as the path to
746919d2e3deSDmitry Chagin.Sq ls(1)
747019d2e3deSDmitry Chagin.TP 8
747119d2e3deSDmitry Chagin.B listjobs \fR(+)
747219d2e3deSDmitry ChaginIf set, all jobs are listed when a job is suspended.
747319d2e3deSDmitry ChaginIf set to
747419d2e3deSDmitry Chagin.Sq long
747519d2e3deSDmitry Chagin,
747619d2e3deSDmitry Chaginthe listing is in long format.
747719d2e3deSDmitry Chagin.TP 8
747819d2e3deSDmitry Chagin.B listlinks \fR(+)
747919d2e3deSDmitry ChaginIf set, the \fIls\-F\fR builtin command shows the type of file to which
748019d2e3deSDmitry Chagineach symbolic link points.
748119d2e3deSDmitry Chagin.TP 8
748219d2e3deSDmitry Chagin.B listmax \fR(+)
748319d2e3deSDmitry ChaginThe maximum number of items which the
748419d2e3deSDmitry Chagin.Va list-choices
748519d2e3deSDmitry Chagineditor command
748619d2e3deSDmitry Chaginwill list without asking first.
748719d2e3deSDmitry Chagin.TP 8
748819d2e3deSDmitry Chagin.B listmaxrows \fR(+)
748919d2e3deSDmitry ChaginThe maximum number of rows of items which the
749019d2e3deSDmitry Chagin.Va list-choices
749119d2e3deSDmitry Chagineditor
749219d2e3deSDmitry Chagincommand will list without asking first.
749319d2e3deSDmitry Chagin.TP 8
749419d2e3deSDmitry Chagin.B loginsh \fR(+)
749519d2e3deSDmitry ChaginSet by the shell if it is a login shell.
749619d2e3deSDmitry ChaginSetting or unsetting it
749719d2e3deSDmitry Chaginwithin a shell has no effect.
749819d2e3deSDmitry ChaginSee also
749919d2e3deSDmitry Chagin.Va shlvl
750019d2e3deSDmitry Chagin.TP 8
750119d2e3deSDmitry Chagin.B logout \fR(+)
750219d2e3deSDmitry ChaginSet by the shell to
750319d2e3deSDmitry Chagin.Sq normal
750419d2e3deSDmitry Chaginbefore a normal logout,
750519d2e3deSDmitry Chagin.Sq automatic
750619d2e3deSDmitry Chaginbefore
750719d2e3deSDmitry Chaginan automatic logout, and
750819d2e3deSDmitry Chagin.Sq hangup
750919d2e3deSDmitry Chaginif the shell was killed by a hangup
751019d2e3deSDmitry Chaginsignal (see
751119d2e3deSDmitry Chagin.Va Signal handling
751219d2e3deSDmitry Chagin).
751319d2e3deSDmitry ChaginSee also the
751419d2e3deSDmitry Chagin.Va autologout
751519d2e3deSDmitry Chaginshell variable.
751619d2e3deSDmitry Chagin.TP 8
751719d2e3deSDmitry Chagin.B mail
751819d2e3deSDmitry ChaginA list of files and directories to check for incoming mail, optionally
751919d2e3deSDmitry Chaginpreceded by a numeric word.
752019d2e3deSDmitry ChaginBefore each prompt, if 10 minutes have
752119d2e3deSDmitry Chaginpassed since the last check, the shell checks each file and says `You
752219d2e3deSDmitry Chaginhave new mail.' (or, if
752319d2e3deSDmitry Chagin.Va mail
752419d2e3deSDmitry Chagincontains multiple files, `You have
752519d2e3deSDmitry Chaginnew mail in
752619d2e3deSDmitry Chagin.Va name
752719d2e3deSDmitry Chagin.') if the filesize is greater than zero in size
752819d2e3deSDmitry Chaginand has a modification time greater than its access time.
752919d2e3deSDmitry Chagin.Pp
753019d2e3deSDmitry Chagin.RS +8
753119d2e3deSDmitry Chagin.PD
753219d2e3deSDmitry Chagin.Pp
753319d2e3deSDmitry ChaginIf you are in a login shell, then no mail file is reported unless it has
753419d2e3deSDmitry Chaginbeen modified after the time the shell has started up, to prevent
753519d2e3deSDmitry Chaginredundant notifications.
753619d2e3deSDmitry ChaginMost login programs will tell you whether or not
753719d2e3deSDmitry Chaginyou have mail when you log in.
753819d2e3deSDmitry Chagin.Pp
753919d2e3deSDmitry ChaginIf a file specified in
754019d2e3deSDmitry Chagin.Va mail
754119d2e3deSDmitry Chaginis a directory, the shell will count each
754219d2e3deSDmitry Chaginfile within that directory as a separate message, and will report `You have
754319d2e3deSDmitry Chagin.Va n
754419d2e3deSDmitry Chaginmails.' or
754519d2e3deSDmitry Chagin.Sq You have
754619d2e3deSDmitry Chagin.Va n
754719d2e3deSDmitry Chaginmails in
754819d2e3deSDmitry Chagin.Va name
754919d2e3deSDmitry Chaginas appropriate.
755019d2e3deSDmitry ChaginThis functionality is provided primarily for those systems which store mail
755119d2e3deSDmitry Chaginin this manner, such as the Andrew Mail System.
755219d2e3deSDmitry Chagin.Pp
755319d2e3deSDmitry ChaginIf the first word of
755419d2e3deSDmitry Chagin.Va mail
755519d2e3deSDmitry Chaginis numeric it is taken as a different mail
755619d2e3deSDmitry Chaginchecking interval, in seconds.
755719d2e3deSDmitry Chagin.Pp
755819d2e3deSDmitry ChaginUnder very rare circumstances, the shell may report
755919d2e3deSDmitry Chagin.Sq You have mail.
756019d2e3deSDmitry Chagininstead
756119d2e3deSDmitry Chaginof
756219d2e3deSDmitry Chagin.Sq You have new mail.
756319d2e3deSDmitry Chagin.RE
756419d2e3deSDmitry Chagin.TP 8
756519d2e3deSDmitry Chagin.B matchbeep \fR(+)
756619d2e3deSDmitry ChaginIf set to
756719d2e3deSDmitry Chagin.Sq never
756819d2e3deSDmitry Chagin, completion never beeps.
756919d2e3deSDmitry ChaginIf set to
757019d2e3deSDmitry Chagin.Sq nomatch
757119d2e3deSDmitry Chagin, it beeps only when there is no match.
757219d2e3deSDmitry ChaginIf set to
757319d2e3deSDmitry Chagin.Sq ambiguous
757419d2e3deSDmitry Chagin, it beeps when there are multiple matches.
757519d2e3deSDmitry ChaginIf set to
757619d2e3deSDmitry Chagin.Sq notunique
757719d2e3deSDmitry Chagin, it beeps when there is one exact and other longer matches.
757819d2e3deSDmitry ChaginIf unset,
757919d2e3deSDmitry Chagin.Sq ambiguous
758019d2e3deSDmitry Chaginis used.
758119d2e3deSDmitry Chagin.TP 8
758219d2e3deSDmitry Chagin.B nobeep \fR(+)
758319d2e3deSDmitry ChaginIf set, beeping is completely disabled.
758419d2e3deSDmitry ChaginSee also
758519d2e3deSDmitry Chagin.Va visiblebell
758619d2e3deSDmitry Chagin.TP 8
758719d2e3deSDmitry Chagin.B noclobber
758819d2e3deSDmitry ChaginIf set, restrictions are placed on output redirection to insure that files
758919d2e3deSDmitry Chaginare not accidentally destroyed and that
759019d2e3deSDmitry Chagin.Sq >>
759119d2e3deSDmitry Chaginredirections refer to existing
759219d2e3deSDmitry Chaginfiles, as described in the
759319d2e3deSDmitry Chagin.Va Input/output
759419d2e3deSDmitry Chaginsection.
759519d2e3deSDmitry Chagin.TP 8
759619d2e3deSDmitry Chagin.B noding
759719d2e3deSDmitry ChaginIf set, disable the printing of
759819d2e3deSDmitry Chagin.Sq DING!
759919d2e3deSDmitry Chaginin the
760019d2e3deSDmitry Chagin.Va prompt
760119d2e3deSDmitry Chagintime
760219d2e3deSDmitry Chaginspecifiers at the change of hour.
760319d2e3deSDmitry Chagin.TP 8
760419d2e3deSDmitry Chagin.B noglob
760519d2e3deSDmitry ChaginIf set,
760619d2e3deSDmitry Chagin.Va Filename substitution
760719d2e3deSDmitry Chaginand
760819d2e3deSDmitry Chagin.Va Directory stack substitution
760919d2e3deSDmitry Chagin(q.v.) are inhibited.
761019d2e3deSDmitry ChaginThis is most useful in shell scripts which do not deal
761119d2e3deSDmitry Chaginwith filenames, or after a list of filenames has been obtained and further
761219d2e3deSDmitry Chaginexpansions are not desirable.
761319d2e3deSDmitry Chagin.TP 8
761419d2e3deSDmitry Chagin.B nokanji \fR(+)
761519d2e3deSDmitry ChaginIf set and the shell supports Kanji (see the
761619d2e3deSDmitry Chagin.Va version
761719d2e3deSDmitry Chaginshell variable),
761819d2e3deSDmitry Chaginit is disabled so that the meta key can be used.
761919d2e3deSDmitry Chagin.TP 8
762019d2e3deSDmitry Chagin.B nonomatch
762119d2e3deSDmitry ChaginIf set, a
762219d2e3deSDmitry Chagin.Va Filename substitution
762319d2e3deSDmitry Chaginor
762419d2e3deSDmitry Chagin.Va Directory stack substitution
762519d2e3deSDmitry Chagin(q.v.) which does not match any
762619d2e3deSDmitry Chaginexisting files is left untouched rather than causing an error.
762719d2e3deSDmitry ChaginIt is still an error for the substitution to be
762819d2e3deSDmitry Chaginmalformed, e.g.,
762919d2e3deSDmitry Chagin.Sq echo [
763019d2e3deSDmitry Chaginstill gives an error.
763119d2e3deSDmitry Chagin.TP 8
763219d2e3deSDmitry Chagin.B nostat \fR(+)
763319d2e3deSDmitry ChaginA list of directories (or glob-patterns which match directories; see
763419d2e3deSDmitry Chagin.Va Filename substitution
763519d2e3deSDmitry Chagin) that should not be
763619d2e3deSDmitry Chagin.Va stat
763719d2e3deSDmitry Chagin(2)ed during a
763819d2e3deSDmitry Chagincompletion operation.
763919d2e3deSDmitry ChaginThis is usually used to exclude directories which
764019d2e3deSDmitry Chagintake too much time to
764119d2e3deSDmitry Chagin.Va stat
764219d2e3deSDmitry Chagin(2), for example
764319d2e3deSDmitry Chagin.Va /afs
764419d2e3deSDmitry Chagin.TP 8
764519d2e3deSDmitry Chagin.B notify
764619d2e3deSDmitry ChaginIf set, the shell announces job completions asynchronously.
764719d2e3deSDmitry ChaginThe default is to present job completions just before printing a prompt.
764819d2e3deSDmitry Chagin.TP 8
764919d2e3deSDmitry Chagin.B oid \fR(+)
765019d2e3deSDmitry ChaginThe user's real organization ID.
765119d2e3deSDmitry Chagin(Domain/OS only)
765219d2e3deSDmitry Chagin.TP 8
765319d2e3deSDmitry Chagin.B owd \fR(+)
765419d2e3deSDmitry ChaginThe old working directory, equivalent to the
765519d2e3deSDmitry Chagin.Sq \-
765619d2e3deSDmitry Chaginused by
765719d2e3deSDmitry Chagin.Va cd
765819d2e3deSDmitry Chaginand
765919d2e3deSDmitry Chagin.Va pushd
766019d2e3deSDmitry ChaginSee also the
766119d2e3deSDmitry Chagin.Va cwd
766219d2e3deSDmitry Chaginand
766319d2e3deSDmitry Chagin.Va dirstack
766419d2e3deSDmitry Chaginshell variables.
766519d2e3deSDmitry Chagin.TP 8
766619d2e3deSDmitry Chagin.B padhour
766719d2e3deSDmitry ChaginIf set, enable the printing of padding '0' for hours, in 24 and 12 hour
766819d2e3deSDmitry Chaginformats.
766919d2e3deSDmitry ChaginE.G.: 07:45:42 vs. 7:45:42.
767019d2e3deSDmitry Chagin.TP 8
767119d2e3deSDmitry Chagin.B parseoctal
767219d2e3deSDmitry ChaginTo retain compatibily with older versions numeric variables starting with
767319d2e3deSDmitry Chagin0 are not interpreted as octal. Setting this variable enables proper octal
767419d2e3deSDmitry Chaginparsing.
767519d2e3deSDmitry Chagin.TP 8
767619d2e3deSDmitry Chagin.B path
767719d2e3deSDmitry ChaginA list of directories in which to look for executable commands.
767819d2e3deSDmitry ChaginA null word specifies the current directory.
767919d2e3deSDmitry ChaginIf there is no
768019d2e3deSDmitry Chagin.Va path
768119d2e3deSDmitry Chaginvariable then only full path names will execute.
768219d2e3deSDmitry Chagin.Va path
768319d2e3deSDmitry Chaginis set by the shell at startup from the
768419d2e3deSDmitry Chagin.Va PATH
768519d2e3deSDmitry Chaginenvironment
768619d2e3deSDmitry Chaginvariable or, if
768719d2e3deSDmitry Chagin.Va PATH
768819d2e3deSDmitry Chagindoes not exist, to a system-dependent default
768919d2e3deSDmitry Chaginsomething like
769019d2e3deSDmitry Chagin.Sq (/usr/local/bin /usr/bsd /bin /usr/bin .)
769119d2e3deSDmitry ChaginThe shell may put
769219d2e3deSDmitry Chagin.Sq .
769319d2e3deSDmitry Chaginfirst or last in
769419d2e3deSDmitry Chagin.Va path
769519d2e3deSDmitry Chaginor omit it entirely
769619d2e3deSDmitry Chagindepending on how it was compiled; see the
769719d2e3deSDmitry Chagin.Va version
769819d2e3deSDmitry Chaginshell variable.
769919d2e3deSDmitry ChaginA shell which is given neither the
770019d2e3deSDmitry Chagin.Fl c\fR nor the
770119d2e3deSDmitry Chagin.Fl t\fR option
770219d2e3deSDmitry Chaginhashes the contents of the directories in
770319d2e3deSDmitry Chagin.Va path
770419d2e3deSDmitry Chaginafter
770519d2e3deSDmitry Chaginreading
770619d2e3deSDmitry Chagin.Va ~/.tcshrc
770719d2e3deSDmitry Chaginand each time
770819d2e3deSDmitry Chagin.Va path
770919d2e3deSDmitry Chaginis reset.
771019d2e3deSDmitry ChaginIf one adds a new command to a directory in
771119d2e3deSDmitry Chagin.Va path
771219d2e3deSDmitry Chaginwhile the shell
771319d2e3deSDmitry Chaginis active, one may need to do a
771419d2e3deSDmitry Chagin.Va rehash
771519d2e3deSDmitry Chaginfor the shell to find it.
771619d2e3deSDmitry Chagin.TP 8
771719d2e3deSDmitry Chagin.B printexitvalue \fR(+)
771819d2e3deSDmitry ChaginIf set and an interactive program exits with a non-zero status, the shell
771919d2e3deSDmitry Chaginprints
772019d2e3deSDmitry Chagin.Sq Exit
772119d2e3deSDmitry Chagin.Va status
772219d2e3deSDmitry Chagin.TP 8
772319d2e3deSDmitry Chagin.B prompt
772419d2e3deSDmitry ChaginThe string which is printed before reading each command from the terminal.
772519d2e3deSDmitry Chagin.Va prompt
772619d2e3deSDmitry Chaginmay include any of the following formatting sequences (+), which
772719d2e3deSDmitry Chaginare replaced by the given information:
772819d2e3deSDmitry Chagin.Pp
772919d2e3deSDmitry Chagin.RS +8
773019d2e3deSDmitry Chagin.PD 0
773119d2e3deSDmitry Chagin.TP 4
773219d2e3deSDmitry Chagin%/
773319d2e3deSDmitry ChaginThe current working directory.
773419d2e3deSDmitry Chagin.TP 4
773519d2e3deSDmitry Chagin%~
773619d2e3deSDmitry ChaginThe current working directory, but with one's home directory
773719d2e3deSDmitry Chaginrepresented by
773819d2e3deSDmitry Chagin.Sq ~
773919d2e3deSDmitry Chaginand other users' home directories represented by
774019d2e3deSDmitry Chagin`~user' as per
774119d2e3deSDmitry Chagin.Va Filename substitution
774219d2e3deSDmitry Chagin`~user' substitution
774319d2e3deSDmitry Chaginhappens only if the shell has already used
774419d2e3deSDmitry Chagin.Sq ~
774519d2e3deSDmitry Chagin.Va user
774619d2e3deSDmitry Chaginin a pathname
774719d2e3deSDmitry Chaginin the current session.
774819d2e3deSDmitry Chagin.TP 4
774919d2e3deSDmitry Chagin%c[[0]
775019d2e3deSDmitry Chagin.Va n
775119d2e3deSDmitry Chagin], %.[[0]
775219d2e3deSDmitry Chagin.Va n
775319d2e3deSDmitry Chagin]
775419d2e3deSDmitry ChaginThe trailing component of the current working directory, or
775519d2e3deSDmitry Chagin.Va n
775619d2e3deSDmitry Chagintrailing components if a digit
775719d2e3deSDmitry Chagin.Va n
775819d2e3deSDmitry Chaginis given.
775919d2e3deSDmitry ChaginIf
776019d2e3deSDmitry Chagin.Va n
776119d2e3deSDmitry Chaginbegins with
776219d2e3deSDmitry Chagin.Sq 0
776319d2e3deSDmitry Chagin, the number of skipped components precede
776419d2e3deSDmitry Chaginthe trailing component(s) in the format
776519d2e3deSDmitry Chagin.Sq /<
776619d2e3deSDmitry Chagin.Va skipped
776719d2e3deSDmitry Chagin>trailing
776819d2e3deSDmitry ChaginIf the
776919d2e3deSDmitry Chagin.Va ellipsis
777019d2e3deSDmitry Chaginshell variable is set, skipped components
777119d2e3deSDmitry Chaginare represented by an ellipsis so the whole becomes
777219d2e3deSDmitry Chagin.Sq ...trailing
777319d2e3deSDmitry Chagin`~' substitution is done as in
777419d2e3deSDmitry Chagin.Sq %~
777519d2e3deSDmitry Chaginabove, but the
777619d2e3deSDmitry Chagin.Sq ~
777719d2e3deSDmitry Chagincomponent
777819d2e3deSDmitry Chaginis ignored when counting trailing components.
777919d2e3deSDmitry Chagin.TP 4
778019d2e3deSDmitry Chagin%C
778119d2e3deSDmitry ChaginLike %c, but without
778219d2e3deSDmitry Chagin.Sq ~
778319d2e3deSDmitry Chaginsubstitution.
778419d2e3deSDmitry Chagin.TP 4
778519d2e3deSDmitry Chagin%h, %!, !
778619d2e3deSDmitry ChaginThe current history event number.
778719d2e3deSDmitry Chagin.TP 4
778819d2e3deSDmitry Chagin%M
778919d2e3deSDmitry ChaginThe full hostname.
779019d2e3deSDmitry Chagin.TP 4
779119d2e3deSDmitry Chagin%m
779219d2e3deSDmitry ChaginThe hostname up to the first
779319d2e3deSDmitry Chagin.Sq .
779419d2e3deSDmitry Chagin.TP 4
779519d2e3deSDmitry Chagin%S (%s)
779619d2e3deSDmitry ChaginStart (stop) standout mode.
779719d2e3deSDmitry Chagin.TP 4
779819d2e3deSDmitry Chagin%B (%b)
779919d2e3deSDmitry ChaginStart (stop) boldfacing mode.
780019d2e3deSDmitry Chagin.TP 4
780119d2e3deSDmitry Chagin%U (%u)
780219d2e3deSDmitry ChaginStart (stop) underline mode.
780319d2e3deSDmitry Chagin.TP 4
780419d2e3deSDmitry Chagin%t, %@
780519d2e3deSDmitry ChaginThe time of day in 12-hour AM/PM format.
780619d2e3deSDmitry Chagin.TP 4
780719d2e3deSDmitry Chagin%T
780819d2e3deSDmitry ChaginLike
780919d2e3deSDmitry Chagin.Sq %t
781019d2e3deSDmitry Chagin, but in 24-hour format (but see the
781119d2e3deSDmitry Chagin.Va ampm
781219d2e3deSDmitry Chaginshell variable).
781319d2e3deSDmitry Chagin.TP 4
781419d2e3deSDmitry Chagin%p
781519d2e3deSDmitry ChaginThe
781619d2e3deSDmitry Chagin.Sq precise
781719d2e3deSDmitry Chagintime of day in 12-hour AM/PM format, with seconds.
781819d2e3deSDmitry Chagin.TP 4
781919d2e3deSDmitry Chagin%P
782019d2e3deSDmitry ChaginLike
782119d2e3deSDmitry Chagin.Sq %p
782219d2e3deSDmitry Chagin, but in 24-hour format (but see the
782319d2e3deSDmitry Chagin.Va ampm
782419d2e3deSDmitry Chaginshell variable).
782519d2e3deSDmitry Chagin.TP 4
782619d2e3deSDmitry Chagin\e
782719d2e3deSDmitry Chagin.Va c
782819d2e3deSDmitry Chagin.Va c
782919d2e3deSDmitry Chaginis parsed as in
783019d2e3deSDmitry Chagin.Va bindkey
783119d2e3deSDmitry Chagin.TP 4
783219d2e3deSDmitry Chagin^
783319d2e3deSDmitry Chagin.Va c
783419d2e3deSDmitry Chagin.Va c
783519d2e3deSDmitry Chaginis parsed as in
783619d2e3deSDmitry Chagin.Va bindkey
783719d2e3deSDmitry Chagin.TP 4
783819d2e3deSDmitry Chagin%%
783919d2e3deSDmitry ChaginA single
784019d2e3deSDmitry Chagin.Sq %
784119d2e3deSDmitry Chagin.TP 4
784219d2e3deSDmitry Chagin%n
784319d2e3deSDmitry ChaginThe user name.
784419d2e3deSDmitry Chagin.TP 4
784519d2e3deSDmitry Chagin%N
784619d2e3deSDmitry ChaginThe effective user name.
784719d2e3deSDmitry Chagin.TP 4
784819d2e3deSDmitry Chagin%j
784919d2e3deSDmitry ChaginThe number of jobs.
785019d2e3deSDmitry Chagin.TP 4
785119d2e3deSDmitry Chagin%d
785219d2e3deSDmitry ChaginThe weekday in
785319d2e3deSDmitry Chagin.Sq Day
785419d2e3deSDmitry Chaginformat.
785519d2e3deSDmitry Chagin.TP 4
785619d2e3deSDmitry Chagin%D
785719d2e3deSDmitry ChaginThe day in
785819d2e3deSDmitry Chagin.Sq dd
785919d2e3deSDmitry Chaginformat.
786019d2e3deSDmitry Chagin.TP 4
786119d2e3deSDmitry Chagin%w
786219d2e3deSDmitry ChaginThe month in
786319d2e3deSDmitry Chagin.Sq Mon
786419d2e3deSDmitry Chaginformat.
786519d2e3deSDmitry Chagin.TP 4
786619d2e3deSDmitry Chagin%W
786719d2e3deSDmitry ChaginThe month in
786819d2e3deSDmitry Chagin.Sq mm
786919d2e3deSDmitry Chaginformat.
787019d2e3deSDmitry Chagin.TP 4
787119d2e3deSDmitry Chagin%y
787219d2e3deSDmitry ChaginThe year in
787319d2e3deSDmitry Chagin.Sq yy
787419d2e3deSDmitry Chaginformat.
787519d2e3deSDmitry Chagin.TP 4
787619d2e3deSDmitry Chagin%Y
787719d2e3deSDmitry ChaginThe year in
787819d2e3deSDmitry Chagin.Sq yyyy
787919d2e3deSDmitry Chaginformat.
788019d2e3deSDmitry Chagin.TP 4
788119d2e3deSDmitry Chagin%l
788219d2e3deSDmitry ChaginThe shell's tty.
788319d2e3deSDmitry Chagin.TP 4
788419d2e3deSDmitry Chagin%L
788519d2e3deSDmitry ChaginClears from the end of the prompt to end of the display or the end of the line.
788619d2e3deSDmitry Chagin.TP 4
788719d2e3deSDmitry Chagin%$
788819d2e3deSDmitry ChaginExpands the shell or environment variable name immediately after the
788919d2e3deSDmitry Chagin.Sq $
789019d2e3deSDmitry Chagin.TP 4
789119d2e3deSDmitry Chagin%#
789219d2e3deSDmitry Chagin`>' (or the first character of the
789319d2e3deSDmitry Chagin.Va promptchars
789419d2e3deSDmitry Chaginshell variable)
789519d2e3deSDmitry Chaginfor normal users,
789619d2e3deSDmitry Chagin.Sq #
789719d2e3deSDmitry Chagin(or the second character of
789819d2e3deSDmitry Chagin.Va promptchars
789919d2e3deSDmitry Chagin)
790019d2e3deSDmitry Chaginfor the superuser.
790119d2e3deSDmitry Chagin.TP 4
790219d2e3deSDmitry Chagin%{
790319d2e3deSDmitry Chagin.Va string
790419d2e3deSDmitry Chagin%}
790519d2e3deSDmitry ChaginIncludes
790619d2e3deSDmitry Chagin.Va string
790719d2e3deSDmitry Chaginas a literal escape sequence.
790819d2e3deSDmitry ChaginIt should be used only to change terminal attributes and
790919d2e3deSDmitry Chaginshould not move the cursor location.
791019d2e3deSDmitry ChaginThis
791119d2e3deSDmitry Chagincannot be the last sequence in
791219d2e3deSDmitry Chagin.Va prompt
791319d2e3deSDmitry Chagin.TP 4
791419d2e3deSDmitry Chagin%?
791519d2e3deSDmitry ChaginThe return code of the command executed just before the prompt.
791619d2e3deSDmitry Chagin.TP 4
791719d2e3deSDmitry Chagin%R
791819d2e3deSDmitry ChaginIn
791919d2e3deSDmitry Chagin.Va prompt2
792019d2e3deSDmitry Chagin, the status of the parser.
792119d2e3deSDmitry ChaginIn
792219d2e3deSDmitry Chagin.Va prompt3
792319d2e3deSDmitry Chagin, the corrected string.
792419d2e3deSDmitry ChaginIn
792519d2e3deSDmitry Chagin.Va history
792619d2e3deSDmitry Chagin, the history string.
792719d2e3deSDmitry Chagin.PD
792819d2e3deSDmitry Chagin.Pp
792919d2e3deSDmitry Chagin`%B',
793019d2e3deSDmitry Chagin.Sq %S
793119d2e3deSDmitry Chagin,
793219d2e3deSDmitry Chagin.Sq %U
793319d2e3deSDmitry Chaginand
793419d2e3deSDmitry Chagin.Sq %{
793519d2e3deSDmitry Chagin.Va string
793619d2e3deSDmitry Chagin%}
793719d2e3deSDmitry Chaginare available in only
793819d2e3deSDmitry Chagineight-bit-clean shells; see the
793919d2e3deSDmitry Chagin.Va version
794019d2e3deSDmitry Chaginshell variable.
794119d2e3deSDmitry Chagin.Pp
794219d2e3deSDmitry ChaginThe bold, standout and underline sequences are often used to distinguish a
794319d2e3deSDmitry Chaginsuperuser shell.
794419d2e3deSDmitry ChaginFor example,
794519d2e3deSDmitry Chagin.IP "" 4
794619d2e3deSDmitry Chagin> set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
794719d2e3deSDmitry Chagin.br
794819d2e3deSDmitry Chagintut [37]
794919d2e3deSDmitry Chagin.Va [2:54pm]
795019d2e3deSDmitry Chagin[/usr/accts/sys] you rang? _
795119d2e3deSDmitry Chagin.Pp
795219d2e3deSDmitry ChaginIf
795319d2e3deSDmitry Chagin.Sq %t
795419d2e3deSDmitry Chagin,
795519d2e3deSDmitry Chagin.Sq %@
795619d2e3deSDmitry Chagin,
795719d2e3deSDmitry Chagin.Sq %T
795819d2e3deSDmitry Chagin,
795919d2e3deSDmitry Chagin.Sq %p
796019d2e3deSDmitry Chagin, or
796119d2e3deSDmitry Chagin.Sq %P
796219d2e3deSDmitry Chaginis used, and
796319d2e3deSDmitry Chagin.Va noding
796419d2e3deSDmitry Chaginis not set,
796519d2e3deSDmitry Chaginthen print
796619d2e3deSDmitry Chagin.Sq DING!
796719d2e3deSDmitry Chaginon the change of hour (i.e,
796819d2e3deSDmitry Chagin.Sq \&:00
796919d2e3deSDmitry Chaginminutes) instead of
797019d2e3deSDmitry Chaginthe actual time.
797119d2e3deSDmitry Chagin.Pp
797219d2e3deSDmitry ChaginSet by default to
797319d2e3deSDmitry Chagin.Sq %#
797419d2e3deSDmitry Chaginin interactive shells.
797519d2e3deSDmitry Chagin.RE
797619d2e3deSDmitry Chagin.TP 8
797719d2e3deSDmitry Chagin.B prompt2 \fR(+)
797819d2e3deSDmitry ChaginThe string with which to prompt in
797919d2e3deSDmitry Chagin.Va while
798019d2e3deSDmitry Chaginand
798119d2e3deSDmitry Chagin.Va foreach
798219d2e3deSDmitry Chaginloops and
798319d2e3deSDmitry Chaginafter lines ending in
798419d2e3deSDmitry Chagin.Sq \e
798519d2e3deSDmitry ChaginThe same format sequences may be used as in
798619d2e3deSDmitry Chagin.Va prompt
798719d2e3deSDmitry Chagin(q.v.);
798819d2e3deSDmitry Chaginnote the variable meaning of
798919d2e3deSDmitry Chagin.Sq %R
799019d2e3deSDmitry ChaginSet by default to
799119d2e3deSDmitry Chagin.Sq %R?
799219d2e3deSDmitry Chaginin interactive shells.
799319d2e3deSDmitry Chagin.TP 8
799419d2e3deSDmitry Chagin.B prompt3 \fR(+)
799519d2e3deSDmitry ChaginThe string with which to prompt when confirming automatic spelling correction.
799619d2e3deSDmitry ChaginThe same format sequences may be used as in
799719d2e3deSDmitry Chagin.Va prompt
799819d2e3deSDmitry Chagin(q.v.);
799919d2e3deSDmitry Chaginnote the variable meaning of
800019d2e3deSDmitry Chagin.Sq %R
800119d2e3deSDmitry ChaginSet by default to
800219d2e3deSDmitry Chagin.Sq CORRECT>%R (y|n|e|a)?
800319d2e3deSDmitry Chaginin interactive shells.
800419d2e3deSDmitry Chagin.TP 8
800519d2e3deSDmitry Chagin.B promptchars \fR(+)
800619d2e3deSDmitry ChaginIf set (to a two-character string), the
800719d2e3deSDmitry Chagin.Sq %#
800819d2e3deSDmitry Chaginformatting sequence in the
800919d2e3deSDmitry Chagin.Va prompt
801019d2e3deSDmitry Chaginshell variable is replaced with the first character for
801119d2e3deSDmitry Chaginnormal users and the second character for the superuser.
801219d2e3deSDmitry Chagin.TP 8
801319d2e3deSDmitry Chagin.B pushdtohome \fR(+)
801419d2e3deSDmitry ChaginIf set,
801519d2e3deSDmitry Chagin.Va pushd
801619d2e3deSDmitry Chaginwithout arguments does
801719d2e3deSDmitry Chagin.Sq pushd ~
801819d2e3deSDmitry Chagin, like
801919d2e3deSDmitry Chagin.Va cd
802019d2e3deSDmitry Chagin.TP 8
802119d2e3deSDmitry Chagin.B pushdsilent \fR(+)
802219d2e3deSDmitry ChaginIf set,
802319d2e3deSDmitry Chagin.Va pushd
802419d2e3deSDmitry Chaginand
802519d2e3deSDmitry Chagin.Va popd
802619d2e3deSDmitry Chagindo not print the directory stack.
802719d2e3deSDmitry Chagin.TP 8
802819d2e3deSDmitry Chagin.B recexact \fR(+)
802919d2e3deSDmitry ChaginIf set, completion completes on an exact match even if a longer match is
803019d2e3deSDmitry Chaginpossible.
803119d2e3deSDmitry Chagin.TP 8
803219d2e3deSDmitry Chagin.B recognize_only_executables \fR(+)
803319d2e3deSDmitry ChaginIf set, command listing displays only files in the path that are
803419d2e3deSDmitry Chaginexecutable.
803519d2e3deSDmitry ChaginSlow.
803619d2e3deSDmitry Chagin.TP 8
803719d2e3deSDmitry Chagin.B rmstar \fR(+)
803819d2e3deSDmitry ChaginIf set, the user is prompted before
803919d2e3deSDmitry Chagin.Sq rm *
804019d2e3deSDmitry Chaginis executed.
804119d2e3deSDmitry Chagin.TP 8
804219d2e3deSDmitry Chagin.B rprompt \fR(+)
804319d2e3deSDmitry ChaginThe string to print on the right-hand side of the screen (after
804419d2e3deSDmitry Chaginthe command input) when the prompt is being displayed on the left.
804519d2e3deSDmitry ChaginIt recognizes the same formatting characters as
804619d2e3deSDmitry Chagin.Va prompt
804719d2e3deSDmitry ChaginIt will automatically disappear and reappear as necessary, to ensure that
804819d2e3deSDmitry Chagincommand input isn't obscured, and will appear only if the prompt,
804919d2e3deSDmitry Chagincommand input, and itself will fit together on the first line.
805019d2e3deSDmitry ChaginIf
805119d2e3deSDmitry Chagin.Va edit
805219d2e3deSDmitry Chaginisn't set, then
805319d2e3deSDmitry Chagin.Va rprompt
805419d2e3deSDmitry Chaginwill be printed after
805519d2e3deSDmitry Chaginthe prompt and before the command input.
805619d2e3deSDmitry Chagin.TP 8
805719d2e3deSDmitry Chagin.B savedirs \fR(+)
805819d2e3deSDmitry ChaginIf set, the shell does
805919d2e3deSDmitry Chagin.Sq dirs \-S
806019d2e3deSDmitry Chaginbefore exiting.
806119d2e3deSDmitry ChaginIf the first word is set to a number, at most that many directory stack
806219d2e3deSDmitry Chaginentries are saved.
806319d2e3deSDmitry Chagin.TP 8
806419d2e3deSDmitry Chagin.B savehist
806519d2e3deSDmitry ChaginIf set, the shell does
806619d2e3deSDmitry Chagin.Sq history \-S
806719d2e3deSDmitry Chaginbefore exiting.
806819d2e3deSDmitry ChaginIf the first word is set to a number, at most that many lines are saved.
806919d2e3deSDmitry Chagin(The number should be less than or equal to the number
807019d2e3deSDmitry Chagin.Va history
807119d2e3deSDmitry Chaginentries;
807219d2e3deSDmitry Chaginif it is set to greater than the number of
807319d2e3deSDmitry Chagin.Va history
807419d2e3deSDmitry Chaginsettings, only
807519d2e3deSDmitry Chagin.Va history
807619d2e3deSDmitry Chaginentries will be saved)
807719d2e3deSDmitry ChaginIf the second word is set to
807819d2e3deSDmitry Chagin.Sq merge
807919d2e3deSDmitry Chagin, the history list is merged with
808019d2e3deSDmitry Chaginthe existing history file instead of replacing it (if there is one) and
808119d2e3deSDmitry Chaginsorted by time stamp and the most recent events are retained.
808219d2e3deSDmitry ChaginIf the second word of
808319d2e3deSDmitry Chagin.Va savehist
808419d2e3deSDmitry Chaginis
808519d2e3deSDmitry Chagin.Sq merge
808619d2e3deSDmitry Chaginand the third word is set to
808719d2e3deSDmitry Chagin`lock', the history file update will be serialized with other shell sessions
808819d2e3deSDmitry Chaginthat would possibly like to merge history at exactly the same time. (+)
808919d2e3deSDmitry Chagin.TP 8
809019d2e3deSDmitry Chagin.B sched \fR(+)
809119d2e3deSDmitry ChaginThe format in which the
809219d2e3deSDmitry Chagin.Va sched
809319d2e3deSDmitry Chaginbuiltin command prints scheduled events;
809419d2e3deSDmitry Chaginif not given,
809519d2e3deSDmitry Chagin.Sq %h\et%T\et%R\en
809619d2e3deSDmitry Chaginis used.
809719d2e3deSDmitry ChaginThe format sequences are described above under
809819d2e3deSDmitry Chagin.Va prompt
809919d2e3deSDmitry Chagin;
810019d2e3deSDmitry Chaginnote the variable meaning of
810119d2e3deSDmitry Chagin.Sq %R
810219d2e3deSDmitry Chagin.TP 8
810319d2e3deSDmitry Chagin.B shell
810419d2e3deSDmitry ChaginThe file in which the shell resides.
810519d2e3deSDmitry ChaginThis is used in forking
810619d2e3deSDmitry Chaginshells to interpret files which have execute bits set, but
810719d2e3deSDmitry Chaginwhich are not executable by the system.
810819d2e3deSDmitry Chagin(See the description
810919d2e3deSDmitry Chaginof
811019d2e3deSDmitry Chagin.Va Builtin and non-builtin command execution
811119d2e3deSDmitry Chagin.)  Initialized to the
811219d2e3deSDmitry Chagin(system-dependent) home of the shell.
811319d2e3deSDmitry Chagin.TP 8
811419d2e3deSDmitry Chagin.B shlvl \fR(+)
811519d2e3deSDmitry ChaginThe number of nested shells.
811619d2e3deSDmitry ChaginReset to 1 in login shells.
811719d2e3deSDmitry ChaginSee also
811819d2e3deSDmitry Chagin.Va loginsh
811919d2e3deSDmitry Chagin.TP 8
812019d2e3deSDmitry Chagin.B status
812119d2e3deSDmitry ChaginThe exit status from the last command or backquote expansion, or any
812219d2e3deSDmitry Chagincommand in a pipeline is propagated to
812319d2e3deSDmitry Chagin.Va status
812419d2e3deSDmitry Chagin(This is also the
812519d2e3deSDmitry Chagindefault
812619d2e3deSDmitry Chagin.Xr csh 1
812719d2e3deSDmitry Chaginbehavior.)
812819d2e3deSDmitry ChaginThis default does not match what POSIX mandates (to return the
812919d2e3deSDmitry Chaginstatus of the last command only). To match the POSIX behavior, you need
813019d2e3deSDmitry Chaginto unset
813119d2e3deSDmitry Chagin.Va anyerror
813219d2e3deSDmitry Chagin.RS +8
813319d2e3deSDmitry Chagin.Pp
813419d2e3deSDmitry ChaginIf the
813519d2e3deSDmitry Chagin.Va anyerror
813619d2e3deSDmitry Chaginvariable is unset, the exit status of a pipeline
813719d2e3deSDmitry Chaginis determined only from the last command in the pipeline, and the exit
813819d2e3deSDmitry Chaginstatus of a backquote expansion is
813919d2e3deSDmitry Chagin.Va not
814019d2e3deSDmitry Chaginpropagated to
814119d2e3deSDmitry Chagin.Va status
814219d2e3deSDmitry Chagin.Pp
814319d2e3deSDmitry ChaginIf a command terminated abnormally, then 0200 is added to the status.
814419d2e3deSDmitry ChaginBuiltin commands which fail return exit status
814519d2e3deSDmitry Chagin.Sq 1
814619d2e3deSDmitry Chagin, all other builtin
814719d2e3deSDmitry Chagincommands return status
814819d2e3deSDmitry Chagin.Sq 0
814919d2e3deSDmitry Chagin.RE
815019d2e3deSDmitry Chagin.TP 8
815119d2e3deSDmitry Chagin.B symlinks \fR(+)
815219d2e3deSDmitry ChaginCan be set to several different values to control symbolic link (`symlink')
815319d2e3deSDmitry Chaginresolution:
815419d2e3deSDmitry Chagin.RS +8
815519d2e3deSDmitry Chagin.Pp
815619d2e3deSDmitry ChaginIf set to
815719d2e3deSDmitry Chagin.Sq chase
815819d2e3deSDmitry Chagin, whenever the current directory changes to a directory
815919d2e3deSDmitry Chagincontaining a symbolic link, it is expanded to the real name of the directory
816019d2e3deSDmitry Chaginto which the link points.
816119d2e3deSDmitry ChaginThis does not work for the user's home directory;
816219d2e3deSDmitry Chaginthis is a bug.
816319d2e3deSDmitry Chagin.Pp
816419d2e3deSDmitry ChaginIf set to
816519d2e3deSDmitry Chagin.Sq ignore
816619d2e3deSDmitry Chagin, the shell tries to construct a current directory
816719d2e3deSDmitry Chaginrelative to the current directory before the link was crossed.
816819d2e3deSDmitry ChaginThis means that
816919d2e3deSDmitry Chagin.Va cd
817019d2e3deSDmitry Chagining through a symbolic link and then
817119d2e3deSDmitry Chagin.Sq cd ..
817219d2e3deSDmitry Chagining
817319d2e3deSDmitry Chaginreturns one to the original directory.
817419d2e3deSDmitry ChaginThis affects only builtin commands
817519d2e3deSDmitry Chaginand filename completion.
817619d2e3deSDmitry Chagin.Pp
817719d2e3deSDmitry ChaginIf set to
817819d2e3deSDmitry Chagin.Sq expand
817919d2e3deSDmitry Chagin, the shell tries to fix symbolic links by actually expanding
818019d2e3deSDmitry Chaginarguments which look like path names.
818119d2e3deSDmitry ChaginThis affects any command, not just
818219d2e3deSDmitry Chaginbuiltins.
818319d2e3deSDmitry ChaginUnfortunately, this does not work for hard-to-recognize filenames,
818419d2e3deSDmitry Chaginsuch as those embedded in command options.
818519d2e3deSDmitry ChaginExpansion may be prevented by
818619d2e3deSDmitry Chaginquoting.
818719d2e3deSDmitry ChaginWhile this setting is usually the most convenient, it is sometimes
818819d2e3deSDmitry Chaginmisleading and sometimes confusing when it fails to recognize an argument
818919d2e3deSDmitry Chaginwhich should be expanded.
819019d2e3deSDmitry ChaginA compromise is to use
819119d2e3deSDmitry Chagin.Sq ignore
819219d2e3deSDmitry Chaginand use the
819319d2e3deSDmitry Chagineditor command
819419d2e3deSDmitry Chagin.Va normalize-path
819519d2e3deSDmitry Chagin(bound by default to ^X-n) when necessary.
819619d2e3deSDmitry Chagin.Pp
819719d2e3deSDmitry ChaginSome examples are in order.
819819d2e3deSDmitry ChaginFirst, let's set up some play directories:
819919d2e3deSDmitry Chagin.IP "" 4
820019d2e3deSDmitry Chagin> cd /tmp
820119d2e3deSDmitry Chagin.br
820219d2e3deSDmitry Chagin> mkdir from from/src to
820319d2e3deSDmitry Chagin.br
820419d2e3deSDmitry Chagin> ln \-s from/src to/dst
820519d2e3deSDmitry Chagin.Pp
820619d2e3deSDmitry ChaginHere's the behavior with
820719d2e3deSDmitry Chagin.Va symlinks
820819d2e3deSDmitry Chaginunset,
820919d2e3deSDmitry Chagin.IP "" 4
821019d2e3deSDmitry Chagin> cd /tmp/to/dst; echo $cwd
821119d2e3deSDmitry Chagin.br
821219d2e3deSDmitry Chagin/tmp/to/dst
821319d2e3deSDmitry Chagin.br
821419d2e3deSDmitry Chagin> cd ..; echo $cwd
821519d2e3deSDmitry Chagin.br
821619d2e3deSDmitry Chagin/tmp/from
821719d2e3deSDmitry Chagin.Pp
821819d2e3deSDmitry Chaginhere's the behavior with
821919d2e3deSDmitry Chagin.Va symlinks
822019d2e3deSDmitry Chaginset to
822119d2e3deSDmitry Chagin.Sq chase
822219d2e3deSDmitry Chagin,
822319d2e3deSDmitry Chagin.IP "" 4
822419d2e3deSDmitry Chagin> cd /tmp/to/dst; echo $cwd
822519d2e3deSDmitry Chagin.br
822619d2e3deSDmitry Chagin/tmp/from/src
822719d2e3deSDmitry Chagin.br
822819d2e3deSDmitry Chagin> cd ..; echo $cwd
822919d2e3deSDmitry Chagin.br
823019d2e3deSDmitry Chagin/tmp/from
823119d2e3deSDmitry Chagin.Pp
823219d2e3deSDmitry Chaginhere's the behavior with
823319d2e3deSDmitry Chagin.Va symlinks
823419d2e3deSDmitry Chaginset to
823519d2e3deSDmitry Chagin.Sq ignore
823619d2e3deSDmitry Chagin,
823719d2e3deSDmitry Chagin.IP "" 4
823819d2e3deSDmitry Chagin> cd /tmp/to/dst; echo $cwd
823919d2e3deSDmitry Chagin.br
824019d2e3deSDmitry Chagin/tmp/to/dst
824119d2e3deSDmitry Chagin.br
824219d2e3deSDmitry Chagin> cd ..; echo $cwd
824319d2e3deSDmitry Chagin.br
824419d2e3deSDmitry Chagin/tmp/to
824519d2e3deSDmitry Chagin.Pp
824619d2e3deSDmitry Chaginand here's the behavior with
824719d2e3deSDmitry Chagin.Va symlinks
824819d2e3deSDmitry Chaginset to
824919d2e3deSDmitry Chagin.Sq expand
825019d2e3deSDmitry Chagin.IP "" 4
825119d2e3deSDmitry Chagin> cd /tmp/to/dst; echo $cwd
825219d2e3deSDmitry Chagin.br
825319d2e3deSDmitry Chagin/tmp/to/dst
825419d2e3deSDmitry Chagin.br
825519d2e3deSDmitry Chagin> cd ..; echo $cwd
825619d2e3deSDmitry Chagin.br
825719d2e3deSDmitry Chagin/tmp/to
825819d2e3deSDmitry Chagin.br
825919d2e3deSDmitry Chagin> cd /tmp/to/dst; echo $cwd
826019d2e3deSDmitry Chagin.br
826119d2e3deSDmitry Chagin/tmp/to/dst
826219d2e3deSDmitry Chagin.br
826319d2e3deSDmitry Chagin> cd ".."; echo $cwd
826419d2e3deSDmitry Chagin.br
826519d2e3deSDmitry Chagin/tmp/from
826619d2e3deSDmitry Chagin.br
826719d2e3deSDmitry Chagin> /bin/echo ..
826819d2e3deSDmitry Chagin.br
826919d2e3deSDmitry Chagin/tmp/to
827019d2e3deSDmitry Chagin.br
827119d2e3deSDmitry Chagin> /bin/echo ".."
827219d2e3deSDmitry Chagin.br
827319d2e3deSDmitry Chagin\&..
827419d2e3deSDmitry Chagin.Pp
827519d2e3deSDmitry ChaginNote that
827619d2e3deSDmitry Chagin.Sq expand
827719d2e3deSDmitry Chaginexpansion 1) works just like
827819d2e3deSDmitry Chagin.Sq ignore
827919d2e3deSDmitry Chaginfor builtins
828019d2e3deSDmitry Chaginlike
828119d2e3deSDmitry Chagin.Va cd
828219d2e3deSDmitry Chagin, 2) is prevented by quoting, and 3) happens before
828319d2e3deSDmitry Chaginfilenames are passed to non-builtin commands.
828419d2e3deSDmitry Chagin.RE
828519d2e3deSDmitry Chagin.TP 8
828619d2e3deSDmitry Chagin.B tcsh \fR(+)
828719d2e3deSDmitry ChaginThe version number of the shell in the format
828819d2e3deSDmitry Chagin.Sq R.VV.Pp
828919d2e3deSDmitry Chagin,
829019d2e3deSDmitry Chaginwhere
829119d2e3deSDmitry Chagin.Sq R
829219d2e3deSDmitry Chaginis the major release number,
829319d2e3deSDmitry Chagin.Sq VV
829419d2e3deSDmitry Chaginthe current version
829519d2e3deSDmitry Chaginand
829619d2e3deSDmitry Chagin.Sq PP
829719d2e3deSDmitry Chaginthe patchlevel.
829819d2e3deSDmitry Chagin.TP 8
829919d2e3deSDmitry Chagin.B term
830019d2e3deSDmitry ChaginThe terminal type.
830119d2e3deSDmitry ChaginUsually set in
830219d2e3deSDmitry Chagin.Va ~/.login
830319d2e3deSDmitry Chaginas described under
830419d2e3deSDmitry Chagin.Va Startup and shutdown
830519d2e3deSDmitry Chagin.TP 8
830619d2e3deSDmitry Chagin.B time
830719d2e3deSDmitry ChaginIf set to a number, then the
830819d2e3deSDmitry Chagin.Va time
830919d2e3deSDmitry Chaginbuiltin (q.v.) executes automatically
831019d2e3deSDmitry Chaginafter each command which takes more than that many CPU seconds.
831119d2e3deSDmitry ChaginIf there is a second word, it is used as a format string for the output
831219d2e3deSDmitry Chaginof the
831319d2e3deSDmitry Chagin.Va time
831419d2e3deSDmitry Chaginbuiltin.
831519d2e3deSDmitry Chagin(u) The following sequences may be used in the
831619d2e3deSDmitry Chaginformat string:
831719d2e3deSDmitry Chagin.Pp
831819d2e3deSDmitry Chagin.RS +8
831919d2e3deSDmitry Chagin.PD 0
832019d2e3deSDmitry Chagin.TP 4
832119d2e3deSDmitry Chagin%U
832219d2e3deSDmitry ChaginThe time the process spent in user mode in cpu seconds.
832319d2e3deSDmitry Chagin.TP 4
832419d2e3deSDmitry Chagin%S
832519d2e3deSDmitry ChaginThe time the process spent in kernel mode in cpu seconds.
832619d2e3deSDmitry Chagin.TP 4
832719d2e3deSDmitry Chagin%E
832819d2e3deSDmitry ChaginThe elapsed (wall clock) time in seconds.
832919d2e3deSDmitry Chagin.TP 4
833019d2e3deSDmitry Chagin%P
833119d2e3deSDmitry ChaginThe CPU percentage computed as (%U + %S) / %E.
833219d2e3deSDmitry Chagin.TP 4
833319d2e3deSDmitry Chagin%W
833419d2e3deSDmitry ChaginNumber of times the process was swapped.
833519d2e3deSDmitry Chagin.TP 4
833619d2e3deSDmitry Chagin%X
833719d2e3deSDmitry ChaginThe average amount in (shared) text space used in Kbytes.
833819d2e3deSDmitry Chagin.TP 4
833919d2e3deSDmitry Chagin%D
834019d2e3deSDmitry ChaginThe average amount in (unshared) data/stack space used in Kbytes.
834119d2e3deSDmitry Chagin.TP 4
834219d2e3deSDmitry Chagin%K
834319d2e3deSDmitry ChaginThe total space used (%X + %D) in Kbytes.
834419d2e3deSDmitry Chagin.TP 4
834519d2e3deSDmitry Chagin%M
834619d2e3deSDmitry ChaginThe maximum memory the process had in use at any time in Kbytes.
834719d2e3deSDmitry Chagin.TP 4
834819d2e3deSDmitry Chagin%F
834919d2e3deSDmitry ChaginThe number of major page faults (page needed to be brought from disk).
835019d2e3deSDmitry Chagin.TP 4
835119d2e3deSDmitry Chagin%R
835219d2e3deSDmitry ChaginThe number of minor page faults.
835319d2e3deSDmitry Chagin.TP 4
835419d2e3deSDmitry Chagin%I
835519d2e3deSDmitry ChaginThe number of input operations.
835619d2e3deSDmitry Chagin.TP 4
835719d2e3deSDmitry Chagin%O
835819d2e3deSDmitry ChaginThe number of output operations.
835919d2e3deSDmitry Chagin.TP 4
836019d2e3deSDmitry Chagin%r
836119d2e3deSDmitry ChaginThe number of socket messages received.
836219d2e3deSDmitry Chagin.TP 4
836319d2e3deSDmitry Chagin%s
836419d2e3deSDmitry ChaginThe number of socket messages sent.
836519d2e3deSDmitry Chagin.TP 4
836619d2e3deSDmitry Chagin%k
836719d2e3deSDmitry ChaginThe number of signals received.
836819d2e3deSDmitry Chagin.TP 4
836919d2e3deSDmitry Chagin%w
837019d2e3deSDmitry ChaginThe number of voluntary context switches (waits).
837119d2e3deSDmitry Chagin.TP 4
837219d2e3deSDmitry Chagin%c
837319d2e3deSDmitry ChaginThe number of involuntary context switches.
837419d2e3deSDmitry Chagin.PD
837519d2e3deSDmitry Chagin.Pp
837619d2e3deSDmitry ChaginOnly the first four sequences are supported on systems without BSD resource
837719d2e3deSDmitry Chaginlimit functions.
837819d2e3deSDmitry ChaginThe default time format is
837919d2e3deSDmitry Chagin.Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww
838019d2e3deSDmitry Chaginfor
838119d2e3deSDmitry Chaginsystems that support resource usage reporting and
838219d2e3deSDmitry Chagin.Sq %Uu %Ss %E %P
838319d2e3deSDmitry Chaginfor
838419d2e3deSDmitry Chaginsystems that do not.
838519d2e3deSDmitry Chagin.Pp
838619d2e3deSDmitry ChaginUnder Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
838719d2e3deSDmitry Chaginavailable, but the following additional sequences are:
838819d2e3deSDmitry Chagin.Pp
838919d2e3deSDmitry Chagin.PD 0
839019d2e3deSDmitry Chagin.TP 4
839119d2e3deSDmitry Chagin%Y
839219d2e3deSDmitry ChaginThe number of system calls performed.
839319d2e3deSDmitry Chagin.TP 4
839419d2e3deSDmitry Chagin%Z
839519d2e3deSDmitry ChaginThe number of pages which are zero-filled on demand.
839619d2e3deSDmitry Chagin.TP 4
839719d2e3deSDmitry Chagin%i
839819d2e3deSDmitry ChaginThe number of times a process's resident set size was increased by the kernel.
839919d2e3deSDmitry Chagin.TP 4
840019d2e3deSDmitry Chagin%d
840119d2e3deSDmitry ChaginThe number of times a process's resident set size was decreased by the kernel.
840219d2e3deSDmitry Chagin.TP 4
840319d2e3deSDmitry Chagin%l
840419d2e3deSDmitry ChaginThe number of read system calls performed.
840519d2e3deSDmitry Chagin.TP 4
840619d2e3deSDmitry Chagin%m
840719d2e3deSDmitry ChaginThe number of write system calls performed.
840819d2e3deSDmitry Chagin.TP 4
840919d2e3deSDmitry Chagin%p
841019d2e3deSDmitry ChaginThe number of reads from raw disk devices.
841119d2e3deSDmitry Chagin.TP 4
841219d2e3deSDmitry Chagin%q
841319d2e3deSDmitry ChaginThe number of writes to raw disk devices.
841419d2e3deSDmitry Chagin.PD
841519d2e3deSDmitry Chagin.Pp
841619d2e3deSDmitry Chaginand the default time format is
841719d2e3deSDmitry Chagin.Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww
841819d2e3deSDmitry ChaginNote that the CPU percentage can be higher than 100% on multi-processors.
841919d2e3deSDmitry Chagin.RE
842019d2e3deSDmitry Chagin.TP 8
842119d2e3deSDmitry Chagin.B tperiod \fR(+)
842219d2e3deSDmitry ChaginThe period, in minutes, between executions of the
842319d2e3deSDmitry Chagin.Va periodic
842419d2e3deSDmitry Chaginspecial alias.
842519d2e3deSDmitry Chagin.TP 8
842619d2e3deSDmitry Chagin.B tty \fR(+)
842719d2e3deSDmitry ChaginThe name of the tty, or empty if not attached to one.
842819d2e3deSDmitry Chagin.TP 8
842919d2e3deSDmitry Chagin.B uid \fR(+)
843019d2e3deSDmitry ChaginThe user's real user ID.
843119d2e3deSDmitry Chagin.TP 8
843219d2e3deSDmitry Chagin.B user
843319d2e3deSDmitry ChaginThe user's login name.
843419d2e3deSDmitry Chagin.TP 8
843519d2e3deSDmitry Chagin.B verbose
843619d2e3deSDmitry ChaginIf set, causes the words of each
843719d2e3deSDmitry Chagincommand to be printed, after history substitution (if any).
843819d2e3deSDmitry ChaginSet by the
843919d2e3deSDmitry Chagin.Fl v\fR command line option.
844019d2e3deSDmitry Chagin.TP 8
844119d2e3deSDmitry Chagin.B version \fR(+)
844219d2e3deSDmitry ChaginThe version ID stamp.
844319d2e3deSDmitry ChaginIt contains the shell's version number (see
844419d2e3deSDmitry Chagin.Va tcsh
844519d2e3deSDmitry Chagin),
844619d2e3deSDmitry Chaginorigin, release date, vendor, operating system and machine (see
844719d2e3deSDmitry Chagin.Va VENDOR
844819d2e3deSDmitry Chagin,
844919d2e3deSDmitry Chagin.Va OSTYPE
845019d2e3deSDmitry Chaginand
845119d2e3deSDmitry Chagin.Va MACHTYPE
845219d2e3deSDmitry Chagin) and a comma-separated
845319d2e3deSDmitry Chaginlist of options which were set at compile time.
845419d2e3deSDmitry ChaginOptions which are set by default in the distribution are noted.
845519d2e3deSDmitry Chagin.Pp
845619d2e3deSDmitry Chagin.RS +8
845719d2e3deSDmitry Chagin.PD 0
845819d2e3deSDmitry Chagin.TP 6
845919d2e3deSDmitry Chagin8b
846019d2e3deSDmitry ChaginThe shell is eight bit clean; default
846119d2e3deSDmitry Chagin.TP 6
846219d2e3deSDmitry Chagin7b
846319d2e3deSDmitry ChaginThe shell is not eight bit clean
846419d2e3deSDmitry Chagin.TP 6
846519d2e3deSDmitry Chaginwide
846619d2e3deSDmitry ChaginThe shell is multibyte encoding clean (like UTF-8)
846719d2e3deSDmitry Chagin.TP 6
846819d2e3deSDmitry Chaginnls
846919d2e3deSDmitry ChaginThe system's NLS is used; default for systems with NLS
847019d2e3deSDmitry Chagin.TP 6
847119d2e3deSDmitry Chaginlf
847219d2e3deSDmitry ChaginLogin shells execute
847319d2e3deSDmitry Chagin.Va /etc/csh.login
847419d2e3deSDmitry Chaginbefore instead of after
847519d2e3deSDmitry Chagin.Va /etc/csh.cshrc
847619d2e3deSDmitry Chaginand
847719d2e3deSDmitry Chagin.Va ~/.login
847819d2e3deSDmitry Chaginbefore instead of after
847919d2e3deSDmitry Chagin.Va ~/.tcshrc
848019d2e3deSDmitry Chaginand
848119d2e3deSDmitry Chagin.Va ~/.history
848219d2e3deSDmitry Chagin.TP 6
848319d2e3deSDmitry Chagindl
848419d2e3deSDmitry Chagin`.' is put last in
848519d2e3deSDmitry Chagin.Va path
848619d2e3deSDmitry Chaginfor security; default
848719d2e3deSDmitry Chagin.TP 6
848819d2e3deSDmitry Chaginnd
848919d2e3deSDmitry Chagin`.' is omitted from
849019d2e3deSDmitry Chagin.Va path
849119d2e3deSDmitry Chaginfor security
849219d2e3deSDmitry Chagin.TP 6
849319d2e3deSDmitry Chaginvi
849419d2e3deSDmitry Chagin.Va vi
849519d2e3deSDmitry Chagin(1)\-style editing is the default rather than
849619d2e3deSDmitry Chagin.Va emacs
849719d2e3deSDmitry Chagin(1)\-style
849819d2e3deSDmitry Chagin.TP 6
849919d2e3deSDmitry Chagindtr
850019d2e3deSDmitry ChaginLogin shells drop DTR when exiting
850119d2e3deSDmitry Chagin.TP 6
850219d2e3deSDmitry Chaginbye
850319d2e3deSDmitry Chagin.Va bye
850419d2e3deSDmitry Chaginis a synonym for
850519d2e3deSDmitry Chagin.Va logout
850619d2e3deSDmitry Chaginand
850719d2e3deSDmitry Chagin.Va log
850819d2e3deSDmitry Chaginis an alternate name for
850919d2e3deSDmitry Chagin.Va watchlog
851019d2e3deSDmitry Chagin.TP 6
851119d2e3deSDmitry Chaginal
851219d2e3deSDmitry Chagin.Va autologout
851319d2e3deSDmitry Chaginis enabled; default
851419d2e3deSDmitry Chagin.TP 6
851519d2e3deSDmitry Chaginkan
851619d2e3deSDmitry ChaginKanji is used if appropriate according to locale settings,
851719d2e3deSDmitry Chaginunless the
851819d2e3deSDmitry Chagin.Va nokanji
851919d2e3deSDmitry Chaginshell variable is set
852019d2e3deSDmitry Chagin.TP 6
852119d2e3deSDmitry Chaginsm
852219d2e3deSDmitry ChaginThe system's
852319d2e3deSDmitry Chagin.Va malloc
852419d2e3deSDmitry Chagin(3) is used
852519d2e3deSDmitry Chagin.TP 6
852619d2e3deSDmitry Chaginhb
852719d2e3deSDmitry ChaginThe
852819d2e3deSDmitry Chagin.Sq #!<program> <args>
852919d2e3deSDmitry Chaginconvention is emulated when executing shell scripts
853019d2e3deSDmitry Chagin.TP 6
853119d2e3deSDmitry Chaginng
853219d2e3deSDmitry ChaginThe
853319d2e3deSDmitry Chagin.Va newgrp
853419d2e3deSDmitry Chaginbuiltin is available
853519d2e3deSDmitry Chagin.TP 6
853619d2e3deSDmitry Chaginrh
853719d2e3deSDmitry ChaginThe shell attempts to set the
853819d2e3deSDmitry Chagin.Va REMOTEHOST
853919d2e3deSDmitry Chaginenvironment variable
854019d2e3deSDmitry Chagin.TP 6
854119d2e3deSDmitry Chaginafs
854219d2e3deSDmitry ChaginThe shell verifies your password with the kerberos server if local
854319d2e3deSDmitry Chaginauthentication fails.
854419d2e3deSDmitry ChaginThe
854519d2e3deSDmitry Chagin.Va afsuser
854619d2e3deSDmitry Chaginshell variable or the
854719d2e3deSDmitry Chagin.Va AFSUSER
854819d2e3deSDmitry Chaginenvironment variable override your local username if set.
854919d2e3deSDmitry Chagin.PD
855019d2e3deSDmitry Chagin.Pp
855119d2e3deSDmitry ChaginAn administrator may enter additional strings to indicate differences
855219d2e3deSDmitry Chaginin the local version.
855319d2e3deSDmitry Chagin.RE
855419d2e3deSDmitry Chagin.TP 8
855519d2e3deSDmitry Chagin.B vimode \fR(+)
855619d2e3deSDmitry Chagin.RS +8
855719d2e3deSDmitry ChaginIf unset, various key bindings change behavior to be more
855819d2e3deSDmitry Chagin.Va emacs
855919d2e3deSDmitry Chagin(1)\-style:
856019d2e3deSDmitry Chaginword boundaries are determined by
856119d2e3deSDmitry Chagin.Va wordchars
856219d2e3deSDmitry Chaginversus other characters.
856319d2e3deSDmitry Chagin.Pp
856419d2e3deSDmitry ChaginIf set, various key bindings change behavior to be more
856519d2e3deSDmitry Chagin.Va vi
856619d2e3deSDmitry Chagin(1)\-style:
856719d2e3deSDmitry Chaginword boundaries are determined by
856819d2e3deSDmitry Chagin.Va wordchars
856919d2e3deSDmitry Chaginversus whitespace
857019d2e3deSDmitry Chaginversus other characters;
857119d2e3deSDmitry Chagincursor behavior depends upon current vi mode (command, delete, insert, replace).
857219d2e3deSDmitry Chagin.Pp
857319d2e3deSDmitry ChaginThis variable is unset by
857419d2e3deSDmitry Chagin.Va bindkey
857519d2e3deSDmitry Chagin
857619d2e3deSDmitry Chagin.Va -e
857719d2e3deSDmitry Chaginand
857819d2e3deSDmitry Chaginset by
857919d2e3deSDmitry Chagin.Va bindkey
858019d2e3deSDmitry Chagin
858119d2e3deSDmitry Chagin.Va -v
858219d2e3deSDmitry Chagin.B vimode
858319d2e3deSDmitry Chaginmay be explicitly set or unset by the user after those
858419d2e3deSDmitry Chagin.Va bindkey
858519d2e3deSDmitry Chaginoperations if required.
858619d2e3deSDmitry Chagin.RE
858719d2e3deSDmitry Chagin.TP 8
858819d2e3deSDmitry Chagin.B visiblebell \fR(+)
858919d2e3deSDmitry ChaginIf set, a screen flash is used rather than the audible bell.
859019d2e3deSDmitry ChaginSee also
859119d2e3deSDmitry Chagin.Va nobeep
859219d2e3deSDmitry Chagin.TP 8
859319d2e3deSDmitry Chagin.B watch \fR(+)
859419d2e3deSDmitry ChaginA list of user/terminal pairs to watch for logins and logouts.
859519d2e3deSDmitry ChaginIf either the user is
859619d2e3deSDmitry Chagin.Sq any
859719d2e3deSDmitry Chaginall terminals are watched for the given user
859819d2e3deSDmitry Chaginand vice versa.
859919d2e3deSDmitry ChaginSetting
860019d2e3deSDmitry Chagin.Va watch
860119d2e3deSDmitry Chaginto
860219d2e3deSDmitry Chagin.Sq (any any)
860319d2e3deSDmitry Chaginwatches all users and terminals.
860419d2e3deSDmitry ChaginFor example,
860519d2e3deSDmitry Chagin.RS +8
860619d2e3deSDmitry Chagin.IP "" 4
860719d2e3deSDmitry Chaginset watch = (george ttyd1 any console $user any)
860819d2e3deSDmitry Chagin.Pp
860919d2e3deSDmitry Chaginreports activity of the user
861019d2e3deSDmitry Chagin.Sq george
861119d2e3deSDmitry Chaginon ttyd1, any user on the console, and
861219d2e3deSDmitry Chaginoneself (or a trespasser) on any terminal.
861319d2e3deSDmitry Chagin.Pp
861419d2e3deSDmitry ChaginLogins and logouts are checked every 10 minutes by default, but the first
861519d2e3deSDmitry Chaginword of
861619d2e3deSDmitry Chagin.Va watch
861719d2e3deSDmitry Chagincan be set to a number to check every so many minutes.
861819d2e3deSDmitry ChaginFor example,
861919d2e3deSDmitry Chagin.IP "" 4
862019d2e3deSDmitry Chaginset watch = (1 any any)
862119d2e3deSDmitry Chagin.Pp
862219d2e3deSDmitry Chaginreports any login/logout once every minute.
862319d2e3deSDmitry ChaginFor the impatient, the
862419d2e3deSDmitry Chagin.Va log
862519d2e3deSDmitry Chaginbuiltin command triggers a
862619d2e3deSDmitry Chagin.Va watch
862719d2e3deSDmitry Chaginreport at any time.
862819d2e3deSDmitry ChaginAll current logins
862919d2e3deSDmitry Chaginare reported (as with the
863019d2e3deSDmitry Chagin.Va log
863119d2e3deSDmitry Chaginbuiltin) when
863219d2e3deSDmitry Chagin.Va watch
863319d2e3deSDmitry Chaginis first set.
863419d2e3deSDmitry Chagin.Pp
863519d2e3deSDmitry ChaginThe
863619d2e3deSDmitry Chagin.Va who
863719d2e3deSDmitry Chaginshell variable controls the format of
863819d2e3deSDmitry Chagin.Va watch
863919d2e3deSDmitry Chaginreports.
864019d2e3deSDmitry Chagin.RE
864119d2e3deSDmitry Chagin.TP 8
864219d2e3deSDmitry Chagin.B who \fR(+)
864319d2e3deSDmitry ChaginThe format string for
864419d2e3deSDmitry Chagin.Va watch
864519d2e3deSDmitry Chaginmessages.
864619d2e3deSDmitry ChaginThe following sequences
864719d2e3deSDmitry Chaginare replaced by the given information:
864819d2e3deSDmitry Chagin.Pp
864919d2e3deSDmitry Chagin.RS +8
865019d2e3deSDmitry Chagin.PD 0
865119d2e3deSDmitry Chagin.TP 4
865219d2e3deSDmitry Chagin%n
865319d2e3deSDmitry ChaginThe name of the user who logged in/out.
865419d2e3deSDmitry Chagin.TP 4
865519d2e3deSDmitry Chagin%a
865619d2e3deSDmitry ChaginThe observed action, i.e.,
865719d2e3deSDmitry Chagin.Sq logged on
865819d2e3deSDmitry Chagin,
865919d2e3deSDmitry Chagin.Sq logged off
866019d2e3deSDmitry Chaginor
866119d2e3deSDmitry Chagin.Sq replaced
866219d2e3deSDmitry Chagin.Va olduser
866319d2e3deSDmitry Chaginon
866419d2e3deSDmitry Chagin.TP 4
866519d2e3deSDmitry Chagin%l
866619d2e3deSDmitry ChaginThe terminal (tty) on which the user logged in/out.
866719d2e3deSDmitry Chagin.TP 4
866819d2e3deSDmitry Chagin%M
866919d2e3deSDmitry ChaginThe full hostname of the remote host, or
867019d2e3deSDmitry Chagin.Sq local
867119d2e3deSDmitry Chaginif the login/logout was
867219d2e3deSDmitry Chaginfrom the local host.
867319d2e3deSDmitry Chagin.TP 4
867419d2e3deSDmitry Chagin%m
867519d2e3deSDmitry ChaginThe hostname of the remote host up to the first
867619d2e3deSDmitry Chagin.Sq .
867719d2e3deSDmitry ChaginThe full name is printed if it is an IP address or an X Window System display.
867819d2e3deSDmitry Chagin.PD
867919d2e3deSDmitry Chagin.Pp
868019d2e3deSDmitry Chagin%M and %m are available on only systems that store the remote hostname in
868119d2e3deSDmitry Chagin.Va /etc/utmp
868219d2e3deSDmitry ChaginIf unset,
868319d2e3deSDmitry Chagin.Sq %n has %a %l from %m.
868419d2e3deSDmitry Chaginis used, or
868519d2e3deSDmitry Chagin.Sq %n has %a %l.
868619d2e3deSDmitry Chaginon systems
868719d2e3deSDmitry Chaginwhich don't store the remote hostname.
868819d2e3deSDmitry Chagin.RE
868919d2e3deSDmitry Chagin.TP 8
869019d2e3deSDmitry Chagin.B wordchars \fR(+)
869119d2e3deSDmitry ChaginA list of non-alphanumeric characters to be considered part of a word by the
869219d2e3deSDmitry Chagin.Va forward-word
869319d2e3deSDmitry Chagin,
869419d2e3deSDmitry Chagin.Va backward-word
869519d2e3deSDmitry Chaginetc., editor commands.
869619d2e3deSDmitry ChaginIf unset, the default value is determined based on the state of
869719d2e3deSDmitry Chagin.Va vimode
869819d2e3deSDmitry Chagin:
869919d2e3deSDmitry Chaginif
870019d2e3deSDmitry Chagin.Va vimode
870119d2e3deSDmitry Chaginis unset,
870219d2e3deSDmitry Chagin.Sq *?_\-.[]~=
870319d2e3deSDmitry Chaginis used as the default;
870419d2e3deSDmitry Chaginif
870519d2e3deSDmitry Chagin.Va vimode
870619d2e3deSDmitry Chaginis set,
870719d2e3deSDmitry Chagin.Sq _
870819d2e3deSDmitry Chaginis used as the default.
870919d2e3deSDmitry Chagin.Sh ENVIRONMENT
871019d2e3deSDmitry Chagin.TP 8
871119d2e3deSDmitry Chagin.B AFSUSER \fR(+)
871219d2e3deSDmitry ChaginEquivalent to the
871319d2e3deSDmitry Chagin.Va afsuser
871419d2e3deSDmitry Chaginshell variable.
871519d2e3deSDmitry Chagin.TP 8
871619d2e3deSDmitry Chagin.B COLUMNS
871719d2e3deSDmitry ChaginThe number of columns in the terminal.
871819d2e3deSDmitry ChaginSee
871919d2e3deSDmitry Chagin.Va Terminal management
872019d2e3deSDmitry Chagin.TP 8
872119d2e3deSDmitry Chagin.B DISPLAY
872219d2e3deSDmitry ChaginUsed by X Window System (see
872319d2e3deSDmitry Chagin.Va X
872419d2e3deSDmitry Chagin(1)).
872519d2e3deSDmitry ChaginIf set, the shell does not set
872619d2e3deSDmitry Chagin.Va autologout
872719d2e3deSDmitry Chagin(q.v.).
872819d2e3deSDmitry Chagin.TP 8
872919d2e3deSDmitry Chagin.B EDITOR
873019d2e3deSDmitry ChaginThe pathname to a default editor.
873119d2e3deSDmitry ChaginUsed by the
873219d2e3deSDmitry Chagin.Va run-fg-editor
873319d2e3deSDmitry Chagineditor command if the
873419d2e3deSDmitry Chaginthe
873519d2e3deSDmitry Chagin.Va editors
873619d2e3deSDmitry Chaginshell variable is unset.
873719d2e3deSDmitry ChaginSee also the
873819d2e3deSDmitry Chagin.Va VISUAL
873919d2e3deSDmitry Chaginenvironment variable.
874019d2e3deSDmitry Chagin.TP 8
874119d2e3deSDmitry Chagin.B GROUP \fR(+)
874219d2e3deSDmitry ChaginEquivalent to the
874319d2e3deSDmitry Chagin.Va group
874419d2e3deSDmitry Chaginshell variable.
874519d2e3deSDmitry Chagin.TP 8
874619d2e3deSDmitry Chagin.B HOME
874719d2e3deSDmitry ChaginEquivalent to the
874819d2e3deSDmitry Chagin.Va home
874919d2e3deSDmitry Chaginshell variable.
875019d2e3deSDmitry Chagin.TP 8
875119d2e3deSDmitry Chagin.B HOST \fR(+)
875219d2e3deSDmitry ChaginInitialized to the name of the machine on which the shell
875319d2e3deSDmitry Chaginis running, as determined by the
875419d2e3deSDmitry Chagin.Va gethostname
875519d2e3deSDmitry Chagin(2) system call.
875619d2e3deSDmitry Chagin.TP 8
875719d2e3deSDmitry Chagin.B HOSTTYPE \fR(+)
875819d2e3deSDmitry ChaginInitialized to the type of machine on which the shell
875919d2e3deSDmitry Chaginis running, as determined at compile time.
876019d2e3deSDmitry ChaginThis variable is obsolete and
876119d2e3deSDmitry Chaginwill be removed in a future version.
876219d2e3deSDmitry Chagin.TP 8
876319d2e3deSDmitry Chagin.B HPATH \fR(+)
876419d2e3deSDmitry ChaginA colon-separated list of directories in which the
876519d2e3deSDmitry Chagin.Va run-help
876619d2e3deSDmitry Chagineditor
876719d2e3deSDmitry Chagincommand looks for command documentation.
876819d2e3deSDmitry Chagin.TP 8
876919d2e3deSDmitry Chagin.B LANG
877019d2e3deSDmitry ChaginGives the preferred character environment.
877119d2e3deSDmitry ChaginSee
877219d2e3deSDmitry Chagin.Va Native Language System support
877319d2e3deSDmitry Chagin.TP 8
877419d2e3deSDmitry Chagin.B LC_CTYPE
877519d2e3deSDmitry ChaginIf set, only ctype character handling is changed.
877619d2e3deSDmitry ChaginSee
877719d2e3deSDmitry Chagin.Va Native Language System support
877819d2e3deSDmitry Chagin.TP 8
877919d2e3deSDmitry Chagin.B LINES
878019d2e3deSDmitry ChaginThe number of lines in the terminal.
878119d2e3deSDmitry ChaginSee
878219d2e3deSDmitry Chagin.Va Terminal management
878319d2e3deSDmitry Chagin.TP 8
878419d2e3deSDmitry Chagin.B LS_COLORS
878519d2e3deSDmitry ChaginThe format of this variable is reminiscent of the
878619d2e3deSDmitry Chagin.Va termcap(5)
878719d2e3deSDmitry Chaginfile format; a colon-separated list of expressions of the form
878819d2e3deSDmitry Chagin"
878919d2e3deSDmitry Chagin.Va xx=string
879019d2e3deSDmitry Chagin", where "
879119d2e3deSDmitry Chagin.Va xx
879219d2e3deSDmitry Chagin" is a two-character variable name.
879319d2e3deSDmitry ChaginThe
879419d2e3deSDmitry Chaginvariables with their associated defaults are:
879519d2e3deSDmitry Chagin.Pp
879619d2e3deSDmitry Chagin.RS +8
879719d2e3deSDmitry Chagin.RS +4
879819d2e3deSDmitry Chagin.PD 0
879919d2e3deSDmitry Chagin.TP 12
880019d2e3deSDmitry Chaginno	0
880119d2e3deSDmitry ChaginNormal (non-filename) text
880219d2e3deSDmitry Chagin.TP 12
880319d2e3deSDmitry Chaginfi	0
880419d2e3deSDmitry ChaginRegular file
880519d2e3deSDmitry Chagin.TP 12
880619d2e3deSDmitry Chagindi	01;34
880719d2e3deSDmitry ChaginDirectory
880819d2e3deSDmitry Chagin.TP 12
880919d2e3deSDmitry Chaginln	01;36
881019d2e3deSDmitry ChaginSymbolic link
881119d2e3deSDmitry Chagin.TP 12
881219d2e3deSDmitry Chaginpi	33
881319d2e3deSDmitry ChaginNamed pipe (FIFO)
881419d2e3deSDmitry Chagin.TP 12
881519d2e3deSDmitry Chaginso	01;35
881619d2e3deSDmitry ChaginSocket
881719d2e3deSDmitry Chagin.TP 12
881819d2e3deSDmitry Chagindo	01;35
881919d2e3deSDmitry ChaginDoor
882019d2e3deSDmitry Chagin.TP 12
882119d2e3deSDmitry Chaginbd	01;33
882219d2e3deSDmitry ChaginBlock device
882319d2e3deSDmitry Chagin.TP 12
882419d2e3deSDmitry Chagincd	01;32
882519d2e3deSDmitry ChaginCharacter device
882619d2e3deSDmitry Chagin.TP 12
882719d2e3deSDmitry Chaginex	01;32
882819d2e3deSDmitry ChaginExecutable file
882919d2e3deSDmitry Chagin.TP 12
883019d2e3deSDmitry Chaginmi	(none)
883119d2e3deSDmitry ChaginMissing file (defaults to fi)
883219d2e3deSDmitry Chagin.TP 12
883319d2e3deSDmitry Chaginor	(none)
883419d2e3deSDmitry ChaginOrphaned symbolic link (defaults to ln)
883519d2e3deSDmitry Chagin.TP 12
883619d2e3deSDmitry Chaginlc	^[[
883719d2e3deSDmitry ChaginLeft code
883819d2e3deSDmitry Chagin.TP 12
883919d2e3deSDmitry Chaginrc	m
884019d2e3deSDmitry ChaginRight code
884119d2e3deSDmitry Chagin.TP 12
884219d2e3deSDmitry Chaginec	(none)
884319d2e3deSDmitry ChaginEnd code (replaces lc+no+rc)
884419d2e3deSDmitry Chagin.PD
884519d2e3deSDmitry Chagin.RE
884619d2e3deSDmitry Chagin.Pp
884719d2e3deSDmitry ChaginYou need to include only the variables you want to change from
884819d2e3deSDmitry Chaginthe default.
884919d2e3deSDmitry Chagin.Pp
885019d2e3deSDmitry ChaginFile names can also be colorized based on filename extension.
885119d2e3deSDmitry ChaginThis is specified in the
885219d2e3deSDmitry Chagin.Va LS_COLORS
885319d2e3deSDmitry Chaginvariable using the syntax
885419d2e3deSDmitry Chagin.Va "*ext=string"
885519d2e3deSDmitry ChaginFor example, using ISO 6429 codes, to color
885619d2e3deSDmitry Chaginall C\-language source files blue you would specify
885719d2e3deSDmitry Chagin.Va "*.c=34"
885819d2e3deSDmitry ChaginThis would color all files ending in
885919d2e3deSDmitry Chagin.Va .c
886019d2e3deSDmitry Chaginin blue (34) color.
886119d2e3deSDmitry Chagin.Pp
886219d2e3deSDmitry ChaginControl characters can be written either in C\-style\-escaped
886319d2e3deSDmitry Chaginnotation, or in stty\-like ^\-notation.
886419d2e3deSDmitry ChaginThe C\-style notation
886519d2e3deSDmitry Chaginadds
886619d2e3deSDmitry Chagin.Va ^[
886719d2e3deSDmitry Chaginfor Escape, \fB\_\fR for a normal space character,
886819d2e3deSDmitry Chaginand
886919d2e3deSDmitry Chagin.Va ?
887019d2e3deSDmitry Chaginfor Delete.
887119d2e3deSDmitry ChaginIn addition, the
887219d2e3deSDmitry Chagin.Va ^[
887319d2e3deSDmitry Chaginescape character
887419d2e3deSDmitry Chagincan be used to override the default interpretation of
887519d2e3deSDmitry Chagin.Va ^[
887619d2e3deSDmitry Chagin,
887719d2e3deSDmitry Chagin.Va ^
887819d2e3deSDmitry Chagin,
887919d2e3deSDmitry Chagin.Va :
888019d2e3deSDmitry Chaginand
888119d2e3deSDmitry Chagin.Va =
888219d2e3deSDmitry Chagin.Pp
888319d2e3deSDmitry ChaginEach file will be written as
888419d2e3deSDmitry Chagin.Va <lc>
888519d2e3deSDmitry Chagin
888619d2e3deSDmitry Chagin.Va <color-code>
888719d2e3deSDmitry Chagin.Va <rc>
888819d2e3deSDmitry Chagin
888919d2e3deSDmitry Chagin.Va <filename>
889019d2e3deSDmitry Chagin
889119d2e3deSDmitry Chagin.Va <ec>
889219d2e3deSDmitry ChaginIf the
889319d2e3deSDmitry Chagin.Va <ec>
889419d2e3deSDmitry Chagincode is undefined, the sequence
889519d2e3deSDmitry Chagin.Va <lc>
889619d2e3deSDmitry Chagin\fB<no>
889719d2e3deSDmitry Chagin.Va <rc>
889819d2e3deSDmitry Chaginwill be used instead.
889919d2e3deSDmitry ChaginThis is generally more convenient
890019d2e3deSDmitry Chaginto use, but less general.
890119d2e3deSDmitry ChaginThe left, right and end codes are
890219d2e3deSDmitry Chaginprovided so you don't have to type common parts over and over
890319d2e3deSDmitry Chaginagain and to support weird terminals; you will generally not
890419d2e3deSDmitry Chaginneed to change them at all unless your terminal does not use
890519d2e3deSDmitry ChaginISO 6429 color sequences but a different system.
890619d2e3deSDmitry Chagin.Pp
890719d2e3deSDmitry ChaginIf your terminal does use ISO 6429 color codes, you can
890819d2e3deSDmitry Chagincompose the type codes (i.e., all except the
890919d2e3deSDmitry Chagin.Va lc
891019d2e3deSDmitry Chagin,
891119d2e3deSDmitry Chagin.Va rc
891219d2e3deSDmitry Chagin,
891319d2e3deSDmitry Chaginand
891419d2e3deSDmitry Chagin.Va ec
891519d2e3deSDmitry Chagincodes) from numerical commands separated by semicolons.
891619d2e3deSDmitry ChaginThe
891719d2e3deSDmitry Chaginmost common commands are:
891819d2e3deSDmitry Chagin.Pp
891919d2e3deSDmitry Chagin.RS +8
892019d2e3deSDmitry Chagin.PD 0
892119d2e3deSDmitry Chagin.TP 4
892219d2e3deSDmitry Chagin0
892319d2e3deSDmitry Chaginto restore default color
892419d2e3deSDmitry Chagin.TP 4
892519d2e3deSDmitry Chagin1
892619d2e3deSDmitry Chaginfor brighter colors
892719d2e3deSDmitry Chagin.TP 4
892819d2e3deSDmitry Chagin4
892919d2e3deSDmitry Chaginfor underlined text
893019d2e3deSDmitry Chagin.TP 4
893119d2e3deSDmitry Chagin5
893219d2e3deSDmitry Chaginfor flashing text
893319d2e3deSDmitry Chagin.TP 4
893419d2e3deSDmitry Chagin30
893519d2e3deSDmitry Chaginfor black foreground
893619d2e3deSDmitry Chagin.TP 4
893719d2e3deSDmitry Chagin31
893819d2e3deSDmitry Chaginfor red foreground
893919d2e3deSDmitry Chagin.TP 4
894019d2e3deSDmitry Chagin32
894119d2e3deSDmitry Chaginfor green foreground
894219d2e3deSDmitry Chagin.TP 4
894319d2e3deSDmitry Chagin33
894419d2e3deSDmitry Chaginfor yellow (or brown) foreground
894519d2e3deSDmitry Chagin.TP 4
894619d2e3deSDmitry Chagin34
894719d2e3deSDmitry Chaginfor blue foreground
894819d2e3deSDmitry Chagin.TP 4
894919d2e3deSDmitry Chagin35
895019d2e3deSDmitry Chaginfor purple foreground
895119d2e3deSDmitry Chagin.TP 4
895219d2e3deSDmitry Chagin36
895319d2e3deSDmitry Chaginfor cyan foreground
895419d2e3deSDmitry Chagin.TP 4
895519d2e3deSDmitry Chagin37
895619d2e3deSDmitry Chaginfor white (or gray) foreground
895719d2e3deSDmitry Chagin.TP 4
895819d2e3deSDmitry Chagin40
895919d2e3deSDmitry Chaginfor black background
896019d2e3deSDmitry Chagin.TP 4
896119d2e3deSDmitry Chagin41
896219d2e3deSDmitry Chaginfor red background
896319d2e3deSDmitry Chagin.TP 4
896419d2e3deSDmitry Chagin42
896519d2e3deSDmitry Chaginfor green background
896619d2e3deSDmitry Chagin.TP 4
896719d2e3deSDmitry Chagin43
896819d2e3deSDmitry Chaginfor yellow (or brown) background
896919d2e3deSDmitry Chagin.TP 4
897019d2e3deSDmitry Chagin44
897119d2e3deSDmitry Chaginfor blue background
897219d2e3deSDmitry Chagin.TP 4
897319d2e3deSDmitry Chagin45
897419d2e3deSDmitry Chaginfor purple background
897519d2e3deSDmitry Chagin.TP 4
897619d2e3deSDmitry Chagin46
897719d2e3deSDmitry Chaginfor cyan background
897819d2e3deSDmitry Chagin.TP 4
897919d2e3deSDmitry Chagin47
898019d2e3deSDmitry Chaginfor white (or gray) background
898119d2e3deSDmitry Chagin.PD
898219d2e3deSDmitry Chagin.RE
898319d2e3deSDmitry Chagin.Pp
898419d2e3deSDmitry ChaginNot all commands will work on all systems or display devices.
898519d2e3deSDmitry Chagin.Pp
898619d2e3deSDmitry ChaginA few terminal programs do not recognize the default end code
898719d2e3deSDmitry Chaginproperly.
898819d2e3deSDmitry ChaginIf all text gets colorized after you do a directory
898919d2e3deSDmitry Chaginlisting, try changing the
899019d2e3deSDmitry Chagin.Va no
899119d2e3deSDmitry Chaginand
899219d2e3deSDmitry Chagin.Va fi
899319d2e3deSDmitry Chagincodes from 0 to the
899419d2e3deSDmitry Chaginnumerical codes for your standard fore- and background colors.
899519d2e3deSDmitry Chagin.RE
899619d2e3deSDmitry Chagin.TP 8
899719d2e3deSDmitry Chagin.B MACHTYPE \fR(+)
899819d2e3deSDmitry ChaginThe machine type (microprocessor class or machine model), as determined at compile time.
899919d2e3deSDmitry Chagin.TP 8
900019d2e3deSDmitry Chagin.B NOREBIND \fR(+)
900119d2e3deSDmitry ChaginIf set, printable characters are not rebound to
900219d2e3deSDmitry Chagin.Va self-insert-command
900319d2e3deSDmitry ChaginSee
900419d2e3deSDmitry Chagin.Va Native Language System support
900519d2e3deSDmitry Chagin.TP 8
900619d2e3deSDmitry Chagin.B OSTYPE \fR(+)
900719d2e3deSDmitry ChaginThe operating system, as determined at compile time.
900819d2e3deSDmitry Chagin.TP 8
900919d2e3deSDmitry Chagin.B PATH
901019d2e3deSDmitry ChaginA colon-separated list of directories in which to look for executables.
901119d2e3deSDmitry ChaginEquivalent to the
901219d2e3deSDmitry Chagin.Va path
901319d2e3deSDmitry Chaginshell variable, but in a different format.
901419d2e3deSDmitry Chagin.TP 8
901519d2e3deSDmitry Chagin.B PWD \fR(+)
901619d2e3deSDmitry ChaginEquivalent to the
901719d2e3deSDmitry Chagin.Va cwd
901819d2e3deSDmitry Chaginshell variable, but not synchronized to it;
901919d2e3deSDmitry Chaginupdated only after an actual directory change.
902019d2e3deSDmitry Chagin.TP 8
902119d2e3deSDmitry Chagin.B REMOTEHOST \fR(+)
902219d2e3deSDmitry ChaginThe host from which the user has logged in remotely, if this is the case and
902319d2e3deSDmitry Chaginthe shell is able to determine it.
902419d2e3deSDmitry ChaginSet only if the shell was so compiled;
902519d2e3deSDmitry Chaginsee the
902619d2e3deSDmitry Chagin.Va version
902719d2e3deSDmitry Chaginshell variable.
902819d2e3deSDmitry Chagin.TP 8
902919d2e3deSDmitry Chagin.B SHLVL \fR(+)
903019d2e3deSDmitry ChaginEquivalent to the
903119d2e3deSDmitry Chagin.Va shlvl
903219d2e3deSDmitry Chaginshell variable.
903319d2e3deSDmitry Chagin.TP 8
903419d2e3deSDmitry Chagin.B SYSTYPE \fR(+)
903519d2e3deSDmitry ChaginThe current system type.
903619d2e3deSDmitry Chagin(Domain/OS only)
903719d2e3deSDmitry Chagin.TP 8
903819d2e3deSDmitry Chagin.B TERM
903919d2e3deSDmitry ChaginEquivalent to the
904019d2e3deSDmitry Chagin.Va term
904119d2e3deSDmitry Chaginshell variable.
904219d2e3deSDmitry Chagin.TP 8
904319d2e3deSDmitry Chagin.B TERMCAP
904419d2e3deSDmitry ChaginThe terminal capability string.
904519d2e3deSDmitry ChaginSee
904619d2e3deSDmitry Chagin.Va Terminal management
904719d2e3deSDmitry Chagin.TP 8
904819d2e3deSDmitry Chagin.B USER
904919d2e3deSDmitry ChaginEquivalent to the
905019d2e3deSDmitry Chagin.Va user
905119d2e3deSDmitry Chaginshell variable.
905219d2e3deSDmitry Chagin.TP 8
905319d2e3deSDmitry Chagin.B VENDOR \fR(+)
905419d2e3deSDmitry ChaginThe vendor, as determined at compile time.
905519d2e3deSDmitry Chagin.TP 8
905619d2e3deSDmitry Chagin.B VISUAL
905719d2e3deSDmitry ChaginThe pathname to a default full-screen editor.
905819d2e3deSDmitry ChaginUsed by the
905919d2e3deSDmitry Chagin.Va run-fg-editor
906019d2e3deSDmitry Chagineditor command if the
906119d2e3deSDmitry Chaginthe
906219d2e3deSDmitry Chagin.Va editors
906319d2e3deSDmitry Chaginshell variable is unset.
906419d2e3deSDmitry ChaginSee also the
906519d2e3deSDmitry Chagin.Va EDITOR
906619d2e3deSDmitry Chaginenvironment variable.
906719d2e3deSDmitry Chagin.Sh FILES
906819d2e3deSDmitry Chagin.PD 0
906919d2e3deSDmitry Chagin.TP 16
907019d2e3deSDmitry Chagin.I /etc/csh.cshrc
907119d2e3deSDmitry ChaginRead first by every shell.
907219d2e3deSDmitry ChaginConvexOS, Stellix and Intel use
907319d2e3deSDmitry Chagin.Va /etc/cshrc
907419d2e3deSDmitry Chaginand
907519d2e3deSDmitry ChaginNeXTs use
907619d2e3deSDmitry Chagin.Va /etc/cshrc.std
907719d2e3deSDmitry ChaginA/UX, AMIX, Cray and IRIX have no equivalent in
907819d2e3deSDmitry Chagin.Xr csh 1
907919d2e3deSDmitry Chagin,
908019d2e3deSDmitry Chaginbut read this file in
908119d2e3deSDmitry Chagin.Nm
908219d2e3deSDmitry Chaginanyway.
908319d2e3deSDmitry ChaginSolaris 2.x does not have it either, but
908419d2e3deSDmitry Chagin.Nm
908519d2e3deSDmitry Chaginreads
908619d2e3deSDmitry Chagin.Va /etc/.cshrc
908719d2e3deSDmitry Chagin(+)
908819d2e3deSDmitry Chagin.TP 16
908919d2e3deSDmitry Chagin.I /etc/csh.login
909019d2e3deSDmitry ChaginRead by login shells after
909119d2e3deSDmitry Chagin.Va /etc/csh.cshrc
909219d2e3deSDmitry ChaginConvexOS, Stellix and Intel use
909319d2e3deSDmitry Chagin.Va /etc/login
909419d2e3deSDmitry Chagin,
909519d2e3deSDmitry ChaginNeXTs use
909619d2e3deSDmitry Chagin.Va /etc/login.std
909719d2e3deSDmitry Chagin, Solaris 2.x uses
909819d2e3deSDmitry Chagin.Va /etc/.login
909919d2e3deSDmitry Chaginand
910019d2e3deSDmitry ChaginA/UX, AMIX, Cray and IRIX use
910119d2e3deSDmitry Chagin.Va /etc/cshrc
910219d2e3deSDmitry Chagin.TP 16
910319d2e3deSDmitry Chagin.I ~/.tcshrc \fR(+)
910419d2e3deSDmitry ChaginRead by every shell after
910519d2e3deSDmitry Chagin.Va /etc/csh.cshrc
910619d2e3deSDmitry Chaginor its equivalent.
910719d2e3deSDmitry Chagin.TP 16
910819d2e3deSDmitry Chagin.I ~/.cshrc
910919d2e3deSDmitry ChaginRead by every shell, if
911019d2e3deSDmitry Chagin.Va ~/.tcshrc
911119d2e3deSDmitry Chagindoesn't exist,
911219d2e3deSDmitry Chaginafter
911319d2e3deSDmitry Chagin.Va /etc/csh.cshrc
911419d2e3deSDmitry Chaginor its equivalent.
911519d2e3deSDmitry ChaginThis manual uses
911619d2e3deSDmitry Chagin.Sq
911719d2e3deSDmitry Chagin.Va ~/.tcshrc
911819d2e3deSDmitry Chaginto mean `
911919d2e3deSDmitry Chagin.Va ~/.tcshrc
912019d2e3deSDmitry Chaginor,
912119d2e3deSDmitry Chaginif
912219d2e3deSDmitry Chagin.Va ~/.tcshrc
912319d2e3deSDmitry Chaginis not found,
912419d2e3deSDmitry Chagin.Va ~/.cshrc
912519d2e3deSDmitry Chagin'.
912619d2e3deSDmitry Chagin.TP 16
912719d2e3deSDmitry Chagin.I ~/.history
912819d2e3deSDmitry ChaginRead by login shells after
912919d2e3deSDmitry Chagin.Va ~/.tcshrc
913019d2e3deSDmitry Chaginif
913119d2e3deSDmitry Chagin.Va savehist
913219d2e3deSDmitry Chaginis set, but see also
913319d2e3deSDmitry Chagin.Va histfile
913419d2e3deSDmitry Chagin.TP 16
913519d2e3deSDmitry Chagin.I ~/.login
913619d2e3deSDmitry ChaginRead by login shells after
913719d2e3deSDmitry Chagin.Va ~/.tcshrc
913819d2e3deSDmitry Chaginor
913919d2e3deSDmitry Chagin.Va ~/.history
914019d2e3deSDmitry ChaginThe shell may be compiled to read
914119d2e3deSDmitry Chagin.Va ~/.login
914219d2e3deSDmitry Chaginbefore instead of after
914319d2e3deSDmitry Chagin.Va ~/.tcshrc
914419d2e3deSDmitry Chaginand
914519d2e3deSDmitry Chagin.Va ~/.history
914619d2e3deSDmitry Chagin; see the
914719d2e3deSDmitry Chagin.Va version
914819d2e3deSDmitry Chaginshell variable.
914919d2e3deSDmitry Chagin.TP 16
915019d2e3deSDmitry Chagin.I ~/.cshdirs \fR(+)
915119d2e3deSDmitry ChaginRead by login shells after
915219d2e3deSDmitry Chagin.Va ~/.login
915319d2e3deSDmitry Chaginif
915419d2e3deSDmitry Chagin.Va savedirs
915519d2e3deSDmitry Chaginis set, but see also
915619d2e3deSDmitry Chagin.Va dirsfile
915719d2e3deSDmitry Chagin.TP 16
915819d2e3deSDmitry Chagin.I /etc/csh.logout
915919d2e3deSDmitry ChaginRead by login shells at logout.
916019d2e3deSDmitry ChaginConvexOS, Stellix and Intel use
916119d2e3deSDmitry Chagin.Va /etc/logout
916219d2e3deSDmitry Chaginand
916319d2e3deSDmitry ChaginNeXTs use
916419d2e3deSDmitry Chagin.Va /etc/logout.std
916519d2e3deSDmitry ChaginA/UX, AMIX, Cray and IRIX have no equivalent in
916619d2e3deSDmitry Chagin.Xr csh 1
916719d2e3deSDmitry Chagin,
916819d2e3deSDmitry Chaginbut read this file in
916919d2e3deSDmitry Chagin.Nm
917019d2e3deSDmitry Chaginanyway.
917119d2e3deSDmitry ChaginSolaris 2.x does not have it either, but
917219d2e3deSDmitry Chagin.Nm
917319d2e3deSDmitry Chaginreads
917419d2e3deSDmitry Chagin.Va /etc/.logout
917519d2e3deSDmitry Chagin(+)
917619d2e3deSDmitry Chagin.TP 16
917719d2e3deSDmitry Chagin.I ~/.logout
917819d2e3deSDmitry ChaginRead by login shells at logout after
917919d2e3deSDmitry Chagin.Va /etc/csh.logout
918019d2e3deSDmitry Chaginor its equivalent.
918119d2e3deSDmitry Chagin.TP 16
918219d2e3deSDmitry Chagin.I /bin/sh
918319d2e3deSDmitry ChaginUsed to interpret shell scripts not starting with a
918419d2e3deSDmitry Chagin.Sq #
918519d2e3deSDmitry Chagin.TP 16
918619d2e3deSDmitry Chagin.I /tmp/sh*
918719d2e3deSDmitry ChaginTemporary file for
918819d2e3deSDmitry Chagin.Sq <<
918919d2e3deSDmitry Chagin.TP 16
919019d2e3deSDmitry Chagin.I /etc/passwd
919119d2e3deSDmitry ChaginSource of home directories for
919219d2e3deSDmitry Chagin.Sq ~name
919319d2e3deSDmitry Chaginsubstitutions.
919419d2e3deSDmitry Chagin.PD
919519d2e3deSDmitry Chagin.Pp
919619d2e3deSDmitry ChaginThe order in which startup files are read may differ if the shell was so
919719d2e3deSDmitry Chagincompiled; see
919819d2e3deSDmitry Chagin.Va Startup and shutdown
919919d2e3deSDmitry Chaginand the
920019d2e3deSDmitry Chagin.Va version
920119d2e3deSDmitry Chaginshell variable.
920219d2e3deSDmitry Chagin.Sh "NEW FEATURES (+)"
920319d2e3deSDmitry ChaginThis manual describes
920419d2e3deSDmitry Chagin.Nm
920519d2e3deSDmitry Chaginas a single entity,
920619d2e3deSDmitry Chaginbut experienced
920719d2e3deSDmitry Chagin.Xr csh 1
920819d2e3deSDmitry Chaginusers will want to pay special attention to
920919d2e3deSDmitry Chagin.Nm
921019d2e3deSDmitry Chagin's new features.
921119d2e3deSDmitry Chagin.Pp
921219d2e3deSDmitry ChaginA command-line editor, which supports
921319d2e3deSDmitry Chagin.Va emacs
921419d2e3deSDmitry Chagin(1)\-style
921519d2e3deSDmitry Chaginor
921619d2e3deSDmitry Chagin.Va vi
921719d2e3deSDmitry Chagin(1)\-style key bindings.
921819d2e3deSDmitry ChaginSee
921919d2e3deSDmitry Chagin.Va The command-line editor
922019d2e3deSDmitry Chaginand
922119d2e3deSDmitry Chagin.Va Editor commands
922219d2e3deSDmitry Chagin.Pp
922319d2e3deSDmitry ChaginProgrammable, interactive word completion and listing.
922419d2e3deSDmitry ChaginSee
922519d2e3deSDmitry Chagin.Sx Completion and listing
922619d2e3deSDmitry Chaginand the
922719d2e3deSDmitry Chagin.Va complete
922819d2e3deSDmitry Chaginand
922919d2e3deSDmitry Chagin.Va uncomplete
923019d2e3deSDmitry Chaginbuiltin commands.
923119d2e3deSDmitry Chagin.Pp
923219d2e3deSDmitry Chagin.Va Spelling correction
923319d2e3deSDmitry Chagin(q.v.) of filenames, commands and variables.
923419d2e3deSDmitry Chagin.Pp
923519d2e3deSDmitry Chagin.Va Editor commands
923619d2e3deSDmitry Chagin(q.v.) which perform other useful functions in the middle of
923719d2e3deSDmitry Chagintyped commands, including documentation lookup
923819d2e3deSDmitry Chagin.Va ( run-help ),
923919d2e3deSDmitry Chaginquick editor restarting
924019d2e3deSDmitry Chagin.Va ( run-fg-editor )
924119d2e3deSDmitry Chaginand
924219d2e3deSDmitry Chagincommand resolution
924319d2e3deSDmitry Chagin.Va ( which-command ).
924419d2e3deSDmitry Chagin.Pp
924519d2e3deSDmitry ChaginAn enhanced history mechanism.
924619d2e3deSDmitry ChaginEvents in the history list are time-stamped.
924719d2e3deSDmitry ChaginSee also the
924819d2e3deSDmitry Chagin.Va history
924919d2e3deSDmitry Chagincommand and its associated shell variables,
925019d2e3deSDmitry Chaginthe previously undocumented
925119d2e3deSDmitry Chagin.Sq #
925219d2e3deSDmitry Chaginevent specifier and new modifiers
925319d2e3deSDmitry Chaginunder
925419d2e3deSDmitry Chagin.Va History substitution
925519d2e3deSDmitry Chagin,
925619d2e3deSDmitry Chaginthe
925719d2e3deSDmitry Chagin.Va *-history
925819d2e3deSDmitry Chagin,
925919d2e3deSDmitry Chagin.Va history-search-*
926019d2e3deSDmitry Chagin,
926119d2e3deSDmitry Chagin.Va i-search-*
926219d2e3deSDmitry Chagin,
926319d2e3deSDmitry Chagin.Va vi-search-*
926419d2e3deSDmitry Chaginand
926519d2e3deSDmitry Chagin.Va toggle-literal-history
926619d2e3deSDmitry Chagineditor commands
926719d2e3deSDmitry Chaginand the
926819d2e3deSDmitry Chagin.Va histlit
926919d2e3deSDmitry Chaginshell variable.
927019d2e3deSDmitry Chagin.Pp
927119d2e3deSDmitry ChaginEnhanced directory parsing and directory stack handling.
927219d2e3deSDmitry ChaginSee the
927319d2e3deSDmitry Chagin.Va cd
927419d2e3deSDmitry Chagin,
927519d2e3deSDmitry Chagin.Va pushd
927619d2e3deSDmitry Chagin,
927719d2e3deSDmitry Chagin.Va popd
927819d2e3deSDmitry Chaginand
927919d2e3deSDmitry Chagin.Va dirs
928019d2e3deSDmitry Chagincommands and their associated
928119d2e3deSDmitry Chaginshell variables, the description of
928219d2e3deSDmitry Chagin.Va Directory stack substitution
928319d2e3deSDmitry Chagin,
928419d2e3deSDmitry Chaginthe
928519d2e3deSDmitry Chagin.Va dirstack
928619d2e3deSDmitry Chagin,
928719d2e3deSDmitry Chagin.Va owd
928819d2e3deSDmitry Chaginand
928919d2e3deSDmitry Chagin.Va symlinks
929019d2e3deSDmitry Chaginshell variables and
929119d2e3deSDmitry Chaginthe
929219d2e3deSDmitry Chagin.Va normalize-command
929319d2e3deSDmitry Chaginand
929419d2e3deSDmitry Chagin.Va normalize-path
929519d2e3deSDmitry Chagineditor commands.
929619d2e3deSDmitry Chagin.Pp
929719d2e3deSDmitry ChaginNegation in glob-patterns.
929819d2e3deSDmitry ChaginSee
929919d2e3deSDmitry Chagin.Va Filename substitution
930019d2e3deSDmitry Chagin.Pp
930119d2e3deSDmitry ChaginNew
930219d2e3deSDmitry Chagin.Va File inquiry operators
930319d2e3deSDmitry Chagin(q.v.) and a
930419d2e3deSDmitry Chagin.Va filetest
930519d2e3deSDmitry Chaginbuiltin which uses them.
930619d2e3deSDmitry Chagin.Pp
930719d2e3deSDmitry ChaginA variety of
930819d2e3deSDmitry Chagin.Va Automatic, periodic and timed events
930919d2e3deSDmitry Chagin(q.v.) including
931019d2e3deSDmitry Chaginscheduled events, special aliases, automatic logout and terminal locking,
931119d2e3deSDmitry Chagincommand timing and watching for logins and logouts.
931219d2e3deSDmitry Chagin.Pp
931319d2e3deSDmitry ChaginSupport for the Native Language System
931419d2e3deSDmitry Chagin(see
931519d2e3deSDmitry Chagin.Va Native Language System support
931619d2e3deSDmitry Chagin),
931719d2e3deSDmitry ChaginOS variant features
931819d2e3deSDmitry Chagin(see
931919d2e3deSDmitry Chagin.Va OS variant support
932019d2e3deSDmitry Chaginand the
932119d2e3deSDmitry Chagin.Va echo_style
932219d2e3deSDmitry Chaginshell variable)
932319d2e3deSDmitry Chaginand system-dependent file locations (see
932419d2e3deSDmitry Chagin.Va FILES
932519d2e3deSDmitry Chagin).
932619d2e3deSDmitry Chagin.Pp
932719d2e3deSDmitry ChaginExtensive terminal-management capabilities.
932819d2e3deSDmitry ChaginSee
932919d2e3deSDmitry Chagin.Va Terminal management
933019d2e3deSDmitry Chagin.Pp
933119d2e3deSDmitry ChaginNew builtin commands including
933219d2e3deSDmitry Chagin.Va builtins
933319d2e3deSDmitry Chagin,
933419d2e3deSDmitry Chagin.Va hup
933519d2e3deSDmitry Chagin, \fIls\-F\fR,
933619d2e3deSDmitry Chagin.Va newgrp
933719d2e3deSDmitry Chagin,
933819d2e3deSDmitry Chagin.Va printenv
933919d2e3deSDmitry Chagin,
934019d2e3deSDmitry Chagin.Va which
934119d2e3deSDmitry Chaginand
934219d2e3deSDmitry Chagin.Va where
934319d2e3deSDmitry Chagin(q.v.).
934419d2e3deSDmitry Chagin.Pp
934519d2e3deSDmitry ChaginNew variables that make useful information easily available to the shell.
934619d2e3deSDmitry ChaginSee the
934719d2e3deSDmitry Chagin.Va gid
934819d2e3deSDmitry Chagin,
934919d2e3deSDmitry Chagin.Va loginsh
935019d2e3deSDmitry Chagin,
935119d2e3deSDmitry Chagin.Va oid
935219d2e3deSDmitry Chagin,
935319d2e3deSDmitry Chagin.Va shlvl
935419d2e3deSDmitry Chagin,
935519d2e3deSDmitry Chagin.Va tcsh
935619d2e3deSDmitry Chagin,
935719d2e3deSDmitry Chagin.Va tty
935819d2e3deSDmitry Chagin,
935919d2e3deSDmitry Chagin.Va uid
936019d2e3deSDmitry Chaginand
936119d2e3deSDmitry Chagin.Va version
936219d2e3deSDmitry Chaginshell variables and the
936319d2e3deSDmitry Chagin.Va HOST
936419d2e3deSDmitry Chagin,
936519d2e3deSDmitry Chagin.Va REMOTEHOST
936619d2e3deSDmitry Chagin,
936719d2e3deSDmitry Chagin.Va VENDOR
936819d2e3deSDmitry Chagin,
936919d2e3deSDmitry Chagin.Va OSTYPE
937019d2e3deSDmitry Chaginand
937119d2e3deSDmitry Chagin.Va MACHTYPE
937219d2e3deSDmitry Chaginenvironment
937319d2e3deSDmitry Chaginvariables.
937419d2e3deSDmitry Chagin.Pp
937519d2e3deSDmitry ChaginA new syntax for including useful information in the prompt string
937619d2e3deSDmitry Chagin(see
937719d2e3deSDmitry Chagin.Va prompt
937819d2e3deSDmitry Chagin),
937919d2e3deSDmitry Chaginand special prompts for loops and spelling correction
938019d2e3deSDmitry Chagin(see
938119d2e3deSDmitry Chagin.Va prompt2
938219d2e3deSDmitry Chaginand
938319d2e3deSDmitry Chagin.Va prompt3
938419d2e3deSDmitry Chagin).
938519d2e3deSDmitry Chagin.Pp
938619d2e3deSDmitry ChaginRead-only variables.
938719d2e3deSDmitry ChaginSee
938819d2e3deSDmitry Chagin.Va Variable substitution
938919d2e3deSDmitry Chagin.Sh BUGS
939019d2e3deSDmitry ChaginWhen a suspended command is restarted, the shell prints the directory
939119d2e3deSDmitry Chaginit started in if this is different from the current directory.
939219d2e3deSDmitry ChaginThis can
939319d2e3deSDmitry Chaginbe misleading (i.e., wrong) as the job may have changed directories internally.
939419d2e3deSDmitry Chagin.Pp
939519d2e3deSDmitry ChaginShell builtin functions are not stoppable/restartable.
939619d2e3deSDmitry ChaginCommand sequences
939719d2e3deSDmitry Chaginof the form
939819d2e3deSDmitry Chagin.Sq a ; b ; c
939919d2e3deSDmitry Chaginare also not handled gracefully when stopping is
940019d2e3deSDmitry Chaginattempted.
940119d2e3deSDmitry ChaginIf you suspend
940219d2e3deSDmitry Chagin.Sq b
940319d2e3deSDmitry Chagin, the shell will then immediately execute
940419d2e3deSDmitry Chagin`c'.
940519d2e3deSDmitry ChaginThis is especially noticeable if this expansion results from an
940619d2e3deSDmitry Chagin.Va alias
940719d2e3deSDmitry ChaginIt suffices to place the sequence of commands in ()'s to force it
940819d2e3deSDmitry Chaginto a subshell, i.e.,
940919d2e3deSDmitry Chagin.Sq ( a ; b ; c )
941019d2e3deSDmitry Chagin.Pp
941119d2e3deSDmitry ChaginControl over tty output after processes are started is primitive; perhaps
941219d2e3deSDmitry Chaginthis will inspire someone to work on a good virtual terminal interface.
941319d2e3deSDmitry ChaginIn a virtual terminal interface much more interesting things could be
941419d2e3deSDmitry Chagindone with output control.
941519d2e3deSDmitry Chagin.Pp
941619d2e3deSDmitry ChaginAlias substitution is most often used to clumsily simulate shell procedures;
941719d2e3deSDmitry Chaginshell procedures should be provided rather than aliases.
941819d2e3deSDmitry Chagin.Pp
941919d2e3deSDmitry ChaginControl structures should be parsed rather than being recognized as
942019d2e3deSDmitry Chaginbuilt-in commands.
942119d2e3deSDmitry ChaginThis would allow control commands to be placed anywhere,
942219d2e3deSDmitry Chaginto be combined with
942319d2e3deSDmitry Chagin.Sq |
942419d2e3deSDmitry Chagin, and to be used with
942519d2e3deSDmitry Chagin.Sq &
942619d2e3deSDmitry Chaginand
942719d2e3deSDmitry Chagin.Sq ;
942819d2e3deSDmitry Chaginmetasyntax.
942919d2e3deSDmitry Chagin.Pp
943019d2e3deSDmitry Chagin.Va foreach
943119d2e3deSDmitry Chagindoesn't ignore here documents when looking for its
943219d2e3deSDmitry Chagin.Va end
943319d2e3deSDmitry Chagin.Pp
943419d2e3deSDmitry ChaginIt should be possible to use the
943519d2e3deSDmitry Chagin.Sq \&:
943619d2e3deSDmitry Chaginmodifiers on the output of command
943719d2e3deSDmitry Chaginsubstitutions.
943819d2e3deSDmitry Chagin.Pp
943919d2e3deSDmitry ChaginThe screen update for lines longer than the screen width is very poor
944019d2e3deSDmitry Chaginif the terminal cannot move the cursor up (i.e., terminal type
944119d2e3deSDmitry Chagin.Sq dumb
944219d2e3deSDmitry Chagin).
944319d2e3deSDmitry Chagin.Pp
944419d2e3deSDmitry Chagin.Va HPATH
944519d2e3deSDmitry Chaginand
944619d2e3deSDmitry Chagin.Va NOREBIND
944719d2e3deSDmitry Chagindon't need to be environment variables.
944819d2e3deSDmitry Chagin.Pp
944919d2e3deSDmitry ChaginGlob-patterns which do not use
945019d2e3deSDmitry Chagin.Sq \&?
945119d2e3deSDmitry Chagin,
945219d2e3deSDmitry Chagin.Sq *
945319d2e3deSDmitry Chaginor
945419d2e3deSDmitry Chagin.Sq []
945519d2e3deSDmitry Chaginor which use
945619d2e3deSDmitry Chagin.Sq {}
945719d2e3deSDmitry Chaginor
945819d2e3deSDmitry Chagin.Sq ~
945919d2e3deSDmitry Chaginare not negated correctly.
946019d2e3deSDmitry Chagin.Pp
946119d2e3deSDmitry ChaginThe single-command form of
946219d2e3deSDmitry Chagin.Va if
946319d2e3deSDmitry Chagindoes output redirection even if
946419d2e3deSDmitry Chaginthe expression is false and the command is not executed.
946519d2e3deSDmitry Chagin.Pp
946619d2e3deSDmitry Chagin\fIls\-F\fR includes file identification characters when sorting filenames
946719d2e3deSDmitry Chaginand does not handle control characters in filenames well.
946819d2e3deSDmitry ChaginIt cannot be
946919d2e3deSDmitry Chagininterrupted.
947019d2e3deSDmitry Chagin.Pp
947119d2e3deSDmitry ChaginCommand substitution supports multiple commands and conditions, but not
947219d2e3deSDmitry Chagincycles or backward
947319d2e3deSDmitry Chagin.Va goto
947419d2e3deSDmitry Chagins.
947519d2e3deSDmitry Chagin.Pp
9476cc698b49SBrooks DavisReport bugs at https://bugs.astron.com/, preferably with fixes.
947719d2e3deSDmitry ChaginIf you want to
9478cc698b49SBrooks Davishelp maintain and test tcsh, add yourself to the mailing list in
9479cc698b49SBrooks Davishttps://mailman.astron.com/.
948019d2e3deSDmitry Chagin.Sq subscribe tcsh
948119d2e3deSDmitry Chaginon a line by itself in the body.
948219d2e3deSDmitry Chagin.Sh THE T IN TCSH
948319d2e3deSDmitry ChaginIn 1964, DEC produced the PDP-6.
948419d2e3deSDmitry ChaginThe PDP-10 was a later re-implementation.
948519d2e3deSDmitry ChaginIt
948619d2e3deSDmitry Chaginwas re-christened the DECsystem-10 in 1970 or so when DEC brought out the
948719d2e3deSDmitry Chaginsecond model, the KI10.
948819d2e3deSDmitry Chagin.Pp
948919d2e3deSDmitry ChaginTENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
949019d2e3deSDmitry Chaginthink tank) in
949119d2e3deSDmitry Chagin1972 as an experiment in demand-paged virtual memory operating systems.
949219d2e3deSDmitry ChaginThey
949319d2e3deSDmitry Chaginbuilt a new pager for the DEC PDP-10 and created the OS to go with it.
949419d2e3deSDmitry ChaginIt was
949519d2e3deSDmitry Chaginextremely successful in academia.
949619d2e3deSDmitry Chagin.Pp
949719d2e3deSDmitry ChaginIn 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
949819d2e3deSDmitry Chaginhave only a version of TENEX, which they had licensed from BBN, for the new
949919d2e3deSDmitry Chaginbox.
950019d2e3deSDmitry ChaginThey called their version TOPS-20 (their capitalization is trademarked).
950119d2e3deSDmitry ChaginA lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
950219d2e3deSDmitry Chaginfound themselves supporting two incompatible systems on the same hardware--but
950319d2e3deSDmitry Chaginthen there were 6 on the PDP-11!
950419d2e3deSDmitry Chagin.Pp
950519d2e3deSDmitry ChaginTENEX, and TOPS-20 to version 3, had command completion
950619d2e3deSDmitry Chaginvia a user-code-level subroutine library called ULTCMD.
950719d2e3deSDmitry ChaginWith version 3, DEC
950819d2e3deSDmitry Chaginmoved all that capability and more into the monitor (`kernel' for you Unix
950919d2e3deSDmitry Chagintypes), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
951019d2e3deSDmitry Chaginsupervisor call mechanism [are my IBM roots also showing?]).
951119d2e3deSDmitry Chagin.Pp
951219d2e3deSDmitry ChaginThe creator of tcsh was impressed by this feature and several others of TENEX
951319d2e3deSDmitry Chaginand TOPS-20, and created a version of csh which mimicked them.
951419d2e3deSDmitry Chagin.Sh LIMITATIONS
951519d2e3deSDmitry ChaginThe system limits argument lists to ARG_MAX characters.
951619d2e3deSDmitry Chagin.Pp
951719d2e3deSDmitry ChaginThe number of arguments to a command which involves filename expansion is
951819d2e3deSDmitry Chaginlimited to 1/6th the number of characters allowed in an argument list.
951919d2e3deSDmitry Chagin.Pp
952019d2e3deSDmitry ChaginCommand substitutions may substitute no more characters than are allowed in
952119d2e3deSDmitry Chaginan argument list.
952219d2e3deSDmitry Chagin.Pp
952319d2e3deSDmitry ChaginTo detect looping, the shell restricts the number of
952419d2e3deSDmitry Chagin.Va alias
952519d2e3deSDmitry Chaginsubstitutions on a single line to 20.
952619d2e3deSDmitry Chagin.Sh "SEE ALSO"
952719d2e3deSDmitry Chagincsh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
952819d2e3deSDmitry Chagintset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
952919d2e3deSDmitry Chaginpipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
953019d2e3deSDmitry Chaginmalloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
953119d2e3deSDmitry Chagintermio(7), Introduction to the C Shell
953219d2e3deSDmitry Chagin.Sh VERSION
9533*5224c2a3SDmitry ChaginThis manual documents tcsh 6.22.03 (Astron) 2020-11-18.
953419d2e3deSDmitry Chagin.Sh AUTHORS
953519d2e3deSDmitry Chagin.PD 0
953619d2e3deSDmitry Chagin.TP 2
953719d2e3deSDmitry ChaginWilliam Joy
953819d2e3deSDmitry ChaginOriginal author of
953919d2e3deSDmitry Chagin.Xr csh 1
954019d2e3deSDmitry Chagin.TP 2
954119d2e3deSDmitry ChaginJ.E. Kulp, IIASA, Laxenburg, Austria
954219d2e3deSDmitry ChaginJob control and directory stack features
954319d2e3deSDmitry Chagin.TP 2
954419d2e3deSDmitry ChaginKen Greer, HP Labs, 1981
954519d2e3deSDmitry ChaginFile name completion
954619d2e3deSDmitry Chagin.TP 2
954719d2e3deSDmitry ChaginMike Ellis, Fairchild, 1983
954819d2e3deSDmitry ChaginCommand name recognition/completion
954919d2e3deSDmitry Chagin.TP 2
955019d2e3deSDmitry ChaginPaul Placeway, Ohio State CIS Dept., 1983-1993
955119d2e3deSDmitry ChaginCommand line editor, prompt routines, new glob syntax and numerous fixes
955219d2e3deSDmitry Chaginand speedups
955319d2e3deSDmitry Chagin.TP 2
955419d2e3deSDmitry ChaginKarl Kleinpaste, CCI 1983-4
955519d2e3deSDmitry ChaginSpecial aliases, directory stack extraction stuff, login/logout watch,
955619d2e3deSDmitry Chaginscheduled events, and the idea of the new prompt format
955719d2e3deSDmitry Chagin.TP 2
955819d2e3deSDmitry ChaginRayan Zachariassen, University of Toronto, 1984
955919d2e3deSDmitry Chagin\fIls\-F\fR and
956019d2e3deSDmitry Chagin.Va which
956119d2e3deSDmitry Chaginbuiltins and numerous bug fixes, modifications
956219d2e3deSDmitry Chaginand speedups
956319d2e3deSDmitry Chagin.TP 2
956419d2e3deSDmitry ChaginChris Kingsley, Caltech
956519d2e3deSDmitry ChaginFast storage allocator routines
956619d2e3deSDmitry Chagin.TP 2
956719d2e3deSDmitry ChaginChris Grevstad, TRW, 1987
956819d2e3deSDmitry ChaginIncorporated 4.3BSD
956919d2e3deSDmitry Chagin.Xr csh 1
957019d2e3deSDmitry Chagininto
957119d2e3deSDmitry Chagin.Nm
957219d2e3deSDmitry Chagin.TP 2
957319d2e3deSDmitry ChaginChristos S. Zoulas, Cornell U. EE Dept., 1987-94
957419d2e3deSDmitry ChaginPorts to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
957519d2e3deSDmitry Chaginand a new version of sh.glob.c
957619d2e3deSDmitry Chagin.TP 2
957719d2e3deSDmitry ChaginJames J Dempsey, BBN, and Paul Placeway, OSU, 1988
957819d2e3deSDmitry ChaginA/UX port
957919d2e3deSDmitry Chagin.TP 2
958019d2e3deSDmitry ChaginDaniel Long, NNSC, 1988
958119d2e3deSDmitry Chagin.Va wordchars
958219d2e3deSDmitry Chagin.TP 2
958319d2e3deSDmitry ChaginPatrick Wolfe, Kuck and Associates, Inc., 1988
958419d2e3deSDmitry Chagin.Va vi
958519d2e3deSDmitry Chaginmode cleanup
958619d2e3deSDmitry Chagin.TP 2
958719d2e3deSDmitry ChaginDavid C Lawrence, Rensselaer Polytechnic Institute, 1989
958819d2e3deSDmitry Chagin.Va autolist
958919d2e3deSDmitry Chaginand ambiguous completion listing
959019d2e3deSDmitry Chagin.TP 2
959119d2e3deSDmitry ChaginAlec Wolman, DEC, 1989
959219d2e3deSDmitry ChaginNewlines in the prompt
959319d2e3deSDmitry Chagin.TP 2
959419d2e3deSDmitry ChaginMatt Landau, BBN, 1989
959519d2e3deSDmitry Chagin.Va ~/.tcshrc
959619d2e3deSDmitry Chagin.TP 2
959719d2e3deSDmitry ChaginRay Moody, Purdue Physics, 1989
959819d2e3deSDmitry ChaginMagic space bar history expansion
959919d2e3deSDmitry Chagin.TP 2
960019d2e3deSDmitry ChaginMordechai ????, Intel, 1989
960119d2e3deSDmitry Chaginprintprompt() fixes and additions
960219d2e3deSDmitry Chagin.TP 2
960319d2e3deSDmitry ChaginKazuhiro Honda, Dept. of Computer Science, Keio University, 1989
960419d2e3deSDmitry ChaginAutomatic spelling correction and
960519d2e3deSDmitry Chagin.Va prompt3
960619d2e3deSDmitry Chagin.TP 2
960719d2e3deSDmitry ChaginPer Hedeland, Ellemtel, Sweden, 1990-
960819d2e3deSDmitry ChaginVarious bugfixes, improvements and manual updates
960919d2e3deSDmitry Chagin.TP 2
961019d2e3deSDmitry ChaginHans J. Albertsson (Sun Sweden)
961119d2e3deSDmitry Chagin.Va ampm
961219d2e3deSDmitry Chagin,
961319d2e3deSDmitry Chagin.Va settc
961419d2e3deSDmitry Chaginand
961519d2e3deSDmitry Chagin.Va telltc
961619d2e3deSDmitry Chagin.TP 2
961719d2e3deSDmitry ChaginMichael Bloom
961819d2e3deSDmitry ChaginInterrupt handling fixes
961919d2e3deSDmitry Chagin.TP 2
962019d2e3deSDmitry ChaginMichael Fine, Digital Equipment Corp
962119d2e3deSDmitry ChaginExtended key support
962219d2e3deSDmitry Chagin.TP 2
962319d2e3deSDmitry ChaginEric Schnoebelen, Convex, 1990
962419d2e3deSDmitry ChaginConvex support, lots of
962519d2e3deSDmitry Chagin.Xr csh 1
962619d2e3deSDmitry Chaginbug fixes,
962719d2e3deSDmitry Chaginsave and restore of directory stack
962819d2e3deSDmitry Chagin.TP 2
962919d2e3deSDmitry ChaginRon Flax, Apple, 1990
963019d2e3deSDmitry ChaginA/UX 2.0 (re)port
963119d2e3deSDmitry Chagin.TP 2
963219d2e3deSDmitry ChaginDan Oscarsson, LTH Sweden, 1990
963319d2e3deSDmitry ChaginNLS support and simulated NLS support for non NLS sites, fixes
963419d2e3deSDmitry Chagin.TP 2
963519d2e3deSDmitry ChaginJohan Widen, SICS Sweden, 1990
963619d2e3deSDmitry Chagin.Va shlvl
963719d2e3deSDmitry Chagin, Mach support,
963819d2e3deSDmitry Chagin.Va correct-line
963919d2e3deSDmitry Chagin, 8-bit printing
964019d2e3deSDmitry Chagin.TP 2
964119d2e3deSDmitry ChaginMatt Day, Sanyo Icon, 1990
964219d2e3deSDmitry ChaginPOSIX termio support, SysV limit fixes
964319d2e3deSDmitry Chagin.TP 2
964419d2e3deSDmitry ChaginJaap Vermeulen, Sequent, 1990-91
964519d2e3deSDmitry ChaginVi mode fixes, expand-line, window change fixes, Symmetry port
964619d2e3deSDmitry Chagin.TP 2
964719d2e3deSDmitry ChaginMartin Boyer, Institut de recherche d'Hydro-Quebec, 1991
964819d2e3deSDmitry Chagin.Va autolist
964919d2e3deSDmitry Chaginbeeping options, modified the history search to search for
965019d2e3deSDmitry Chaginthe whole string from the beginning of the line to the cursor.
965119d2e3deSDmitry Chagin.TP 2
965219d2e3deSDmitry ChaginScott Krotz, Motorola, 1991
965319d2e3deSDmitry ChaginMinix port
965419d2e3deSDmitry Chagin.TP 2
965519d2e3deSDmitry ChaginDavid Dawes, Sydney U. Australia, Physics Dept., 1991
965619d2e3deSDmitry ChaginSVR4 job control fixes
965719d2e3deSDmitry Chagin.TP 2
965819d2e3deSDmitry ChaginJose Sousa, Interactive Systems Corp., 1991
965919d2e3deSDmitry ChaginExtended
966019d2e3deSDmitry Chagin.Va vi
966119d2e3deSDmitry Chaginfixes and
966219d2e3deSDmitry Chagin.Va vi
966319d2e3deSDmitry Chagindelete command
966419d2e3deSDmitry Chagin.TP 2
966519d2e3deSDmitry ChaginMarc Horowitz, MIT, 1991
966619d2e3deSDmitry ChaginANSIfication fixes, new exec hashing code, imake fixes,
966719d2e3deSDmitry Chagin.Va where
966819d2e3deSDmitry Chagin.TP 2
966919d2e3deSDmitry ChaginBruce Sterling Woodcock, sterling@netcom.com, 1991-1995
967019d2e3deSDmitry ChaginETA and Pyramid port, Makefile and lint fixes,
967119d2e3deSDmitry Chagin.Va ignoreeof
967219d2e3deSDmitry Chagin=n addition, and
967319d2e3deSDmitry Chaginvarious other portability changes and bug fixes
967419d2e3deSDmitry Chagin.TP 2
967519d2e3deSDmitry ChaginJeff Fink, 1992
967619d2e3deSDmitry Chagin.Va complete-word-fwd
967719d2e3deSDmitry Chaginand
967819d2e3deSDmitry Chagin.Va complete-word-back
967919d2e3deSDmitry Chagin.TP 2
968019d2e3deSDmitry ChaginHarry C. Pulley, 1992
968119d2e3deSDmitry ChaginCoherent port
968219d2e3deSDmitry Chagin.TP 2
968319d2e3deSDmitry ChaginAndy Phillips, Mullard Space Science Lab U.K., 1992
968419d2e3deSDmitry ChaginVMS-POSIX port
968519d2e3deSDmitry Chagin.TP 2
968619d2e3deSDmitry ChaginBeto Appleton, IBM Corp., 1992
968719d2e3deSDmitry ChaginWalking process group fixes,
968819d2e3deSDmitry Chagin.Xr csh 1
968919d2e3deSDmitry Chaginbug fixes,
969019d2e3deSDmitry ChaginPOSIX file tests, POSIX SIGHUP
969119d2e3deSDmitry Chagin.TP 2
969219d2e3deSDmitry ChaginScott Bolte, Cray Computer Corp., 1992
969319d2e3deSDmitry ChaginCSOS port
969419d2e3deSDmitry Chagin.TP 2
969519d2e3deSDmitry ChaginKaveh R. Ghazi, Rutgers University, 1992
969619d2e3deSDmitry ChaginTek, m88k, Titan and Masscomp ports and fixes.
969719d2e3deSDmitry ChaginAdded autoconf support.
969819d2e3deSDmitry Chagin.TP 2
969919d2e3deSDmitry ChaginMark Linderman, Cornell University, 1992
970019d2e3deSDmitry ChaginOS/2 port
970119d2e3deSDmitry Chagin.TP 2
970219d2e3deSDmitry ChaginMika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
970319d2e3deSDmitry ChaginLinux port
970419d2e3deSDmitry Chagin.TP 2
970519d2e3deSDmitry ChaginTim P. Starrin, NASA Langley Research Center Operations, 1993
970619d2e3deSDmitry ChaginRead-only variables
970719d2e3deSDmitry Chagin.TP 2
970819d2e3deSDmitry ChaginDave Schweisguth, Yale University, 1993-4
970919d2e3deSDmitry ChaginNew man page and tcsh.man2html
971019d2e3deSDmitry Chagin.TP 2
971119d2e3deSDmitry ChaginLarry Schwimmer, Stanford University, 1993
971219d2e3deSDmitry ChaginAFS and HESIOD patches
971319d2e3deSDmitry Chagin.TP 2
971419d2e3deSDmitry ChaginLuke Mewburn, RMIT University, 1994-6
971519d2e3deSDmitry ChaginEnhanced directory printing in prompt,
971619d2e3deSDmitry Chaginadded
971719d2e3deSDmitry Chagin.Va ellipsis
971819d2e3deSDmitry Chaginand
971919d2e3deSDmitry Chagin.Va rprompt
972019d2e3deSDmitry Chagin.TP 2
972119d2e3deSDmitry ChaginEdward Hutchins, Silicon Graphics Inc., 1996
972219d2e3deSDmitry ChaginAdded implicit cd.
972319d2e3deSDmitry Chagin.TP 2
972419d2e3deSDmitry ChaginMartin Kraemer, 1997
972519d2e3deSDmitry ChaginPorted to Siemens Nixdorf EBCDIC machine
972619d2e3deSDmitry Chagin.TP 2
972719d2e3deSDmitry ChaginAmol Deshpande, Microsoft, 1997
972819d2e3deSDmitry ChaginPorted to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
972919d2e3deSDmitry Chaginand message catalog code to interface to Windows.
973019d2e3deSDmitry Chagin.TP 2
973119d2e3deSDmitry ChaginTaga Nayuta, 1998
973219d2e3deSDmitry ChaginColor ls additions.
973319d2e3deSDmitry Chagin.PD
973419d2e3deSDmitry Chagin.Pp
973519d2e3deSDmitry Chagin.Sh "THANKS TO"
973619d2e3deSDmitry ChaginBryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
973719d2e3deSDmitry ChaginDiana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
973819d2e3deSDmitry Chaginthe other people at Ohio State for suggestions and encouragement
973919d2e3deSDmitry Chagin.Pp
974019d2e3deSDmitry ChaginAll the people on the net, for putting up with,
974119d2e3deSDmitry Chaginreporting bugs in, and suggesting new additions to each and every version
974219d2e3deSDmitry Chagin.Pp
974319d2e3deSDmitry ChaginRichard M. Alderson III, for writing the
974419d2e3deSDmitry Chagin.Sq T in tcsh
974519d2e3deSDmitry Chaginsection
9746