0
|
1 |
'\" t
|
|
2 |
.\" Copyright (c) 1980, 1990, 1993
|
|
3 |
.\" The Regents of the University of California. All rights reserved.
|
|
4 |
.\"
|
|
5 |
.\" Redistribution and use in source and binary forms, with or without
|
|
6 |
.\" modification, are permitted provided that the following conditions
|
|
7 |
.\" are met:
|
|
8 |
.\" 1. Redistributions of source code must retain the above copyright
|
|
9 |
.\" notice, this list of conditions and the following disclaimer.
|
|
10 |
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
11 |
.\" notice, this list of conditions and the following disclaimer in the
|
|
12 |
.\" documentation and/or other materials provided with the distribution.
|
|
13 |
.\" 3. Neither the name of the University nor the names of its contributors
|
|
14 |
.\" may be used to endorse or promote products derived from this software
|
|
15 |
.\" without specific prior written permission.
|
|
16 |
.\"
|
|
17 |
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
18 |
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
20 |
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
21 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
23 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
24 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
25 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
26 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
27 |
.\" SUCH DAMAGE.
|
|
28 |
.\"
|
|
29 |
.\" Style notes for the tcsh man page:
|
|
30 |
.\"
|
|
31 |
.\" - Tags in lists are bold, except in the FILES section where they are
|
|
32 |
.\" italic.
|
|
33 |
.\"
|
|
34 |
.\" - References are bold for section headings and environment and shell
|
|
35 |
.\" variables and italic for commands (externals, builtins, aliases, and
|
|
36 |
.\" editor commands) and arguments to commands.
|
|
37 |
.\"
|
|
38 |
.\" - Be careful with the .B and .I macros: they handle only a limited number
|
|
39 |
.\" of words. Work around this with \fB and \fI, but only if absolutely
|
|
40 |
.\" necessary, because tcsh.man2html uses .B/.I to find name anchors.
|
|
41 |
.\"
|
|
42 |
.\" - Indent in multiples of 4, usually 8.
|
|
43 |
.\"
|
|
44 |
.\" - Use `', not '' or "", except of course in shell syntax examples.
|
|
45 |
.\" '' at the beginning of a line will vanish!
|
|
46 |
.\"
|
|
47 |
.\" - Use \-, not -.
|
|
48 |
.\"
|
|
49 |
.\" - Include the tilde when naming dot files. `~/.login', not `.login'.
|
|
50 |
.\"
|
|
51 |
.\" - Refer to external commands in man page format, e.g., `csh(1)'. However,
|
|
52 |
.\" tcsh is `tcsh', not `tcsh(1)', because this is the tcsh man page (and
|
|
53 |
.\" see the next note anyway).
|
|
54 |
.\"
|
|
55 |
.\" - Say `the shell', not `tcsh', unless distinguishing between tcsh and csh.
|
|
56 |
.\"
|
|
57 |
.\" - Say `shell variable'/`environment variable' instead of `variable'
|
|
58 |
.\" and `builtin command'/`editor command' instead of `builtin' or `command'
|
|
59 |
.\" unless the distinction is absolutely clear from context.
|
|
60 |
.\"
|
|
61 |
.\" - Use the simple present tense. `The shell uses', not `The shell will use'.
|
|
62 |
.\"
|
|
63 |
.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
|
|
64 |
.\" etc. in the reference section should be mentioned in the appropriate
|
|
65 |
.\" descriptive section, or at least in the reference-section description
|
|
66 |
.\" of another command (or whatever) which is mentioned in a description
|
|
67 |
.\" section. Remember to note OS-specific things in "OS variant support",
|
|
68 |
.\" new features in NEW FEATURES and referenced external commands in SEE
|
|
69 |
.\" ALSO.
|
|
70 |
.\"
|
|
71 |
.\" - tcsh.man2html depends heavily on the specific nroff commands used in the
|
|
72 |
.\" man page when the script was written. Please stick closely to the style
|
|
73 |
.\" used here if you can. In particular, please don't use nroff commands
|
|
74 |
.\" which aren't already used herein.
|
|
75 |
.\"
|
|
76 |
.\" modified to reference existing Solaris man pages, to add the Solaris
|
|
77 |
.\" stability classification, and to add a note about source availability.
|
|
78 |
.\"
|
|
79 |
.TH TCSH 1 "10 July 2009" "Astron 6.17.00"
|
|
80 |
.SH NAME
|
|
81 |
tcsh \- C shell with file name completion and command line editing
|
|
82 |
.SH SYNOPSIS
|
|
83 |
.B tcsh \fR[\fB\-bcdefFimnqstvVxX\fR] [\fB\-Dname\fR[\fB=value\fR]] [arg ...]
|
|
84 |
.br
|
|
85 |
.B tcsh \-l
|
|
86 |
.SH DESCRIPTION
|
|
87 |
\fItcsh\fR is an enhanced but completely compatible version of the Berkeley
|
|
88 |
UNIX C shell, \fIcsh\fR(1).
|
|
89 |
It is a command language interpreter usable both as an interactive login
|
|
90 |
shell and a shell script command processor.
|
|
91 |
It includes a command-line editor (see \fBThe command-line editor\fR),
|
|
92 |
programmable word completion (see \fBCompletion and listing\fR),
|
|
93 |
spelling correction (see \fBSpelling correction\fR),
|
|
94 |
a history mechanism (see \fBHistory substitution\fR),
|
|
95 |
job control (see \fBJobs\fR)
|
|
96 |
and a C-like syntax.
|
|
97 |
The \fBNEW FEATURES\fR section describes major enhancements of \fItcsh\fR
|
|
98 |
over \fIcsh\fR(1).
|
|
99 |
Throughout this manual, features of
|
|
100 |
\fItcsh\fR not found in most \fIcsh\fR(1) implementations
|
|
101 |
(specifically, the 4.4BSD \fIcsh\fR)
|
|
102 |
are labeled with `(+)', and features which are present in \fIcsh\fR(1)
|
|
103 |
but not usually documented are labeled with `(u)'.
|
|
104 |
.SS "Argument list processing"
|
|
105 |
If the first argument (argument 0) to the shell is `\-' then it is a
|
|
106 |
login shell. A login shell can be also specified by invoking the shell with
|
|
107 |
the \fB\-l\fR flag as the only argument.
|
|
108 |
.PP
|
|
109 |
The rest of the flag arguments are interpreted as follows:
|
|
110 |
.TP 4
|
|
111 |
.B \-b
|
|
112 |
Forces a ``break'' from option processing, causing any
|
|
113 |
further shell arguments to be treated as non-option arguments. The remaining
|
|
114 |
arguments will not be interpreted as shell options. This may be used to pass
|
|
115 |
options to a shell script without confusion or possible subterfuge. The shell
|
|
116 |
will not run a set-user ID script without this option.
|
|
117 |
.TP 4
|
|
118 |
.B \-c
|
|
119 |
Commands are read from the following argument (which must be present, and
|
|
120 |
must be a single argument),
|
|
121 |
stored in the \fBcommand\fR shell variable for reference, and executed.
|
|
122 |
Any remaining arguments are placed in the \fBargv\fR shell variable.
|
|
123 |
.TP 4
|
|
124 |
.B \-d
|
|
125 |
The shell loads the directory stack from \fI~/.cshdirs\fR as described under
|
|
126 |
\fBStartup and shutdown\fR, whether or not it is a login shell. (+)
|
|
127 |
.TP 4
|
|
128 |
.B \-D\fIname\fR[=\fIvalue\fR]
|
|
129 |
Sets the environment variable \fIname\fR to \fIvalue\fR. (Domain/OS only) (+)
|
|
130 |
.TP 4
|
|
131 |
.B \-e
|
|
132 |
The shell exits if any invoked command terminates abnormally or
|
|
133 |
yields a non-zero exit status.
|
|
134 |
.TP 4
|
|
135 |
.B \-f
|
|
136 |
The shell does not load any resource or startup files, or perform any
|
|
137 |
command hashing, and thus starts faster.
|
|
138 |
.TP 4
|
|
139 |
.B \-F
|
|
140 |
The shell uses \fIfork\fR(2) instead of \fIvfork\fR(2) to spawn processes. (+)
|
|
141 |
.TP 4
|
|
142 |
.B \-i
|
|
143 |
The shell is interactive and prompts for its top-level input, even if
|
|
144 |
it appears to not be a terminal. Shells are interactive without this option if
|
|
145 |
their inputs and outputs are terminals.
|
|
146 |
.TP 4
|
|
147 |
.B \-l
|
|
148 |
The shell is a login shell. Applicable only if \fB\-l\fR is the only
|
|
149 |
flag specified.
|
|
150 |
.TP 4
|
|
151 |
.B \-m
|
|
152 |
The shell loads \fI~/.tcshrc\fR even if it does not belong to the effective
|
|
153 |
user. Newer versions of \fIsu\fR(1M) can pass \fB\-m\fR to the shell. (+)
|
|
154 |
.TP 4
|
|
155 |
.B \-n
|
|
156 |
The shell parses commands but does not execute them.
|
|
157 |
This aids in debugging shell scripts.
|
|
158 |
.TP 4
|
|
159 |
.B \-q
|
|
160 |
The shell accepts SIGQUIT (see \fBSignal handling\fR) and behaves when
|
|
161 |
it is used under a debugger. Job control is disabled. (u)
|
|
162 |
.TP 4
|
|
163 |
.B \-s
|
|
164 |
Command input is taken from the standard input.
|
|
165 |
.TP 4
|
|
166 |
.B \-t
|
|
167 |
The shell reads and executes a single line of input. A `\\' may be used to
|
|
168 |
escape the newline at the end of this line and continue onto another line.
|
|
169 |
.TP 4
|
|
170 |
.B \-v
|
|
171 |
Sets the \fBverbose\fR shell variable, so that
|
|
172 |
command input is echoed after history substitution.
|
|
173 |
.TP 4
|
|
174 |
.B \-x
|
|
175 |
Sets the \fBecho\fR shell variable, so that commands are echoed
|
|
176 |
immediately before execution.
|
|
177 |
.TP 4
|
|
178 |
.B \-V
|
|
179 |
Sets the \fBverbose\fR shell variable even before executing \fI~/.tcshrc\fR.
|
|
180 |
.TP 4
|
|
181 |
.B \-X
|
|
182 |
Is to \fB\-x\fR as \fB\-V\fR is to \fB\-v\fR.
|
|
183 |
.TP 4
|
|
184 |
.B \-\-help
|
|
185 |
Print a help message on the standard output and exit. (+)
|
|
186 |
.TP 4
|
|
187 |
.B \-\-version
|
|
188 |
Print the version/platform/compilation options on the standard output and exit.
|
|
189 |
This information is also contained in the \fBversion\fR shell variable. (+)
|
|
190 |
.PP
|
|
191 |
After processing of flag arguments, if arguments remain but none of the
|
|
192 |
\fB\-c\fR, \fB\-i\fR, \fB\-s\fR, or \fB\-t\fR options were given, the first
|
|
193 |
argument is taken as the name of a file of commands, or ``script'', to
|
|
194 |
be executed. The shell opens this file and saves its name for possible
|
|
195 |
resubstitution by `$0'. Because many systems use either the standard
|
|
196 |
version 6 or version 7 shells whose shell scripts are not compatible
|
|
197 |
with this shell, the shell uses such a `standard' shell to execute a script
|
|
198 |
whose first character is not a `#', i.e., that does not start with a
|
|
199 |
comment.
|
|
200 |
.PP
|
|
201 |
Remaining arguments are placed in the \fBargv\fR shell variable.
|
|
202 |
.SS "Startup and shutdown"
|
|
203 |
A login shell begins by executing commands from the system files
|
|
204 |
\fI/etc/.cshrc\fR and \fI/etc/.login\fR.
|
|
205 |
It then executes commands from files in the user's \fBhome\fR directory:
|
|
206 |
first \fI~/.tcshrc\fR (+)
|
|
207 |
or, if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR,
|
|
208 |
then \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable),
|
|
209 |
then \fI~/.login\fR,
|
|
210 |
and finally \fI~/.cshdirs\fR (or the value of the \fBdirsfile\fR shell variable) (+).
|
|
211 |
The shell may read \fI/etc/csh.login\fR before instead of after
|
|
212 |
\fI/etc/.cshrc\fR, and \fI~/.login\fR before instead of after
|
|
213 |
\fI~/.tcshrc\fR or \fI~/.cshrc\fR and \fI~/.history\fR, if so compiled;
|
|
214 |
see the \fBversion\fR shell variable. (+)
|
|
215 |
.PP
|
|
216 |
Non-login shells read only \fI/etc/.cshrc\fR and \fI~/.tcshrc\fR
|
|
217 |
or \fI~/.cshrc\fR on startup.
|
|
218 |
.PP
|
|
219 |
For examples of startup files, please consult
|
|
220 |
\fIhttp://tcshrc.sourceforge.net\fR.
|
|
221 |
.PP
|
|
222 |
Commands like \fIstty\fR(1) and \fItset\fR(1B),
|
|
223 |
which need be run only once per login, usually go in one's \fI~/.login\fR file.
|
|
224 |
Users who need to use the same set of files with both \fIcsh\fR(1) and
|
|
225 |
\fItcsh\fR can have only a \fI~/.cshrc\fR which checks for the existence of the
|
|
226 |
\fBtcsh\fR shell variable (q.v.) before using \fItcsh\fR-specific commands,
|
|
227 |
or can have both a \fI~/.cshrc\fR and a \fI~/.tcshrc\fR which \fIsource\fRs
|
|
228 |
(see the builtin command) \fI~/.cshrc\fR.
|
|
229 |
The rest of this manual uses `\fI~/.tcshrc\fR' to mean `\fI~/.tcshrc\fR or,
|
|
230 |
if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR'.
|
|
231 |
.PP
|
|
232 |
In the normal case, the shell begins reading commands from the terminal,
|
|
233 |
prompting with `> '. (Processing of arguments and the use of the shell to
|
|
234 |
process files containing command scripts are described later.)
|
|
235 |
The shell repeatedly reads a line of command input, breaks it into words,
|
|
236 |
places it on the command history list, parses it and executes each command
|
|
237 |
in the line.
|
|
238 |
.PP
|
|
239 |
One can log out by typing `^D' on an empty line, `logout' or `login' or
|
|
240 |
via the shell's autologout mechanism (see the \fBautologout\fR shell variable).
|
|
241 |
When a login shell terminates it sets the \fBlogout\fR shell variable to
|
|
242 |
`normal' or `automatic' as appropriate, then
|
|
243 |
executes commands from the files
|
|
244 |
\fI/etc/csh.logout\fR and \fI~/.logout\fR. The shell may drop DTR on logout
|
|
245 |
if so compiled; see the \fBversion\fR shell variable.
|
|
246 |
.PP
|
|
247 |
The names of the system login and logout files vary from system to system for
|
|
248 |
compatibility with different \fIcsh\fR(1) variants; see \fBFILES\fR.
|
|
249 |
.SS Editing
|
|
250 |
We first describe \fBThe command-line editor\fR.
|
|
251 |
The \fBCompletion and listing\fR and \fBSpelling correction\fR sections
|
|
252 |
describe two sets of functionality that are implemented as editor commands
|
|
253 |
but which deserve their own treatment.
|
|
254 |
Finally, \fBEditor commands\fR lists and describes
|
|
255 |
the editor commands specific to the shell and their default bindings.
|
|
256 |
.SS "The command-line editor (+)"
|
|
257 |
Command-line input can be edited using key sequences much like those used in
|
|
258 |
GNU Emacs or \fIvi\fR(1).
|
|
259 |
The editor is active only when the \fBedit\fR shell variable is set, which
|
|
260 |
it is by default in interactive shells.
|
|
261 |
The \fIbindkey\fR builtin can display and change key bindings.
|
|
262 |
Emacs-style key bindings are used by default
|
|
263 |
(unless the shell was compiled otherwise; see the \fBversion\fR shell variable),
|
|
264 |
but \fIbindkey\fR can change the key bindings to \fIvi\fR-style bindings en masse.
|
|
265 |
.PP
|
|
266 |
The shell always binds the arrow keys (as defined in the \fBTERMCAP\fR
|
|
267 |
environment variable) to
|
|
268 |
.PP
|
|
269 |
.PD 0
|
|
270 |
.RS +4
|
|
271 |
.TP 8
|
|
272 |
down
|
|
273 |
\fIdown-history\fR
|
|
274 |
.TP 8
|
|
275 |
up
|
|
276 |
\fIup-history\fR
|
|
277 |
.TP 8
|
|
278 |
left
|
|
279 |
\fIbackward-char\fR
|
|
280 |
.TP 8
|
|
281 |
right
|
|
282 |
\fIforward-char\fR
|
|
283 |
.PD
|
|
284 |
.RE
|
|
285 |
.PP
|
|
286 |
unless doing so would alter another single-character binding.
|
|
287 |
One can set the arrow key escape sequences to the empty string with \fIsettc\fR
|
|
288 |
to prevent these bindings.
|
|
289 |
The ANSI/VT100 sequences for arrow keys are always bound.
|
|
290 |
.PP
|
|
291 |
Other key bindings are, for the most part, what Emacs and \fIvi\fR(1)
|
|
292 |
users would expect and can easily be displayed by \fIbindkey\fR, so there
|
|
293 |
is no need to list them here. Likewise, \fIbindkey\fR can list the editor
|
|
294 |
commands with a short description of each.
|
|
295 |
.PP
|
|
296 |
Note that editor commands do not have the same notion of a ``word'' as does the
|
|
297 |
shell. The editor delimits words with any non-alphanumeric characters not in
|
|
298 |
the shell variable \fBwordchars\fR, while the shell recognizes only whitespace
|
|
299 |
and some of the characters with special meanings to it, listed under
|
|
300 |
\fBLexical structure\fR.
|
|
301 |
.SS "Completion and listing (+)"
|
|
302 |
The shell is often able to complete words when given a unique abbreviation.
|
|
303 |
Type part of a word (for example `ls /usr/lost') and hit the tab key to
|
|
304 |
run the \fIcomplete-word\fR editor command.
|
|
305 |
The shell completes the filename `/usr/lost' to `/usr/lost+found/',
|
|
306 |
replacing the incomplete word with the complete word in the input buffer.
|
|
307 |
(Note the terminal `/'; completion adds a `/' to the
|
|
308 |
end of completed directories and a space to the end of other completed words,
|
|
309 |
to speed typing and provide a visual indicator of successful completion.
|
|
310 |
The \fBaddsuffix\fR shell variable can be unset to prevent this.)
|
|
311 |
If no match is found (perhaps `/usr/lost+found' doesn't exist),
|
|
312 |
the terminal bell rings.
|
|
313 |
If the word is already complete (perhaps there is a `/usr/lost' on your
|
|
314 |
system, or perhaps you were thinking too far ahead and typed the whole thing)
|
|
315 |
a `/' or space is added to the end if it isn't already there.
|
|
316 |
.PP
|
|
317 |
Completion works anywhere in the line, not at just the end; completed
|
|
318 |
text pushes the rest of the line to the right. Completion in the middle of a word
|
|
319 |
often results in leftover characters to the right of the cursor that need
|
|
320 |
to be deleted.
|
|
321 |
.PP
|
|
322 |
Commands and variables can be completed in much the same way.
|
|
323 |
For example, typing `em[tab]' would complete `em' to
|
|
324 |
`emacs' if \fIemacs\fR were the only command on your system beginning with `em'.
|
|
325 |
Completion can find a command in any directory in \fBpath\fR or if
|
|
326 |
given a full pathname.
|
|
327 |
Typing `echo $ar[tab]' would complete `$ar' to `$argv'
|
|
328 |
if no other variable began with `ar'.
|
|
329 |
.PP
|
|
330 |
The shell parses the input buffer to determine whether the word you want to
|
|
331 |
complete should be completed as a filename, command or variable.
|
|
332 |
The first word in the buffer and the first word following
|
|
333 |
`;', `|', `|&', `&&' or `||' is considered to be a command.
|
|
334 |
A word beginning with `$' is considered to be a variable.
|
|
335 |
Anything else is a filename. An empty line is `completed' as a filename.
|
|
336 |
.PP
|
|
337 |
You can list the possible completions of a word at any time by typing `^D'
|
|
338 |
to run the \fIdelete-char-or-list-or-eof\fR editor command.
|
|
339 |
The shell lists the possible completions using the \fIls\-F\fR builtin (q.v.)
|
|
340 |
and reprints the prompt and unfinished command line, for example:
|
|
341 |
.IP "" 4
|
|
342 |
> ls /usr/l[^D]
|
|
343 |
.br
|
|
344 |
lbin/ lib/ local/ lost+found/
|
|
345 |
.br
|
|
346 |
> ls /usr/l
|
|
347 |
.PP
|
|
348 |
If the \fBautolist\fR shell variable is set, the shell lists the remaining
|
|
349 |
choices (if any) whenever completion fails:
|
|
350 |
.IP "" 4
|
|
351 |
> set autolist
|
|
352 |
.br
|
|
353 |
> nm /usr/lib/libt[tab]
|
|
354 |
.br
|
|
355 |
libtermcap.a@ libtermlib.a@
|
|
356 |
.br
|
|
357 |
> nm /usr/lib/libterm
|
|
358 |
.PP
|
|
359 |
If \fBautolist\fR is set to `ambiguous', choices are listed only when
|
|
360 |
completion fails and adds no new characters to the word being completed.
|
|
361 |
.PP
|
|
362 |
A filename to be completed can contain variables, your own or others' home
|
|
363 |
directories abbreviated with `~' (see \fBFilename substitution\fR) and
|
|
364 |
directory stack entries abbreviated with `='
|
|
365 |
(see \fBDirectory stack substitution\fR). For example,
|
|
366 |
.IP "" 4
|
|
367 |
> ls ~k[^D]
|
|
368 |
.br
|
|
369 |
kahn kas kellogg
|
|
370 |
.br
|
|
371 |
> ls ~ke[tab]
|
|
372 |
.br
|
|
373 |
> ls ~kellogg/
|
|
374 |
.PP
|
|
375 |
or
|
|
376 |
.IP "" 4
|
|
377 |
> set local = /usr/local
|
|
378 |
.br
|
|
379 |
> ls $lo[tab]
|
|
380 |
.br
|
|
381 |
> ls $local/[^D]
|
|
382 |
.br
|
|
383 |
bin/ etc/ lib/ man/ src/
|
|
384 |
.br
|
|
385 |
> ls $local/
|
|
386 |
.PP
|
|
387 |
Note that variables can also be expanded explicitly with the
|
|
388 |
\fIexpand-variables\fR editor command.
|
|
389 |
.PP
|
|
390 |
\fIdelete-char-or-list-or-eof\fR lists at only the end of the line;
|
|
391 |
in the middle of a line it deletes the character under the cursor and
|
|
392 |
on an empty line it logs one out or, if \fBignoreeof\fR is set, does nothing.
|
|
393 |
`M-^D', bound to the editor command \fIlist-choices\fR, lists completion
|
|
394 |
possibilities anywhere on a line, and \fIlist-choices\fR (or any one of the
|
|
395 |
related editor commands that do or don't delete, list and/or log out,
|
|
396 |
listed under \fIdelete-char-or-list-or-eof\fR) can be bound to `^D' with
|
|
397 |
the \fIbindkey\fR builtin command if so desired.
|
|
398 |
.PP
|
|
399 |
The \fIcomplete-word-fwd\fR and \fIcomplete-word-back\fR editor commands
|
|
400 |
(not bound to any keys by default) can be used to cycle up and down through
|
|
401 |
the list of possible completions, replacing the current word with the next or
|
|
402 |
previous word in the list.
|
|
403 |
.PP
|
|
404 |
The shell variable \fBfignore\fR can be set to a list of suffixes to be
|
|
405 |
ignored by completion. Consider the following:
|
|
406 |
.IP "" 4
|
|
407 |
> ls
|
|
408 |
.br
|
|
409 |
Makefile condiments.h~ main.o side.c
|
|
410 |
.br
|
|
411 |
README main.c meal side.o
|
|
412 |
.br
|
|
413 |
condiments.h main.c~
|
|
414 |
.br
|
|
415 |
> set fignore = (.o \\~)
|
|
416 |
.br
|
|
417 |
> emacs ma[^D]
|
|
418 |
.br
|
|
419 |
main.c main.c~ main.o
|
|
420 |
.br
|
|
421 |
> emacs ma[tab]
|
|
422 |
.br
|
|
423 |
> emacs main.c
|
|
424 |
.PP
|
|
425 |
`main.c~' and `main.o' are ignored by completion (but not listing),
|
|
426 |
because they end in suffixes in \fBfignore\fR.
|
|
427 |
Note that a `\\' was needed in front of `~' to prevent it from being
|
|
428 |
expanded to \fBhome\fR as described under \fBFilename substitution\fR.
|
|
429 |
\fBfignore\fR is ignored if only one completion is possible.
|
|
430 |
.PP
|
|
431 |
If the \fBcomplete\fR shell variable is set to `enhance', completion
|
|
432 |
1) ignores case and 2) considers periods, hyphens and underscores
|
|
433 |
(`.', `\-' and `_') to be word separators and hyphens and underscores to
|
|
434 |
be equivalent. If you had the following files
|
|
435 |
.IP "" 4
|
|
436 |
comp.lang.c comp.lang.perl comp.std.c++
|
|
437 |
.br
|
|
438 |
comp.lang.c++ comp.std.c
|
|
439 |
.PP
|
|
440 |
and typed `mail \-f c.l.c[tab]', it would be completed to
|
|
441 |
`mail \-f comp.lang.c', and ^D would list `comp.lang.c' and `comp.lang.c++'.
|
|
442 |
`mail \-f c..c++[^D]' would list `comp.lang.c++' and `comp.std.c++'. Typing
|
|
443 |
`rm a\-\-file[^D]' in the following directory
|
|
444 |
.IP "" 4
|
|
445 |
A_silly_file a-hyphenated-file another_silly_file
|
|
446 |
.PP
|
|
447 |
would list all three files, because case is ignored and hyphens and
|
|
448 |
underscores are equivalent. Periods, however, are not equivalent to
|
|
449 |
hyphens or underscores.
|
|
450 |
.PP
|
|
451 |
Completion and listing are affected by several other shell variables:
|
|
452 |
\fBrecexact\fR can be set to complete on the shortest possible unique
|
|
453 |
match, even if more typing might result in a longer match:
|
|
454 |
.IP "" 4
|
|
455 |
> ls
|
|
456 |
.br
|
|
457 |
fodder foo food foonly
|
|
458 |
.br
|
|
459 |
> set recexact
|
|
460 |
.br
|
|
461 |
> rm fo[tab]
|
|
462 |
.PP
|
|
463 |
just beeps, because `fo' could expand to `fod' or `foo', but if we type
|
|
464 |
another `o',
|
|
465 |
.IP "" 4
|
|
466 |
> rm foo[tab]
|
|
467 |
.br
|
|
468 |
> rm foo
|
|
469 |
.PP
|
|
470 |
the completion completes on `foo', even though `food' and `foonly'
|
|
471 |
also match.
|
|
472 |
\fBautoexpand\fR can be set to run the \fIexpand-history\fR editor command
|
|
473 |
before each completion attempt, \fBautocorrect\fR can be set to
|
|
474 |
spelling-correct the word to be completed (see \fBSpelling correction\fR)
|
|
475 |
before each completion attempt and \fBcorrect\fR can be set to complete
|
|
476 |
commands automatically after one hits `return'.
|
|
477 |
\fBmatchbeep\fR can be set to make completion beep or not beep in a variety
|
|
478 |
of situations, and \fBnobeep\fR can be set to never beep at all.
|
|
479 |
\fBnostat\fR can be set to a list of directories and/or patterns that
|
|
480 |
match directories to prevent the completion mechanism from \fIstat\fR(2)ing
|
|
481 |
those directories.
|
|
482 |
\fBlistmax\fR and \fBlistmaxrows\fR can be set to limit the number of items
|
|
483 |
and rows (respectively) that are listed without asking first.
|
|
484 |
\fBrecognize_only_executables\fR can be set to make the shell list only
|
|
485 |
executables when listing commands, but it is quite slow.
|
|
486 |
.PP
|
|
487 |
Finally, the \fIcomplete\fR builtin command can be used to tell the shell how
|
|
488 |
to complete words other than filenames, commands and variables.
|
|
489 |
Completion and listing do not work on glob-patterns (see \fBFilename substitution\fR),
|
|
490 |
but the \fIlist-glob\fR and \fIexpand-glob\fR editor commands perform
|
|
491 |
equivalent functions for glob-patterns.
|
|
492 |
.SS "Spelling correction (+)"
|
|
493 |
The shell can sometimes correct the spelling of filenames, commands and variable names
|
|
494 |
as well as completing and listing them.
|
|
495 |
.PP
|
|
496 |
Individual words can be spelling-corrected with the \fIspell-word\fR
|
|
497 |
editor command (usually bound to M-s and M-S)
|
|
498 |
and the entire input buffer with \fIspell-line\fR (usually bound to M-$).
|
|
499 |
The \fBcorrect\fR shell variable can be set to `cmd' to correct the
|
|
500 |
command name or `all' to correct the entire line each time return is typed,
|
|
501 |
and \fBautocorrect\fR can be set to correct the word to be completed
|
|
502 |
before each completion attempt.
|
|
503 |
.PP
|
|
504 |
When spelling correction is invoked in any of these ways and
|
|
505 |
the shell thinks that any part of the command line is misspelled,
|
|
506 |
it prompts with the corrected line:
|
|
507 |
.IP "" 4
|
|
508 |
> set correct = cmd
|
|
509 |
.br
|
|
510 |
> lz /usr/bin
|
|
511 |
.br
|
|
512 |
CORRECT>ls /usr/bin (y|n|e|a)?
|
|
513 |
.PP
|
|
514 |
One can answer `y' or space to execute the corrected line,
|
|
515 |
`e' to leave the uncorrected command in the input buffer,
|
|
516 |
`a' to abort the command as if `^C' had been hit, and
|
|
517 |
anything else to execute the original line unchanged.
|
|
518 |
.PP
|
|
519 |
Spelling correction recognizes user-defined completions (see the
|
|
520 |
\fIcomplete\fR builtin command). If an input word in a position for
|
|
521 |
which a completion is defined resembles a word in the completion list,
|
|
522 |
spelling correction registers a misspelling and suggests the latter
|
|
523 |
word as a correction. However, if the input word does not match any of
|
|
524 |
the possible completions for that position, spelling correction does
|
|
525 |
not register a misspelling.
|
|
526 |
.PP
|
|
527 |
Like completion, spelling correction works anywhere in the line,
|
|
528 |
pushing the rest of the line to the right and possibly leaving
|
|
529 |
extra characters to the right of the cursor.
|
|
530 |
.PP
|
|
531 |
Beware: spelling correction is not guaranteed to work the way one intends,
|
|
532 |
and is provided mostly as an experimental feature.
|
|
533 |
Suggestions and improvements are welcome.
|
|
534 |
.SS "Editor commands (+)"
|
|
535 |
`bindkey' lists key bindings and `bindkey \-l' lists and briefly describes
|
|
536 |
editor commands.
|
|
537 |
Only new or especially interesting editor commands are described here.
|
|
538 |
See \fIemacs\fR(1) and \fIvi\fR(1) for descriptions of each editor's
|
|
539 |
key bindings.
|
|
540 |
.PP
|
|
541 |
The character or characters to which each command is bound by default is
|
|
542 |
given in parentheses. `^\fIcharacter\fR' means a control character and
|
|
543 |
`M-\fIcharacter\fR' a meta character, typed as escape-\fIcharacter\fR
|
|
544 |
on terminals without a meta key. Case counts, but commands that are bound
|
|
545 |
to letters by default are bound to both lower- and uppercase letters for
|
|
546 |
convenience.
|
|
547 |
.TP 8
|
|
548 |
.B complete-word \fR(tab)
|
|
549 |
Completes a word as described under \fBCompletion and listing\fR.
|
|
550 |
.TP 8
|
|
551 |
.B complete-word-back \fR(not bound)
|
|
552 |
Like \fIcomplete-word-fwd\fR, but steps up from the end of the list.
|
|
553 |
.TP 8
|
|
554 |
.B complete-word-fwd \fR(not bound)
|
|
555 |
Replaces the current word with the first word in the list of possible
|
|
556 |
completions. May be repeated to step down through the list.
|
|
557 |
At the end of the list, beeps and reverts to the incomplete word.
|
|
558 |
.TP 8
|
|
559 |
.B complete-word-raw \fR(^X-tab)
|
|
560 |
Like \fIcomplete-word\fR, but ignores user-defined completions.
|
|
561 |
.TP 8
|
|
562 |
.B copy-prev-word \fR(M-^_)
|
|
563 |
Copies the previous word in the current line into the input buffer.
|
|
564 |
See also \fIinsert-last-word\fR.
|
|
565 |
.TP 8
|
|
566 |
.B dabbrev-expand \fR(M-/)
|
|
567 |
Expands the current word to the most recent preceding one for which
|
|
568 |
the current is a leading substring, wrapping around the history list
|
|
569 |
(once) if necessary.
|
|
570 |
Repeating \fIdabbrev-expand\fR without any intervening typing
|
|
571 |
changes to the next previous word etc., skipping identical matches
|
|
572 |
much like \fIhistory-search-backward\fR does.
|
|
573 |
.TP 8
|
|
574 |
.B delete-char \fR(not bound)
|
|
575 |
Deletes the character under the cursor.
|
|
576 |
See also \fIdelete-char-or-list-or-eof\fR.
|
|
577 |
.TP 8
|
|
578 |
.B delete-char-or-eof \fR(not bound)
|
|
579 |
Does \fIdelete-char\fR if there is a character under the cursor
|
|
580 |
or \fIend-of-file\fR on an empty line.
|
|
581 |
See also \fIdelete-char-or-list-or-eof\fR.
|
|
582 |
.TP 8
|
|
583 |
.B delete-char-or-list \fR(not bound)
|
|
584 |
Does \fIdelete-char\fR if there is a character under the cursor
|
|
585 |
or \fIlist-choices\fR at the end of the line.
|
|
586 |
See also \fIdelete-char-or-list-or-eof\fR.
|
|
587 |
.TP 8
|
|
588 |
.B delete-char-or-list-or-eof \fR(^D)
|
|
589 |
Does \fIdelete-char\fR if there is a character under the cursor,
|
|
590 |
\fIlist-choices\fR at the end of the line
|
|
591 |
or \fIend-of-file\fR on an empty line.
|
|
592 |
See also those three commands, each of which does only a single action, and
|
|
593 |
\fIdelete-char-or-eof\fR, \fIdelete-char-or-list\fR and \fIlist-or-eof\fR,
|
|
594 |
each of which does a different two out of the three.
|
|
595 |
.TP 8
|
|
596 |
.B down-history \fR(down-arrow, ^N)
|
|
597 |
Like \fIup-history\fR, but steps down, stopping at the original input line.
|
|
598 |
.TP 8
|
|
599 |
.B end-of-file \fR(not bound)
|
|
600 |
Signals an end of file, causing the shell to exit unless the \fBignoreeof\fR
|
|
601 |
shell variable (q.v.) is set to prevent this.
|
|
602 |
See also \fIdelete-char-or-list-or-eof\fR.
|
|
603 |
.TP 8
|
|
604 |
.B expand-history \fR(M-space)
|
|
605 |
Expands history substitutions in the current word.
|
|
606 |
See \fBHistory substitution\fR.
|
|
607 |
See also \fImagic-space\fR, \fItoggle-literal-history\fR and
|
|
608 |
the \fBautoexpand\fR shell variable.
|
|
609 |
.TP 8
|
|
610 |
.B expand-glob \fR(^X-*)
|
|
611 |
Expands the glob-pattern to the left of the cursor.
|
|
612 |
See \fBFilename substitution\fR.
|
|
613 |
.TP 8
|
|
614 |
.B expand-line \fR(not bound)
|
|
615 |
Like \fIexpand-history\fR, but
|
|
616 |
expands history substitutions in each word in the input buffer,
|
|
617 |
.TP 8
|
|
618 |
.B expand-variables \fR(^X-$)
|
|
619 |
Expands the variable to the left of the cursor.
|
|
620 |
See \fBVariable substitution\fR.
|
|
621 |
.TP 8
|
|
622 |
.B history-search-backward \fR(M-p, M-P)
|
|
623 |
Searches backwards through the history list for a command beginning with
|
|
624 |
the current contents of the input buffer up to the cursor and copies it
|
|
625 |
into the input buffer.
|
|
626 |
The search string may be a glob-pattern (see \fBFilename substitution\fR)
|
|
627 |
containing `*', `?', `[]' or `{}'.
|
|
628 |
\fIup-history\fR and \fIdown-history\fR will proceed from the
|
|
629 |
appropriate point in the history list.
|
|
630 |
Emacs mode only.
|
|
631 |
See also \fIhistory-search-forward\fR and \fIi-search-back\fR.
|
|
632 |
.TP 8
|
|
633 |
.B history-search-forward \fR(M-n, M-N)
|
|
634 |
Like \fIhistory-search-backward\fR, but searches forward.
|
|
635 |
.TP 8
|
|
636 |
.B i-search-back \fR(not bound)
|
|
637 |
Searches backward like \fIhistory-search-backward\fR, copies the first match
|
|
638 |
into the input buffer with the cursor positioned at the end of the pattern,
|
|
639 |
and prompts with `bck: ' and the first match. Additional characters may be
|
|
640 |
typed to extend the search, \fIi-search-back\fR may be typed to continue
|
|
641 |
searching with the same pattern, wrapping around the history list if
|
|
642 |
necessary, (\fIi-search-back\fR must be bound to a
|
|
643 |
single character for this to work) or one of the following special characters
|
|
644 |
may be typed:
|
|
645 |
.PP
|
|
646 |
.RS +8
|
|
647 |
.RS +4
|
|
648 |
.PD 0
|
|
649 |
.TP 8
|
|
650 |
^W
|
|
651 |
Appends the rest of the word under the cursor to the search pattern.
|
|
652 |
.TP 8
|
|
653 |
delete (or any character bound to \fIbackward-delete-char\fR)
|
|
654 |
Undoes the effect of the last character typed and deletes a character
|
|
655 |
from the search pattern if appropriate.
|
|
656 |
.TP 8
|
|
657 |
^G
|
|
658 |
If the previous search was successful, aborts the entire search.
|
|
659 |
If not, goes back to the last successful search.
|
|
660 |
.TP 8
|
|
661 |
escape
|
|
662 |
Ends the search, leaving the current line in the input buffer.
|
|
663 |
.RE
|
|
664 |
.PD
|
|
665 |
.PP
|
|
666 |
Any other character not bound to \fIself-insert-command\fR terminates the
|
|
667 |
search, leaving the current line in the input buffer, and
|
|
668 |
is then interpreted as normal input. In particular, a carriage return
|
|
669 |
causes the current line to be executed.
|
|
670 |
Emacs mode only.
|
|
671 |
See also \fIi-search-fwd\fR and \fIhistory-search-backward\fR.
|
|
672 |
.RE
|
|
673 |
.TP 8
|
|
674 |
.B i-search-fwd \fR(not bound)
|
|
675 |
Like \fIi-search-back\fR, but searches forward.
|
|
676 |
.TP 8
|
|
677 |
.B insert-last-word \fR(M-_)
|
|
678 |
Inserts the last word of the previous input line (`!$') into the input buffer.
|
|
679 |
See also \fIcopy-prev-word\fR.
|
|
680 |
.TP 8
|
|
681 |
.B list-choices \fR(M-^D)
|
|
682 |
Lists completion possibilities as described under \fBCompletion and listing\fR.
|
|
683 |
See also \fIdelete-char-or-list-or-eof\fR and \fIlist-choices-raw\fR.
|
|
684 |
.TP 8
|
|
685 |
.B list-choices-raw \fR(^X-^D)
|
|
686 |
Like \fIlist-choices\fR, but ignores user-defined completions.
|
|
687 |
.TP 8
|
|
688 |
.B list-glob \fR(^X-g, ^X-G)
|
|
689 |
Lists (via the \fIls\-F\fR builtin) matches to the glob-pattern
|
|
690 |
(see \fBFilename substitution\fR) to the left of the cursor.
|
|
691 |
.TP 8
|
|
692 |
.B list-or-eof \fR(not bound)
|
|
693 |
Does \fIlist-choices\fR
|
|
694 |
or \fIend-of-file\fR on an empty line.
|
|
695 |
See also \fIdelete-char-or-list-or-eof\fR.
|
|
696 |
.TP 8
|
|
697 |
.B magic-space \fR(not bound)
|
|
698 |
Expands history substitutions in the current line,
|
|
699 |
like \fIexpand-history\fR, and inserts a space.
|
|
700 |
\fImagic-space\fR is designed to be bound to the space bar,
|
|
701 |
but is not bound by default.
|
|
702 |
.TP 8
|
|
703 |
.B normalize-command \fR(^X-?)
|
|
704 |
Searches for the current word in PATH and, if it is found, replaces it with
|
|
705 |
the full path to the executable. Special characters are quoted. Aliases are
|
|
706 |
expanded and quoted but commands within aliases are not. This command is
|
|
707 |
useful with commands that take commands as arguments, e.g., `dbx' and `sh \-x'.
|
|
708 |
.TP 8
|
|
709 |
.B normalize-path \fR(^X-n, ^X-N)
|
|
710 |
Expands the current word as described under the `expand' setting
|
|
711 |
of the \fBsymlinks\fR shell variable.
|
|
712 |
.TP 8
|
|
713 |
.B overwrite-mode \fR(unbound)
|
|
714 |
Toggles between input and overwrite modes.
|
|
715 |
.TP 8
|
|
716 |
.B run-fg-editor \fR(M-^Z)
|
|
717 |
Saves the current input line and
|
|
718 |
looks for a stopped job with a name equal to the last component of the
|
|
719 |
file name part of the \fBEDITOR\fR or \fBVISUAL\fR environment variables,
|
|
720 |
or, if neither is set, `ed' or `vi'.
|
|
721 |
If such a job is found, it is restarted as if `fg %\fIjob\fR' had been
|
|
722 |
typed. This is used to toggle back and forth between an editor and
|
|
723 |
the shell easily. Some people bind this command to `^Z' so they
|
|
724 |
can do this even more easily.
|
|
725 |
.TP
|
|
726 |
.B run-help \fR(M-h, M-H)
|
|
727 |
Searches for documentation on the current command, using the same notion of
|
|
728 |
`current command' as the completion routines, and prints it. There is no way
|
|
729 |
to use a pager; \fIrun-help\fR is designed for short help files.
|
|
730 |
If the special alias \fBhelpcommand\fR is defined, it is run with the
|
|
731 |
command name as a sole argument. Else,
|
|
732 |
documentation should be in a file named \fIcommand\fR.help, \fIcommand\fR.1,
|
|
733 |
\fIcommand\fR.6, \fIcommand\fR.8 or \fIcommand\fR, which should be in one
|
|
734 |
of the directories listed in the \fBHPATH\fR environment variable.
|
|
735 |
If there is more than one help file only the first is printed.
|
|
736 |
.TP 8
|
|
737 |
.B self-insert-command \fR(text characters)
|
|
738 |
In insert mode (the default), inserts the typed character into the input line after the character under the cursor.
|
|
739 |
In overwrite mode, replaces the character under the cursor with the typed character.
|
|
740 |
The input mode is normally preserved between lines, but the
|
|
741 |
\fBinputmode\fR shell variable can be set to `insert' or `overwrite' to put the
|
|
742 |
editor in that mode at the beginning of each line.
|
|
743 |
See also \fIoverwrite-mode\fR.
|
|
744 |
.TP 8
|
|
745 |
.B sequence-lead-in \fR(arrow prefix, meta prefix, ^X)
|
|
746 |
Indicates that the following characters are part of a
|
|
747 |
multi-key sequence. Binding a command to a multi-key sequence really creates
|
|
748 |
two bindings: the first character to \fIsequence-lead-in\fR and the
|
|
749 |
whole sequence to the command. All sequences beginning with a character
|
|
750 |
bound to \fIsequence-lead-in\fR are effectively bound to \fIundefined-key\fR
|
|
751 |
unless bound to another command.
|
|
752 |
.TP 8
|
|
753 |
.B spell-line \fR(M-$)
|
|
754 |
Attempts to correct the spelling of each word in the input buffer, like
|
|
755 |
\fIspell-word\fR, but ignores words whose first character is one of
|
|
756 |
`\-', `!', `^' or `%', or which contain `\\', `*' or `?', to avoid problems
|
|
757 |
with switches, substitutions and the like.
|
|
758 |
See \fBSpelling correction\fR.
|
|
759 |
.TP 8
|
|
760 |
.B spell-word \fR(M-s, M-S)
|
|
761 |
Attempts to correct the spelling of the current word as described
|
|
762 |
under \fBSpelling correction\fR.
|
|
763 |
Checks each component of a word which appears to be a pathname.
|
|
764 |
.TP 8
|
|
765 |
.B toggle-literal-history \fR(M-r, M-R)
|
|
766 |
Expands or `unexpands' history substitutions in the input buffer.
|
|
767 |
See also \fIexpand-history\fR and the \fBautoexpand\fR shell variable.
|
|
768 |
.TP 8
|
|
769 |
.B undefined-key \fR(any unbound key)
|
|
770 |
Beeps.
|
|
771 |
.TP 8
|
|
772 |
.B up-history \fR(up-arrow, ^P)
|
|
773 |
Copies the previous entry in the history list into the input buffer.
|
|
774 |
If \fBhistlit\fR is set, uses the literal form of the entry.
|
|
775 |
May be repeated to step up through the history list, stopping at the top.
|
|
776 |
.TP 8
|
|
777 |
.B vi-search-back \fR(?)
|
|
778 |
Prompts with `?' for a search string (which may be a glob-pattern, as with
|
|
779 |
\fIhistory-search-backward\fR), searches for it and copies it into the
|
|
780 |
input buffer. The bell rings if no match is found.
|
|
781 |
Hitting return ends the search and leaves the last match in the input
|
|
782 |
buffer.
|
|
783 |
Hitting escape ends the search and executes the match.
|
|
784 |
\fIvi\fR mode only.
|
|
785 |
.TP 8
|
|
786 |
.B vi-search-fwd \fR(/)
|
|
787 |
Like \fIvi-search-back\fR, but searches forward.
|
|
788 |
.TP 8
|
|
789 |
.B which-command \fR(M-?)
|
|
790 |
Does a \fIwhich\fR (see the description of the builtin command) on the
|
|
791 |
first word of the input buffer.
|
|
792 |
.TP 8
|
|
793 |
.B yank-pop \fR(M-y)
|
|
794 |
When executed immediately after a \fIyank\fR or another \fIyank-pop\fR,
|
|
795 |
replaces the yanked string with the next previous string from the
|
|
796 |
killring. This also has the effect of rotating the killring, such that
|
|
797 |
this string will be considered the most recently killed by a later
|
|
798 |
\fIyank\fR command. Repeating \fIyank-pop\fR will cycle through the
|
|
799 |
killring any number of times.
|
|
800 |
.SS "Lexical structure"
|
|
801 |
The shell splits input lines into words at blanks and tabs. The special
|
|
802 |
characters `&', `|', `;', `<', `>', `(', and `)' and the doubled characters
|
|
803 |
`&&', `||', `<<' and `>>' are always separate words, whether or not they are
|
|
804 |
surrounded by whitespace.
|
|
805 |
.PP
|
|
806 |
When the shell's input is not a terminal, the character `#' is taken to begin a
|
|
807 |
comment. Each `#' and the rest of the input line on which it appears is
|
|
808 |
discarded before further parsing.
|
|
809 |
.PP
|
|
810 |
A special character (including a blank or tab) may be prevented from having
|
|
811 |
its special meaning, and possibly made part of another word, by preceding it
|
|
812 |
with a backslash (`\\') or enclosing it in single (`''), double (`"') or
|
|
813 |
backward (``') quotes. When not otherwise quoted a newline preceded by a `\\'
|
|
814 |
is equivalent to a blank, but inside quotes this sequence results in a
|
|
815 |
newline.
|
|
816 |
.PP
|
|
817 |
Furthermore, all \fBSubstitutions\fR (see below) except \fBHistory substitution\fR
|
|
818 |
can be prevented by enclosing the strings (or parts of strings)
|
|
819 |
in which they appear with single quotes or by quoting the crucial character(s)
|
|
820 |
(e.g., `$' or ``' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively)
|
|
821 |
with `\\'. (\fBAlias substitution\fR is no exception: quoting in any way any
|
|
822 |
character of a word for which an \fIalias\fR has been defined prevents
|
|
823 |
substitution of the alias. The usual way of quoting an alias is to precede it
|
|
824 |
with a backslash.) \fBHistory substitution\fR is prevented by
|
|
825 |
backslashes but not by single quotes. Strings quoted with double or backward
|
|
826 |
quotes undergo \fBVariable substitution\fR and \fBCommand substitution\fR, but other
|
|
827 |
substitutions are prevented.
|
|
828 |
.PP
|
|
829 |
Text inside single or double quotes becomes a single word (or part of one).
|
|
830 |
Metacharacters in these strings, including blanks and tabs, do not form
|
|
831 |
separate words. Only in one special case (see \fBCommand substitution\fR
|
|
832 |
below) can a double-quoted string yield parts of more than one word;
|
|
833 |
single-quoted strings never do. Backward quotes are special: they signal
|
|
834 |
\fBCommand substitution\fR (q.v.), which may result in more than one word.
|
|
835 |
.PP
|
|
836 |
Quoting complex strings, particularly strings which themselves contain quoting
|
|
837 |
characters, can be confusing. Remember that quotes need not be used as they are
|
|
838 |
in human writing! It may be easier to quote not an entire string, but only
|
|
839 |
those parts of the string which need quoting, using different types of quoting
|
|
840 |
to do so if appropriate.
|
|
841 |
.PP
|
|
842 |
The \fBbackslash_quote\fR shell variable (q.v.) can be set to make backslashes
|
|
843 |
always quote `\\', `'', and `"'. (+) This may make complex quoting tasks
|
|
844 |
easier, but it can cause syntax errors in \fIcsh\fR(1) scripts.
|
|
845 |
.SS Substitutions
|
|
846 |
We now describe the various transformations the shell performs on the input in
|
|
847 |
the order in which they occur. We note in passing the data structures involved
|
|
848 |
and the commands and variables which affect them. Remember that substitutions
|
|
849 |
can be prevented by quoting as described under \fBLexical structure\fR.
|
|
850 |
.SS "History substitution"
|
|
851 |
Each command, or ``event'', input from the terminal is saved in the history
|
|
852 |
list. The previous command is always saved, and the \fBhistory\fR shell
|
|
853 |
variable can be set to a number to save that many commands. The \fBhistdup\fR
|
|
854 |
shell variable can be set to not save duplicate events or consecutive duplicate
|
|
855 |
events.
|
|
856 |
.PP
|
|
857 |
Saved commands are numbered sequentially from 1 and stamped with the time.
|
|
858 |
It is not usually necessary to use event numbers, but the current event number
|
|
859 |
can be made part of the prompt by placing an `!' in the \fBprompt\fR shell variable.
|
|
860 |
.PP
|
|
861 |
The shell actually saves history in expanded and literal (unexpanded) forms.
|
|
862 |
If the \fBhistlit\fR shell variable is set, commands that display and store
|
|
863 |
history use the literal form.
|
|
864 |
.PP
|
|
865 |
The \fIhistory\fR builtin command can print, store in a file, restore
|
|
866 |
and clear the history list at any time,
|
|
867 |
and the \fBsavehist\fR and \fBhistfile\fR shell variables can be can be set to
|
|
868 |
store the history list automatically on logout and restore it on login.
|
|
869 |
.PP
|
|
870 |
History substitutions introduce words from the history list into the input
|
|
871 |
stream, making it easy to repeat commands, repeat arguments of a previous
|
|
872 |
command in the current command, or fix spelling mistakes in the previous
|
|
873 |
command with little typing and a high degree of confidence.
|
|
874 |
.PP
|
|
875 |
History substitutions begin with the character `!'. They may begin anywhere in
|
|
876 |
the input stream, but they do not nest. The `!' may be preceded by a `\\' to
|
|
877 |
prevent its special meaning; for convenience, a `!' is passed unchanged when it
|
|
878 |
is followed by a blank, tab, newline, `=' or `('. History substitutions also
|
|
879 |
occur when an input line begins with `^'. This special abbreviation will be
|
|
880 |
described later. The characters used to signal history substitution (`!' and
|
|
881 |
`^') can be changed by setting the \fBhistchars\fR shell variable. Any input
|
|
882 |
line which contains a history substitution is printed before it is executed.
|
|
883 |
.PP
|
|
884 |
A history substitution may have an ``event specification'', which indicates
|
|
885 |
the event from which words are to be taken, a ``word designator'',
|
|
886 |
which selects particular words from the chosen event, and/or a ``modifier'',
|
|
887 |
which manipulates the selected words.
|
|
888 |
.PP
|
|
889 |
An event specification can be
|
|
890 |
.PP
|
|
891 |
.PD 0
|
|
892 |
.RS +4
|
|
893 |
.TP 8
|
|
894 |
.I n
|
|
895 |
A number, referring to a particular event
|
|
896 |
.TP 8
|
|
897 |
\-\fIn\fR
|
|
898 |
An offset, referring to the event \fIn\fR before the current event
|
|
899 |
.TP 8
|
|
900 |
#
|
|
901 |
The current event.
|
|
902 |
This should be used carefully in \fIcsh\fR(1), where there is no check for
|
|
903 |
recursion. \fItcsh\fR allows 10 levels of recursion. (+)
|
|
904 |
.TP 8
|
|
905 |
!
|
|
906 |
The previous event (equivalent to `\-1')
|
|
907 |
.TP 8
|
|
908 |
.I s
|
|
909 |
The most recent event whose first word begins with the string \fIs\fR
|
|
910 |
.TP 8
|
|
911 |
?\fIs\fR?
|
|
912 |
The most recent event which contains the string \fIs\fR.
|
|
913 |
The second `?' can be omitted if it is immediately followed by a newline.
|
|
914 |
.RE
|
|
915 |
.PD
|
|
916 |
.PP
|
|
917 |
For example, consider this bit of someone's history list:
|
|
918 |
.IP "" 4
|
|
919 |
\ 9 8:30 nroff \-man wumpus.man
|
|
920 |
.br
|
|
921 |
10 8:31 cp wumpus.man wumpus.man.old
|
|
922 |
.br
|
|
923 |
11 8:36 vi wumpus.man
|
|
924 |
.br
|
|
925 |
12 8:37 diff wumpus.man.old wumpus.man
|
|
926 |
.PP
|
|
927 |
The commands are shown with their event numbers and time stamps.
|
|
928 |
The current event, which we haven't typed in yet, is event 13.
|
|
929 |
`!11' and `!\-2' refer to event 11.
|
|
930 |
`!!' refers to the previous event, 12. `!!' can be abbreviated `!' if it is
|
|
931 |
followed by `:' (`:' is described below).
|
|
932 |
`!n' refers to event 9, which begins with `n'.
|
|
933 |
`!?old?' also refers to event 12, which contains `old'.
|
|
934 |
Without word designators or modifiers history references simply expand to the
|
|
935 |
entire event, so we might type `!cp' to redo the copy command or `!!|more'
|
|
936 |
if the `diff' output scrolled off the top of the screen.
|
|
937 |
.PP
|
|
938 |
History references may be insulated from the surrounding text with braces if
|
|
939 |
necessary. For example, `!vdoc' would look for a command beginning with
|
|
940 |
`vdoc', and, in this example, not find one, but `!{v}doc' would expand
|
|
941 |
unambiguously to `vi wumpus.mandoc'.
|
|
942 |
Even in braces, history substitutions do not nest.
|
|
943 |
.PP
|
|
944 |
(+) While \fIcsh\fR(1) expands, for example, `!3d' to event 3 with the
|
|
945 |
letter `d' appended to it, \fItcsh\fR expands it to the last event beginning
|
|
946 |
with `3d'; only completely numeric arguments are treated as event numbers.
|
|
947 |
This makes it possible to recall events beginning with numbers.
|
|
948 |
To expand `!3d' as in \fIcsh\fR(1) say `!{3}d'.
|
|
949 |
.PP
|
|
950 |
To select words from an event we can follow the event specification by a `:'
|
|
951 |
and a designator for the desired words. The words of an input line are
|
|
952 |
numbered from 0, the first (usually command) word being 0, the second word
|
|
953 |
(first argument) being 1, etc. The basic word designators are:
|
|
954 |
.PP
|
|
955 |
.PD 0
|
|
956 |
.RS +4
|
|
957 |
.TP 8
|
|
958 |
0
|
|
959 |
The first (command) word
|
|
960 |
.TP 8
|
|
961 |
.I n
|
|
962 |
The \fIn\fRth argument
|
|
963 |
.TP 8
|
|
964 |
^
|
|
965 |
The first argument, equivalent to `1'
|
|
966 |
.TP 8
|
|
967 |
$
|
|
968 |
The last argument
|
|
969 |
.TP 8
|
|
970 |
%
|
|
971 |
The word matched by an ?\fIs\fR? search
|
|
972 |
.TP 8
|
|
973 |
.I x\-y
|
|
974 |
A range of words
|
|
975 |
.TP 8
|
|
976 |
.I \-y
|
|
977 |
Equivalent to \fI`0\-y'\fR
|
|
978 |
.TP 8
|
|
979 |
*
|
|
980 |
Equivalent to `^\-$', but returns nothing if the event contains only 1 word
|
|
981 |
.TP 8
|
|
982 |
.I x*
|
|
983 |
Equivalent to \fI`x\-$'\fR
|
|
984 |
.TP 8
|
|
985 |
.I x\-
|
|
986 |
Equivalent to \fI`x*'\fR, but omitting the last word (`$')
|
|
987 |
.PD
|
|
988 |
.RE
|
|
989 |
.PP
|
|
990 |
Selected words are inserted into the command line separated by single blanks.
|
|
991 |
For example, the `diff' command in the previous example might have been
|
|
992 |
typed as `diff !!:1.old !!:1' (using `:1' to select the first argument
|
|
993 |
from the previous event) or `diff !\-2:2 !\-2:1' to select and swap the
|
|
994 |
arguments from the `cp' command. If we didn't care about the order of the
|
|
995 |
`diff' we might have said `diff !\-2:1\-2' or simply `diff !\-2:*'.
|
|
996 |
The `cp' command might have been written `cp wumpus.man !#:1.old', using `#'
|
|
997 |
to refer to the current event.
|
|
998 |
`!n:\- hurkle.man' would reuse the first two words from the `nroff' command
|
|
999 |
to say `nroff \-man hurkle.man'.
|
|
1000 |
.PP
|
|
1001 |
The `:' separating the event specification from the word designator can be
|
|
1002 |
omitted if the argument selector begins with a `^', `$', `*', `%' or `\-'.
|
|
1003 |
For example, our `diff' command might have been `diff !!^.old !!^' or,
|
|
1004 |
equivalently, `diff !!$.old !!$'. However, if `!!' is abbreviated `!',
|
|
1005 |
an argument selector beginning with `\-' will be interpreted as an event
|
|
1006 |
specification.
|
|
1007 |
.PP
|
|
1008 |
A history reference may have a word designator but no event specification.
|
|
1009 |
It then references the previous command.
|
|
1010 |
Continuing our `diff' example, we could have said simply `diff
|
|
1011 |
!^.old !^' or, to get the arguments in the opposite order, just `diff !*'.
|
|
1012 |
.PP
|
|
1013 |
The word or words in a history reference can be edited, or ``modified'',
|
|
1014 |
by following it with one or more modifiers, each preceded by a `:':
|
|
1015 |
.PP
|
|
1016 |
.PD 0
|
|
1017 |
.RS +4
|
|
1018 |
.TP 8
|
|
1019 |
h
|
|
1020 |
Remove a trailing pathname component, leaving the head.
|
|
1021 |
.TP 8
|
|
1022 |
t
|
|
1023 |
Remove all leading pathname components, leaving the tail.
|
|
1024 |
.TP 8
|
|
1025 |
r
|
|
1026 |
Remove a filename extension `.xxx', leaving the root name.
|
|
1027 |
.TP 8
|
|
1028 |
e
|
|
1029 |
Remove all but the extension.
|
|
1030 |
.TP 8
|
|
1031 |
u
|
|
1032 |
Uppercase the first lowercase letter.
|
|
1033 |
.TP 8
|
|
1034 |
l
|
|
1035 |
Lowercase the first uppercase letter.
|
|
1036 |
.TP 8
|
|
1037 |
s\fI/l/r/\fR
|
|
1038 |
Substitute \fIl\fR for \fIr\fR.
|
|
1039 |
\fIl\fR is simply a string like \fIr\fR, not a regular expression as in
|
|
1040 |
the eponymous \fIed\fR(1) command.
|
|
1041 |
Any character may be used as the delimiter in place of `/';
|
|
1042 |
a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR.
|
|
1043 |
The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'.
|
|
1044 |
If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the
|
|
1045 |
\fIs\fR from a previous search or event number in event specification is used.
|
|
1046 |
The trailing delimiter may be omitted if it is immediately followed by a newline.
|
|
1047 |
.TP 8
|
|
1048 |
&
|
|
1049 |
Repeat the previous substitution.
|
|
1050 |
.TP 8
|
|
1051 |
g
|
|
1052 |
Apply the following modifier once to each word.
|
|
1053 |
.TP 8
|
|
1054 |
a (+)
|
|
1055 |
Apply the following modifier as many times as possible to a single word.
|
|
1056 |
`a' and `g' can be used together to apply a modifier globally.
|
|
1057 |
With the `s' modifier, only the patterns contained in the original word are
|
|
1058 |
substituted, not patterns that contain any substitution result.
|
|
1059 |
.TP 8
|
|
1060 |
p
|
|
1061 |
Print the new command line but do not execute it.
|
|
1062 |
.TP 8
|
|
1063 |
q
|
|
1064 |
Quote the substituted words, preventing further substitutions.
|
|
1065 |
.TP 8
|
|
1066 |
x
|
|
1067 |
Like q, but break into words at blanks, tabs and newlines.
|
|
1068 |
.PD
|
|
1069 |
.RE
|
|
1070 |
.PP
|
|
1071 |
Modifiers are applied to only the first modifiable word (unless `g' is used).
|
|
1072 |
It is an error for no word to be modifiable.
|
|
1073 |
.PP
|
|
1074 |
For example, the `diff' command might have been written as `diff wumpus.man.old
|
|
1075 |
!#^:r', using `:r' to remove `.old' from the first argument on the same line
|
|
1076 |
(`!#^'). We could say `echo hello out there', then `echo !*:u' to capitalize
|
|
1077 |
`hello', `echo !*:au' to say it out loud, or `echo !*:agu' to really shout.
|
|
1078 |
We might follow `mail \-s "I forgot my password" rot' with `!:s/rot/root' to
|
|
1079 |
correct the spelling of `root' (but see \fBSpelling correction\fR for a
|
|
1080 |
different approach).
|
|
1081 |
.PP
|
|
1082 |
There is a special abbreviation for substitutions.
|
|
1083 |
`^', when it is the first character on an input line, is equivalent to `!:s^'.
|
|
1084 |
Thus we might have said `^rot^root' to make the spelling correction in the
|
|
1085 |
previous example.
|
|
1086 |
This is the only history substitution which does not explicitly begin with `!'.
|
|
1087 |
.PP
|
|
1088 |
(+) In \fIcsh\fR as such, only one modifier may be applied to each history
|
|
1089 |
or variable expansion. In \fItcsh\fR, more than one may be used, for example
|
|
1090 |
.IP "" 4
|
|
1091 |
% mv wumpus.man /usr/man/man1/wumpus.1
|
|
1092 |
.br
|
|
1093 |
% man !$:t:r
|
|
1094 |
.br
|
|
1095 |
man wumpus
|
|
1096 |
.PP
|
|
1097 |
In \fIcsh\fR, the result would be `wumpus.1:r'. A substitution followed by a
|
|
1098 |
colon may need to be insulated from it with braces:
|
|
1099 |
.IP "" 4
|
|
1100 |
> mv a.out /usr/games/wumpus
|
|
1101 |
.br
|
|
1102 |
> setenv PATH !$:h:$PATH
|
|
1103 |
.br
|
|
1104 |
Bad ! modifier: $.
|
|
1105 |
.br
|
|
1106 |
> setenv PATH !{\-2$:h}:$PATH
|
|
1107 |
.br
|
|
1108 |
setenv PATH /usr/games:/bin:/usr/bin:.
|
|
1109 |
.PP
|
|
1110 |
The first attempt would succeed in \fIcsh\fR but fails in \fItcsh\fR,
|
|
1111 |
because \fItcsh\fR expects another modifier after the second colon
|
|
1112 |
rather than `$'.
|
|
1113 |
.PP
|
|
1114 |
Finally, history can be accessed through the editor as well as through
|
|
1115 |
the substitutions just described.
|
|
1116 |
The \fIup-\fR and \fIdown-history\fR, \fIhistory-search-backward\fR and
|
|
1117 |
\fI-forward\fR, \fIi-search-back\fR and \fI-fwd\fR,
|
|
1118 |
\fIvi-search-back\fR and \fI-fwd\fR, \fIcopy-prev-word\fR
|
|
1119 |
and \fIinsert-last-word\fR editor commands search for
|
|
1120 |
events in the history list and copy them into the input buffer.
|
|
1121 |
The \fItoggle-literal-history\fR editor command switches between the
|
|
1122 |
expanded and literal forms of history lines in the input buffer.
|
|
1123 |
\fIexpand-history\fR and \fIexpand-line\fR expand history substitutions
|
|
1124 |
in the current word and in the entire input buffer respectively.
|
|
1125 |
.SS "Alias substitution"
|
|
1126 |
The shell maintains a list of aliases which can be set, unset and printed by
|
|
1127 |
the \fIalias\fR and \fIunalias\fR commands. After a command line is parsed
|
|
1128 |
into simple commands (see \fBCommands\fR) the first word of each command,
|
|
1129 |
left-to-right, is checked to see if it has an alias. If so, the first word is
|
|
1130 |
replaced by the alias. If the alias contains a history reference, it undergoes
|
|
1131 |
\fBHistory substitution\fR (q.v.) as though the original command were the
|
|
1132 |
previous input line. If the alias does not contain a history reference, the
|
|
1133 |
argument list is left untouched.
|
|
1134 |
.PP
|
|
1135 |
Thus if the alias for `ls' were `ls \-l' the command `ls /usr' would become `ls
|
|
1136 |
\-l /usr', the argument list here being undisturbed. If the alias for `lookup'
|
|
1137 |
were `grep !^ /etc/passwd' then `lookup bill' would become `grep bill
|
|
1138 |
/etc/passwd'. Aliases can be used to introduce parser metasyntax. For
|
|
1139 |
example, `alias print 'pr \e!* | lpr'' defines a ``command'' (`print') which
|
|
1140 |
\fIpr\fR(1)s its arguments to the line printer.
|
|
1141 |
.PP
|
|
1142 |
Alias substitution is repeated until the first word of the command has no
|
|
1143 |
alias. If an alias substitution does not change the first word (as in the
|
|
1144 |
previous example) it is flagged to prevent a loop. Other loops are detected and
|
|
1145 |
cause an error.
|
|
1146 |
.PP
|
|
1147 |
Some aliases are referred to by the shell; see \fBSpecial aliases\fR.
|
|
1148 |
.SS "Variable substitution"
|
|
1149 |
The shell maintains a list of variables, each of which has as value a list of
|
|
1150 |
zero or more words.
|
|
1151 |
The values of shell variables can be displayed and changed with the
|
|
1152 |
\fIset\fR and \fIunset\fR commands.
|
|
1153 |
The system maintains its own list of ``environment'' variables.
|
|
1154 |
These can be displayed and changed with \fIprintenv\fR, \fIsetenv\fR and
|
|
1155 |
\fIunsetenv\fR.
|
|
1156 |
.PP
|
|
1157 |
(+) Variables may be made read-only with `set \-r' (q.v.)
|
|
1158 |
Read-only variables may not be modified or unset;
|
|
1159 |
attempting to do so will cause an error.
|
|
1160 |
Once made read-only, a variable cannot be made writable,
|
|
1161 |
so `set \-r' should be used with caution.
|
|
1162 |
Environment variables cannot be made read-only.
|
|
1163 |
.PP
|
|
1164 |
Some variables are set by the shell or referred to by it.
|
|
1165 |
For instance, the \fBargv\fR variable is an image of the shell's argument
|
|
1166 |
list, and words of this variable's value are referred to in special ways.
|
|
1167 |
Some of the variables referred to by the shell are toggles;
|
|
1168 |
the shell does not care what their value is, only whether they are set or not.
|
|
1169 |
For instance, the \fBverbose\fR variable is a toggle which causes command
|
|
1170 |
input to be echoed. The \fB\-v\fR command line option sets this variable.
|
|
1171 |
\fBSpecial shell variables\fR lists all variables which are referred to by the shell.
|
|
1172 |
.PP
|
|
1173 |
Other operations treat variables numerically. The `@' command permits numeric
|
|
1174 |
calculations to be performed and the result assigned to a variable. Variable
|
|
1175 |
values are, however, always represented as (zero or more) strings. For the
|
|
1176 |
purposes of numeric operations, the null string is considered to be zero, and
|
|
1177 |
the second and subsequent words of multi-word values are ignored.
|
|
1178 |
.PP
|
|
1179 |
After the input line is aliased and parsed, and before each command is
|
|
1180 |
executed, variable substitution is performed keyed by `$' characters. This
|
|
1181 |
expansion can be prevented by preceding the `$' with a `\e' except within `"'s
|
|
1182 |
where it \fIalways\fR occurs, and within `''s where it \fInever\fR occurs.
|
|
1183 |
Strings quoted by ``' are interpreted later (see \fBCommand substitution\fR
|
|
1184 |
below) so `$' substitution does not occur there until later,
|
|
1185 |
if at all. A `$' is passed unchanged if followed by a blank, tab, or
|
|
1186 |
end-of-line.
|
|
1187 |
.PP
|
|
1188 |
Input/output redirections are recognized before variable expansion, and are
|
|
1189 |
variable expanded separately. Otherwise, the command name and entire argument
|
|
1190 |
list are expanded together. It is thus possible for the first (command) word
|
|
1191 |
(to this point) to generate more than one word, the first of which becomes the
|
|
1192 |
command name, and the rest of which become arguments.
|
|
1193 |
.PP
|
|
1194 |
Unless enclosed in `"' or given the `:q' modifier the results of variable
|
|
1195 |
substitution may eventually be command and filename substituted. Within `"', a
|
|
1196 |
variable whose value consists of multiple words expands to a (portion of a)
|
|
1197 |
single word, with the words of the variable's value separated by blanks. When
|
|
1198 |
the `:q' modifier is applied to a substitution the variable will expand to
|
|
1199 |
multiple words with each word separated by a blank and quoted to prevent later
|
|
1200 |
command or filename substitution.
|
|
1201 |
.PP
|
|
1202 |
The following metasequences are provided for introducing variable values into
|
|
1203 |
the shell input. Except as noted, it is an error to reference a variable which
|
|
1204 |
is not set.
|
|
1205 |
.PP
|
|
1206 |
.PD 0
|
|
1207 |
$\fIname\fR
|
|
1208 |
.TP 8
|
|
1209 |
${\fIname\fR}
|
|
1210 |
Substitutes the words of the value of variable \fIname\fR, each separated
|
|
1211 |
by a blank. Braces insulate \fIname\fR from following characters which would
|
|
1212 |
otherwise be part of it. Shell variables have names consisting of
|
|
1213 |
letters and digits starting with a letter. The underscore character is
|
|
1214 |
considered a letter. If \fIname\fR is not a shell variable, but is set in the
|
|
1215 |
environment, then that value is returned (but some of the other forms
|
|
1216 |
given below are not available in this case).
|
|
1217 |
.PP
|
|
1218 |
$\fIname\fR[\fIselector\fR]
|
|
1219 |
.TP 8
|
|
1220 |
${\fIname\fR[\fIselector\fR]}
|
|
1221 |
Substitutes only the selected words from the value of \fIname\fR.
|
|
1222 |
The \fIselector\fR is subjected to `$' substitution and may consist of
|
|
1223 |
a single number or two numbers separated by a `\-'.
|
|
1224 |
The first word of a variable's value is numbered `1'.
|
|
1225 |
If the first number of a range is omitted it defaults to `1'.
|
|
1226 |
If the last member of a range is omitted it defaults to `$#\fIname\fR'.
|
|
1227 |
The \fIselector\fR `*' selects all words.
|
|
1228 |
It is not an error for a range to be empty if the
|
|
1229 |
second argument is omitted or in range.
|
|
1230 |
.TP 8
|
|
1231 |
$0
|
|
1232 |
Substitutes the name of the file from which command input
|
|
1233 |
is being read. An error occurs if the name is not known.
|
|
1234 |
.PP
|
|
1235 |
$\fInumber\fR
|
|
1236 |
.TP 8
|
|
1237 |
${\fInumber\fR}
|
|
1238 |
Equivalent to `$argv[\fInumber\fR]'.
|
|
1239 |
.TP 8
|
|
1240 |
$*
|
|
1241 |
Equivalent to `$argv', which is equivalent to `$argv[*]'.
|
|
1242 |
.PD
|
|
1243 |
.PP
|
|
1244 |
The `:' modifiers described under \fBHistory substitution\fR, except for `:p',
|
|
1245 |
can be applied to the substitutions above. More than one may be used. (+)
|
|
1246 |
Braces may be needed to insulate a variable substitution from a literal colon
|
|
1247 |
just as with \fBHistory substitution\fR (q.v.); any modifiers must appear
|
|
1248 |
within the braces.
|
|
1249 |
.PP
|
|
1250 |
The following substitutions can not be modified with `:' modifiers.
|
|
1251 |
.PP
|
|
1252 |
.PD 0
|
|
1253 |
$?\fIname\fR
|
|
1254 |
.TP 8
|
|
1255 |
${?\fIname\fR}
|
|
1256 |
Substitutes the string `1' if \fIname\fR is set, `0' if it is not.
|
|
1257 |
.TP 8
|
|
1258 |
$?0
|
|
1259 |
Substitutes `1' if the current input filename is known, `0' if it is not.
|
|
1260 |
Always `0' in interactive shells.
|
|
1261 |
.PP
|
|
1262 |
$#\fIname\fR
|
|
1263 |
.TP 8
|
|
1264 |
${#\fIname\fR}
|
|
1265 |
Substitutes the number of words in \fIname\fR.
|
|
1266 |
.TP 8
|
|
1267 |
$#
|
|
1268 |
Equivalent to `$#argv'. (+)
|
|
1269 |
.PP
|
|
1270 |
$%\fIname\fR
|
|
1271 |
.TP 8
|
|
1272 |
${%\fIname\fR}
|
|
1273 |
Substitutes the number of characters in \fIname\fR. (+)
|
|
1274 |
.PP
|
|
1275 |
$%\fInumber\fR
|
|
1276 |
.TP 8
|
|
1277 |
${%\fInumber\fR}
|
|
1278 |
Substitutes the number of characters in $argv[\fInumber\fR]. (+)
|
|
1279 |
.TP 8
|
|
1280 |
$?
|
|
1281 |
Equivalent to `$status'. (+)
|
|
1282 |
.TP 8
|
|
1283 |
$$
|
|
1284 |
Substitutes the (decimal) process number of the (parent) shell.
|
|
1285 |
.TP 8
|
|
1286 |
$!
|
|
1287 |
Substitutes the (decimal) process number of the last
|
|
1288 |
background process started by this shell. (+)
|
|
1289 |
.TP 8
|
|
1290 |
$_
|
|
1291 |
Substitutes the command line of the last command executed. (+)
|
|
1292 |
.TP 8
|
|
1293 |
$<
|
|
1294 |
Substitutes a line from the standard input, with no further interpretation
|
|
1295 |
thereafter. It can be used to read from the keyboard in a shell script.
|
|
1296 |
(+) While \fIcsh\fR always quotes $<, as if it were equivalent to `$<:q',
|
|
1297 |
\fItcsh\fR does not. Furthermore, when \fItcsh\fR is waiting for a line to be
|
|
1298 |
typed the user may type an interrupt to interrupt the sequence into
|
|
1299 |
which the line is to be substituted, but \fIcsh\fR does not allow this.
|
|
1300 |
.PD
|
|
1301 |
.PP
|
|
1302 |
The editor command \fIexpand-variables\fR, normally bound to `^X-$',
|
|
1303 |
can be used to interactively expand individual variables.
|
|
1304 |
.SS "Command, filename and directory stack substitution"
|
|
1305 |
The remaining substitutions are applied selectively to the arguments of builtin
|
|
1306 |
commands. This means that portions of expressions which are not evaluated are
|
|
1307 |
not subjected to these expansions. For commands which are not internal to the
|
|
1308 |
shell, the command name is substituted separately from the argument list. This
|
|
1309 |
occurs very late, after input-output redirection is performed, and in a child
|
|
1310 |
of the main shell.
|
|
1311 |
.SS "Command substitution"
|
|
1312 |
Command substitution is indicated by a command enclosed in ``'. The output
|
|
1313 |
from such a command is broken into separate words at blanks, tabs and newlines,
|
|
1314 |
and null words are discarded. The output is variable and command substituted
|
|
1315 |
and put in place of the original string.
|
|
1316 |
.PP
|
|
1317 |
Command substitutions inside double
|
|
1318 |
quotes (`"') retain blanks and tabs; only newlines force new words. The single
|
|
1319 |
final newline does not force a new word in any case. It is thus possible for a
|
|
1320 |
command substitution to yield only part of a word, even if the command outputs
|
|
1321 |
a complete line.
|
|
1322 |
.PP
|
|
1323 |
By default, the shell since version 6.12 replaces all newline and carriage
|
|
1324 |
return characters in the command by spaces. If this is switched off by
|
|
1325 |
unsetting \fBcsubstnonl\fR, newlines separate commands as usual.
|
|
1326 |
.SS "Filename substitution"
|
|
1327 |
If a word contains any of the characters `*', `?', `[' or `{' or begins with
|
|
1328 |
the character `~' it is a candidate for filename substitution, also known as
|
|
1329 |
``globbing''. This word is then regarded as a pattern (``glob-pattern''), and
|
|
1330 |
replaced with an alphabetically sorted list of file names which match the
|
|
1331 |
pattern.
|
|
1332 |
.PP
|
|
1333 |
In matching filenames, the character `.' at the beginning of a filename or
|
|
1334 |
immediately following a `/', as well as the character `/' must be matched
|
|
1335 |
explicitly. The character `*' matches any string of characters, including the
|
|
1336 |
null string. The character `?' matches any single character. The sequence
|
|
1337 |
`[...]' matches any one of the characters enclosed. Within `[...]', a pair of
|
|
1338 |
characters separated by `\-' matches any character lexically between the two.
|
|
1339 |
.PP
|
|
1340 |
(+) Some glob-patterns can be negated:
|
|
1341 |
The sequence `[^...]' matches any single character \fInot\fR specified by the
|
|
1342 |
characters and/or ranges of characters in the braces.
|
|
1343 |
.PP
|
|
1344 |
An entire glob-pattern can also be negated with `^':
|
|
1345 |
.IP "" 4
|
|
1346 |
> echo *
|
|
1347 |
.br
|
|
1348 |
bang crash crunch ouch
|
|
1349 |
.br
|
|
1350 |
> echo ^cr*
|
|
1351 |
.br
|
|
1352 |
bang ouch
|
|
1353 |
.PP
|
|
1354 |
Glob-patterns which do not use `?', `*', or `[]' or which use `{}' or `~'
|
|
1355 |
(below) are not negated correctly.
|
|
1356 |
.PP
|
|
1357 |
The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'.
|
|
1358 |
Left-to-right order is preserved: `/usr/source/s1/{oldls,ls}.c' expands
|
|
1359 |
to `/usr/source/s1/oldls.c /usr/source/s1/ls.c'. The results of matches are
|
|
1360 |
sorted separately at a low level to preserve this order:
|
|
1361 |
`../{memo,*box}' might expand to `../memo ../box ../mbox'.
|
|
1362 |
(Note that `memo' was not sorted with the results of matching `*box'.)
|
|
1363 |
It is not an error when this construct expands to files which do not exist,
|
|
1364 |
but it is possible to get an error from a command to which the expanded list
|
|
1365 |
is passed.
|
|
1366 |
This construct may be nested.
|
|
1367 |
As a special case the words `{', `}' and `{}' are passed undisturbed.
|
|
1368 |
.PP
|
|
1369 |
The character `~' at the beginning of a filename refers to home directories.
|
|
1370 |
Standing alone, i.e., `~', it expands to the invoker's home directory as
|
|
1371 |
reflected in the value of the \fBhome\fR shell variable. When followed by a
|
|
1372 |
name consisting of letters, digits and `\-' characters the shell searches for a
|
|
1373 |
user with that name and substitutes their home directory; thus `~ken' might
|
|
1374 |
expand to `/usr/ken' and `~ken/chmach' to `/usr/ken/chmach'. If the character
|
|
1375 |
`~' is followed by a character other than a letter or `/' or appears elsewhere
|
|
1376 |
than at the beginning of a word, it is left undisturbed.
|
|
1377 |
A command like `setenv MANPATH /usr/man:/usr/local/man:~/lib/man' does not,
|
|
1378 |
therefore, do home directory substitution as one might hope.
|
|
1379 |
.PP
|
|
1380 |
It is an error for a glob-pattern containing `*', `?', `[' or `~', with or
|
|
1381 |
without `^', not to match any files. However, only one pattern in a list of
|
|
1382 |
glob-patterns must match a file (so that, e.g., `rm *.a *.c *.o' would fail
|
|
1383 |
only if there were no files in the current directory ending in `.a', `.c', or
|
|
1384 |
`.o'), and if the \fBnonomatch\fR shell variable is set a pattern (or list
|
|
1385 |
of patterns) which matches nothing is left unchanged rather than causing
|
|
1386 |
an error.
|
|
1387 |
.PP
|
|
1388 |
The \fBnoglob\fR shell variable can be set to prevent filename substitution,
|
|
1389 |
and the \fIexpand-glob\fR editor command, normally bound to `^X-*', can be
|
|
1390 |
used to interactively expand individual filename substitutions.
|
|
1391 |
.SS "Directory stack substitution (+)"
|
|
1392 |
The directory stack is a list of directories, numbered from zero, used by the
|
|
1393 |
\fIpushd\fR, \fIpopd\fR and \fIdirs\fR builtin commands (q.v.).
|
|
1394 |
\fIdirs\fR can print, store in a file, restore and clear the directory stack
|
|
1395 |
at any time, and the \fBsavedirs\fR and \fBdirsfile\fR shell variables can be set to
|
|
1396 |
store the directory stack automatically on logout and restore it on login.
|
|
1397 |
The \fBdirstack\fR shell variable can be examined to see the directory stack and
|
|
1398 |
set to put arbitrary directories into the directory stack.
|
|
1399 |
.PP
|
|
1400 |
The character `=' followed by one or more digits expands to an entry in
|
|
1401 |
the directory stack. The special case `=\-' expands to the last directory in
|
|
1402 |
the stack. For example,
|
|
1403 |
.IP "" 4
|
|
1404 |
> dirs \-v
|
|
1405 |
.br
|
|
1406 |
0 /usr/bin
|
|
1407 |
.br
|
|
1408 |
1 /usr/spool/uucp
|
|
1409 |
.br
|
|
1410 |
2 /usr/accts/sys
|
|
1411 |
.br
|
|
1412 |
> echo =1
|
|
1413 |
.br
|
|
1414 |
/usr/spool/uucp
|
|
1415 |
.br
|
|
1416 |
> echo =0/calendar
|
|
1417 |
.br
|
|
1418 |
/usr/bin/calendar
|
|
1419 |
.br
|
|
1420 |
> echo =\-
|
|
1421 |
.br
|
|
1422 |
/usr/accts/sys
|
|
1423 |
.PP
|
|
1424 |
The \fBnoglob\fR and \fBnonomatch\fR shell variables and the \fIexpand-glob\fR
|
|
1425 |
editor command apply to directory stack as well as filename substitutions.
|
|
1426 |
.SS "Other substitutions (+)"
|
|
1427 |
There are several more transformations involving filenames, not strictly
|
|
1428 |
related to the above but mentioned here for completeness.
|
|
1429 |
\fIAny\fR filename may be expanded to a full path when the
|
|
1430 |
\fBsymlinks\fR variable (q.v.) is set to `expand'.
|
|
1431 |
Quoting prevents this expansion, and
|
|
1432 |
the \fInormalize-path\fR editor command does it on demand.
|
|
1433 |
The \fInormalize-command\fR editor command expands commands in PATH into
|
|
1434 |
full paths on demand.
|
|
1435 |
Finally, \fIcd\fR and \fIpushd\fR interpret `\-' as the old working directory
|
|
1436 |
(equivalent to the shell variable \fBowd\fR).
|
|
1437 |
This is not a substitution at all, but an abbreviation recognized by only
|
|
1438 |
those commands. Nonetheless, it too can be prevented by quoting.
|
|
1439 |
.SS Commands
|
|
1440 |
The next three sections describe how the shell executes commands and
|
|
1441 |
deals with their input and output.
|
|
1442 |
.SS Simple commands, pipelines and sequences
|
|
1443 |
A simple command is a sequence of words, the first of which specifies the
|
|
1444 |
command to be executed. A series of simple commands joined by `|' characters
|
|
1445 |
forms a pipeline. The output of each command in a pipeline is connected to the
|
|
1446 |
input of the next.
|
|
1447 |
.PP
|
|
1448 |
Simple commands and pipelines may be joined into sequences with `;', and will
|
|
1449 |
be executed sequentially. Commands and pipelines can also be joined into
|
|
1450 |
sequences with `||' or `&&', indicating, as in the C language, that the second
|
|
1451 |
is to be executed only if the first fails or succeeds respectively.
|
|
1452 |
.PP
|
|
1453 |
A simple command, pipeline or sequence may be placed in parentheses, `()',
|
|
1454 |
to form a simple command, which may in turn be a component of a pipeline or
|
|
1455 |
sequence. A command, pipeline or sequence can be executed
|
|
1456 |
without waiting for it to terminate by following it with an `&'.
|
|
1457 |
.SS "Builtin and non-builtin command execution"
|
|
1458 |
Builtin commands are executed within the shell. If any component of a
|
|
1459 |
pipeline except the last is a builtin command, the pipeline is executed
|
|
1460 |
in a subshell.
|
|
1461 |
.PP
|
|
1462 |
Parenthesized commands are always executed in a subshell.
|
|
1463 |
.IP "" 4
|
|
1464 |
(cd; pwd); pwd
|
|
1465 |
.PP
|
|
1466 |
thus prints the \fBhome\fR directory, leaving you where you were
|
|
1467 |
(printing this after the home directory), while
|
|
1468 |
.IP "" 4
|
|
1469 |
cd; pwd
|
|
1470 |
.PP
|
|
1471 |
leaves you in the \fBhome\fR directory. Parenthesized commands are most often
|
|
1472 |
used to prevent \fIcd\fR from affecting the current shell.
|
|
1473 |
.PP
|
|
1474 |
When a command to be executed is found not to be a builtin command the shell
|
|
1475 |
attempts to execute the command via \fIexecve\fR(2). Each word in the variable
|
|
1476 |
\fBpath\fR names a directory in which the shell will look for the
|
|
1477 |
command. If the shell is not given a \fB\-f\fR option, the shell
|
|
1478 |
hashes the names in these directories into an internal table so that it will
|
|
1479 |
try an \fIexecve\fR(2) in only a directory where there is a possibility that the
|
|
1480 |
command resides there. This greatly speeds command location when a large
|
|
1481 |
number of directories are present in the search path. This hashing mechanism is
|
|
1482 |
not used:
|
|
1483 |
.TP 4
|
|
1484 |
.B 1.
|
|
1485 |
If hashing is turned explicitly off via \fIunhash\fR.
|
|
1486 |
.TP 4
|
|
1487 |
.B 2.
|
|
1488 |
If the shell was given a \fB\-f\fR argument.
|
|
1489 |
.TP 4
|
|
1490 |
.B 3.
|
|
1491 |
For each directory component of \fBpath\fR which does not begin with a `/'.
|
|
1492 |
.TP 4
|
|
1493 |
.B 4.
|
|
1494 |
If the command contains a `/'.
|
|
1495 |
.PP
|
|
1496 |
In the above four cases the shell concatenates each component of the path
|
|
1497 |
vector with the given command name to form a path name of a file which it
|
|
1498 |
then attempts to execute it. If execution is successful, the search stops.
|
|
1499 |
.PP
|
|
1500 |
If the file has execute permissions but is not an executable to the system
|
|
1501 |
(i.e., it is neither an executable binary nor a script that specifies its
|
|
1502 |
interpreter), then it is assumed to be a file containing shell commands and
|
|
1503 |
a new shell is spawned to read it. The \fIshell\fR special alias may be set
|
|
1504 |
to specify an interpreter other than the shell itself.
|
|
1505 |
.PP
|
|
1506 |
On systems which do not understand the `#!' script interpreter convention
|
|
1507 |
the shell may be compiled to emulate it; see the \fBversion\fR shell
|
|
1508 |
variable\fR. If so, the shell checks the first line of the file to
|
|
1509 |
see if it is of the form `#!\fIinterpreter\fR \fIarg\fR ...'. If it is,
|
|
1510 |
the shell starts \fIinterpreter\fR with the given \fIarg\fRs and feeds the
|
|
1511 |
file to it on standard input.
|
|
1512 |
.SS Input/output
|
|
1513 |
The standard input and standard output of a command may be redirected with the
|
|
1514 |
following syntax:
|
|
1515 |
.PP
|
|
1516 |
.PD 0
|
|
1517 |
.TP 8
|
|
1518 |
< \fIname
|
|
1519 |
Open file \fIname\fR (which is first variable, command and filename
|
|
1520 |
expanded) as the standard input.
|
|
1521 |
.TP 8
|
|
1522 |
<< \fIword
|
|
1523 |
Read the shell input up to a line which is identical to \fIword\fR. \fIword\fR
|
|
1524 |
is not subjected to variable, filename or command substitution, and each input
|
|
1525 |
line is compared to \fIword\fR before any substitutions are done on this input
|
|
1526 |
line. Unless a quoting `\e', `"', `' or ``' appears in \fIword\fR variable and
|
|
1527 |
command substitution is performed on the intervening lines, allowing `\e' to
|
|
1528 |
quote `$', `\e' and ``'. Commands which are substituted have all blanks, tabs,
|
|
1529 |
and newlines preserved, except for the final newline which is dropped. The
|
|
1530 |
resultant text is placed in an anonymous temporary file which is given to the
|
|
1531 |
command as standard input.
|
|
1532 |
.PP
|
|
1533 |
> \fIname
|
|
1534 |
.br
|
|
1535 |
>! \fIname
|
|
1536 |
.br
|
|
1537 |
>& \fIname
|
|
1538 |
.TP 8
|
|
1539 |
>&! \fIname
|
|
1540 |
The file \fIname\fR is used as standard output. If the file does not exist
|
|
1541 |
then it is created; if the file exists, it is truncated, its previous contents
|
|
1542 |
being lost.
|
|
1543 |
.RS +8
|
|
1544 |
.PD
|
|
1545 |
.PP
|
|
1546 |
If the shell variable \fBnoclobber\fR is set, then the file must not exist or be a
|
|
1547 |
character special file (e.g., a terminal or `/dev/null') or an error results.
|
|
1548 |
This helps prevent accidental destruction of files. In this case the `!' forms
|
|
1549 |
can be used to suppress this check.
|
|
1550 |
.PP
|
|
1551 |
The forms involving `&' route the diagnostic output into the specified file as
|
|
1552 |
well as the standard output. \fIname\fR is expanded in the same way as `<'
|
|
1553 |
input filenames are.
|
|
1554 |
.PD 0
|
|
1555 |
.RE
|
|
1556 |
.PP
|
|
1557 |
>> \fIname
|
|
1558 |
.br
|
|
1559 |
>>& \fIname
|
|
1560 |
.br
|
|
1561 |
>>! \fIname
|
|
1562 |
.TP 8
|
|
1563 |
>>&! \fIname
|
|
1564 |
Like `>', but appends output to the end of \fIname\fR.
|
|
1565 |
If the shell variable \fBnoclobber\fR is set, then it is an error for
|
|
1566 |
the file \fInot\fR to exist, unless one of the `!' forms is given.
|
|
1567 |
.PD
|
|
1568 |
.PP
|
|
1569 |
A command receives the environment in which the shell was invoked as modified
|
|
1570 |
by the input-output parameters and the presence of the command in a pipeline.
|
|
1571 |
Thus, unlike some previous shells, commands run from a file of shell commands
|
|
1572 |
have no access to the text of the commands by default; rather they receive the
|
|
1573 |
original standard input of the shell. The `<<' mechanism should be used to
|
|
1574 |
present inline data. This permits shell command scripts to function as
|
|
1575 |
components of pipelines and allows the shell to block read its input. Note
|
|
1576 |
that the default standard input for a command run detached is \fInot\fR
|
|
1577 |
the empty file \fI/dev/null\fR, but the original standard input of the shell.
|
|
1578 |
If this is a terminal and if the process attempts to read from the terminal,
|
|
1579 |
then the process will block and the user will be notified (see \fBJobs\fR).
|
|
1580 |
.PP
|
|
1581 |
Diagnostic output may be directed through a pipe with the standard output.
|
|
1582 |
Simply use the form `|&' rather than just `|'.
|
|
1583 |
.PP
|
|
1584 |
The shell cannot presently redirect diagnostic output without also redirecting
|
|
1585 |
standard output, but `(\fIcommand\fR > \fIoutput-file\fR) >& \fIerror-file\fR'
|
|
1586 |
is often an acceptable workaround. Either \fIoutput-file\fR or
|
|
1587 |
\fIerror-file\fR may be `/dev/tty' to send output to the terminal.
|
|
1588 |
.SS Features
|
|
1589 |
Having described how the shell accepts, parses and executes
|
|
1590 |
command lines, we now turn to a variety of its useful features.
|
|
1591 |
.SS "Control flow"
|
|
1592 |
The shell contains a number of commands which can be used to regulate the
|
|
1593 |
flow of control in command files (shell scripts) and (in limited but
|
|
1594 |
useful ways) from terminal input. These commands all operate by forcing the
|
|
1595 |
shell to reread or skip in its input and, due to the implementation,
|
|
1596 |
restrict the placement of some of the commands.
|
|
1597 |
.PP
|
|
1598 |
The \fIforeach\fR, \fIswitch\fR, and \fIwhile\fR statements, as well as the
|
|
1599 |
\fIif-then-else\fR form of the \fIif\fR statement, require that the major
|
|
1600 |
keywords appear in a single simple command on an input line as shown below.
|
|
1601 |
.PP
|
|
1602 |
If the shell's input is not seekable, the shell buffers up input whenever
|
|
1603 |
a loop is being read and performs seeks in this internal buffer to
|
|
1604 |
accomplish the rereading implied by the loop. (To the extent that this
|
|
1605 |
allows, backward \fIgoto\fRs will succeed on non-seekable inputs.)
|
|
1606 |
.SS Expressions
|
|
1607 |
The \fIif\fR, \fIwhile\fR and \fIexit\fR builtin commands
|
|
1608 |
use expressions with a common syntax. The expressions can include any
|
|
1609 |
of the operators described in the next three sections. Note that the \fI@\fR
|
|
1610 |
builtin command (q.v.) has its own separate syntax.
|
|
1611 |
.SS "Logical, arithmetical and comparison operators"
|
|
1612 |
These operators are similar to those of C and have the same precedence.
|
|
1613 |
They include
|
|
1614 |
.IP "" 4
|
|
1615 |
|| && | ^ & == != =~ !~ <= >=
|
|
1616 |
.br
|
|
1617 |
< > << >> + \- * / % ! ~ ( )
|
|
1618 |
.PP
|
|
1619 |
Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<='
|
|
1620 |
`>=' `<' and `>', `<<' and `>>', `+' and `\-', `*' `/' and `%' being, in
|
|
1621 |
groups, at the same level. The `==' `!=' `=~' and `!~' operators compare
|
|
1622 |
their arguments as strings; all others operate on numbers. The operators
|
|
1623 |
`=~' and `!~' are like `!=' and `==' except that the right hand side is a
|
|
1624 |
glob-pattern (see \fBFilename substitution\fR) against which the left hand
|
|
1625 |
operand is matched. This reduces the need for use of the \fIswitch\fR
|
|
1626 |
builtin command in shell scripts when all that is really needed is
|
|
1627 |
pattern matching.
|
|
1628 |
.PP
|
|
1629 |
Null or
|
|
1630 |
missing arguments are considered `0'. The results of all expressions are
|
|
1631 |
strings, which represent decimal numbers. It is important to note that
|
|
1632 |
no two components of an expression can appear in the same word; except
|
|
1633 |
when adjacent to components of expressions which are syntactically
|
|
1634 |
significant to the parser (`&' `|' `<' `>' `(' `)') they should be
|
|
1635 |
surrounded by spaces.
|
|
1636 |
.SS "Command exit status"
|
|
1637 |
Commands can be executed in expressions and their exit status
|
|
1638 |
returned by enclosing them in braces (`{}'). Remember that the braces should
|
|
1639 |
be separated from the words of the command by spaces. Command executions
|
|
1640 |
succeed, returning true, i.e., `1', if the command exits with status 0,
|
|
1641 |
otherwise they fail, returning false, i.e., `0'. If more detailed status
|
|
1642 |
information is required then the command should be executed outside of an
|
|
1643 |
expression and the \fBstatus\fR shell variable examined.
|
|
1644 |
.SS "File inquiry operators"
|
|
1645 |
Some of these operators perform true/false tests on files and related
|
|
1646 |
objects. They are of the form \fB\-\fIop file\fR, where \fIop\fR is one of
|
|
1647 |
.PP
|
|
1648 |
.PD 0
|
|
1649 |
.RS +4
|
|
1650 |
.TP 4
|
|
1651 |
.B r
|
|
1652 |
Read access
|
|
1653 |
.TP 4
|
|
1654 |
.B w
|
|
1655 |
Write access
|
|
1656 |
.TP 4
|
|
1657 |
.B x
|
|
1658 |
Execute access
|
|
1659 |
.TP 4
|
|
1660 |
.B X
|
|
1661 |
Executable in the path or shell builtin, e.g., `\-X ls' and `\-X ls\-F' are
|
|
1662 |
generally true, but `\-X /bin/ls' is not (+)
|
|
1663 |
.TP 4
|
|
1664 |
.B e
|
|
1665 |
Existence
|
|
1666 |
.TP 4
|
|
1667 |
.B o
|
|
1668 |
Ownership
|
|
1669 |
.TP 4
|
|
1670 |
.B z
|
|
1671 |
Zero size
|
|
1672 |
.TP 4
|
|
1673 |
.B s
|
|
1674 |
Non-zero size (+)
|
|
1675 |
.TP 4
|
|
1676 |
.B f
|
|
1677 |
Plain file
|
|
1678 |
.TP 4
|
|
1679 |
.B d
|
|
1680 |
Directory
|
|
1681 |
.TP 4
|
|
1682 |
.B l
|
|
1683 |
Symbolic link (+) *
|
|
1684 |
.TP 4
|
|
1685 |
.B b
|
|
1686 |
Block special file (+)
|
|
1687 |
.TP 4
|
|
1688 |
.B c
|
|
1689 |
Character special file (+)
|
|
1690 |
.TP 4
|
|
1691 |
.B p
|
|
1692 |
Named pipe (fifo) (+) *
|
|
1693 |
.TP 4
|
|
1694 |
.B S
|
|
1695 |
Socket special file (+) *
|
|
1696 |
.TP 4
|
|
1697 |
.B u
|
|
1698 |
Set-user-ID bit is set (+)
|
|
1699 |
.TP 4
|
|
1700 |
.B g
|
|
1701 |
Set-group-ID bit is set (+)
|
|
1702 |
.TP 4
|
|
1703 |
.B k
|
|
1704 |
Sticky bit is set (+)
|
|
1705 |
.TP 4
|
|
1706 |
.B t
|
|
1707 |
\fIfile\fR (which must be a digit) is an open file descriptor
|
|
1708 |
for a terminal device (+)
|
|
1709 |
.TP 4
|
|
1710 |
.B R
|
|
1711 |
Has been migrated (convex only) (+)
|
|
1712 |
.TP 4
|
|
1713 |
.B L
|
|
1714 |
Applies subsequent operators in a multiple-operator test to a symbolic link
|
|
1715 |
rather than to the file to which the link points (+) *
|
|
1716 |
.RE
|
|
1717 |
.PD
|
|
1718 |
.PP
|
|
1719 |
\fIfile\fR is command and filename expanded and then tested to
|
|
1720 |
see if it has the specified relationship to the real user. If \fIfile\fR
|
|
1721 |
does not exist or is inaccessible or, for the operators indicated by `*',
|
|
1722 |
if the specified file type does not exist on the current system,
|
|
1723 |
then all enquiries return false, i.e., `0'.
|
|
1724 |
.PP
|
|
1725 |
These operators may be combined for conciseness: `\-\fIxy file\fR' is
|
|
1726 |
equivalent to `\-\fIx file\fR && \-\fIy file\fR'. (+) For example, `\-fx' is true
|
|
1727 |
(returns `1') for plain executable files, but not for directories.
|
|
1728 |
.PP
|
|
1729 |
\fBL\fR may be used in a multiple-operator test to apply subsequent operators
|
|
1730 |
to a symbolic link rather than to the file to which the link points.
|
|
1731 |
For example, `\-lLo' is true for links owned by the invoking user.
|
|
1732 |
\fBLr\fR, \fBLw\fR and \fBLx\fR are always true for links and false for
|
|
1733 |
non-links. \fBL\fR has a different meaning when it is the last operator
|
|
1734 |
in a multiple-operator test; see below.
|
|
1735 |
.PP
|
|
1736 |
It is possible but not useful, and sometimes misleading, to combine operators
|
|
1737 |
which expect \fIfile\fR to be a file with operators which do not,
|
|
1738 |
(e.g., \fBX\fR and \fBt\fR). Following \fBL\fR with a non-file operator
|
|
1739 |
can lead to particularly strange results.
|
|
1740 |
.PP
|
|
1741 |
Other operators return other information, i.e., not just `0' or `1'. (+)
|
|
1742 |
They have the same format as before; \fIop\fR may be one of
|
|
1743 |
.PP
|
|
1744 |
.PD 0
|
|
1745 |
.RS +4
|
|
1746 |
.TP 8
|
|
1747 |
.B A
|
|
1748 |
Last file access time, as the number of seconds since the epoch
|
|
1749 |
.TP 8
|
|
1750 |
.B A:
|
|
1751 |
Like \fBA\fR, but in timestamp format, e.g., `Fri May 14 16:36:10 1993'
|
|
1752 |
.TP 8
|
|
1753 |
.B M
|
|
1754 |
Last file modification time
|
|
1755 |
.TP 8
|
|
1756 |
.B M:
|
|
1757 |
Like \fBM\fR, but in timestamp format
|
|
1758 |
.TP 8
|
|
1759 |
.B C
|
|
1760 |
Last inode modification time
|
|
1761 |
.TP 8
|
|
1762 |
.B C:
|
|
1763 |
Like \fBC\fR, but in timestamp format
|
|
1764 |
.TP 8
|
|
1765 |
.B D
|
|
1766 |
Device number
|
|
1767 |
.TP 8
|
|
1768 |
.B I
|
|
1769 |
Inode number
|
|
1770 |
.TP 8
|
|
1771 |
.B F
|
|
1772 |
Composite \fBf\fRile identifier, in the form \fIdevice\fR:\fIinode\fR
|
|
1773 |
.TP 8
|
|
1774 |
.B L
|
|
1775 |
The name of the file pointed to by a symbolic link
|
|
1776 |
.TP 8
|
|
1777 |
.B N
|
|
1778 |
Number of (hard) links
|
|
1779 |
.TP 8
|
|
1780 |
.B P
|
|
1781 |
Permissions, in octal, without leading zero
|
|
1782 |
.TP 8
|
|
1783 |
.B P:
|
|
1784 |
Like \fBP\fR, with leading zero
|
|
1785 |
.TP 8
|
|
1786 |
.B P\fImode
|
|
1787 |
Equivalent to `\-P \fIfile\fR & \fImode\fR', e.g., `\-P22 \fIfile\fR' returns
|
|
1788 |
`22' if \fIfile\fR is writable by group and other, `20' if by group only,
|
|
1789 |
and `0' if by neither
|
|
1790 |
.TP 8
|
|
1791 |
.B P\fImode\fB:
|
|
1792 |
Like \fBP\fImode\fR, with leading zero
|
|
1793 |
.TP 8
|
|
1794 |
.B U
|
|
1795 |
Numeric userid
|
|
1796 |
.TP 8
|
|
1797 |
.B U:
|
|
1798 |
Username, or the numeric userid if the username is unknown
|
|
1799 |
.TP 8
|
|
1800 |
.B G
|
|
1801 |
Numeric groupid
|
|
1802 |
.TP 8
|
|
1803 |
.B G:
|
|
1804 |
Groupname, or the numeric groupid if the groupname is unknown
|
|
1805 |
.TP 8
|
|
1806 |
.B Z
|
|
1807 |
Size, in bytes
|
|
1808 |
.RE
|
|
1809 |
.PD
|
|
1810 |
.PP
|
|
1811 |
Only one of these operators may appear in a multiple-operator test, and it
|
|
1812 |
must be the last. Note that \fBL\fR has a different meaning at the end of and
|
|
1813 |
elsewhere in a multiple-operator test. Because `0' is a valid return value
|
|
1814 |
for many of these operators, they do not return `0' when they fail: most
|
|
1815 |
return `\-1', and \fBF\fR returns `:'.
|
|
1816 |
.PP
|
|
1817 |
If the shell is compiled with POSIX defined (see the \fBversion\fR shell
|
|
1818 |
variable), the result of a file inquiry is based on the permission bits of
|
|
1819 |
the file and not on the result of the \fIaccess\fR(2) system call.
|
|
1820 |
For example, if one tests a file with \fB\-w\fR whose permissions would
|
|
1821 |
ordinarily allow writing but which is on a file system mounted read-only,
|
|
1822 |
the test will succeed in a POSIX shell but fail in a non-POSIX shell.
|
|
1823 |
.PP
|
|
1824 |
File inquiry operators can also be evaluated with the \fIfiletest\fR builtin
|
|
1825 |
command (q.v.) (+).
|
|
1826 |
.SS Jobs
|
|
1827 |
The shell associates a \fIjob\fR with each pipeline. It keeps a table of
|
|
1828 |
current jobs, printed by the \fIjobs\fR command, and assigns them small integer
|
|
1829 |
numbers. When a job is started asynchronously with `&', the shell prints a
|
|
1830 |
line which looks like
|
|
1831 |
.IP "" 4
|
|
1832 |
[1] 1234
|
|
1833 |
.PP
|
|
1834 |
indicating that the job which was started asynchronously was job number 1 and
|
|
1835 |
had one (top-level) process, whose process id was 1234.
|
|
1836 |
.PP
|
|
1837 |
If you are running a job and wish to do something else you may hit the suspend
|
|
1838 |
key (usually `^Z'),
|
|
1839 |
which sends a STOP signal to the current job. The shell will then normally
|
|
1840 |
indicate that the job has been `Suspended' and print another prompt.
|
|
1841 |
If the \fBlistjobs\fR shell variable is set, all jobs will be listed
|
|
1842 |
like the \fIjobs\fR builtin command; if it is set to `long' the listing will
|
|
1843 |
be in long format, like `jobs \-l'.
|
|
1844 |
You can then manipulate the state of the suspended job.
|
|
1845 |
You can put it in the
|
|
1846 |
``background'' with the \fIbg\fR command or run some other commands and
|
|
1847 |
eventually bring the job back into the ``foreground'' with \fIfg\fR.
|
|
1848 |
(See also the \fIrun-fg-editor\fR editor command.)
|
|
1849 |
A `^Z' takes effect immediately and is like an interrupt
|
|
1850 |
in that pending output and unread input are discarded when it is typed.
|
|
1851 |
The \fIwait\fR builtin command causes the shell to wait for all background
|
|
1852 |
jobs to complete.
|
|
1853 |
.PP
|
|
1854 |
The `^]' key sends a delayed suspend signal, which does not generate a STOP
|
|
1855 |
signal until a program attempts to \fIread\fR(2) it, to the current job.
|
|
1856 |
This can usefully be typed ahead when you have prepared some commands for a
|
|
1857 |
job which you wish to stop after it has read them.
|
|
1858 |
The `^Y' key performs this function in \fIcsh\fR(1); in \fItcsh\fR,
|
|
1859 |
`^Y' is an editing command. (+)
|
|
1860 |
.PP
|
|
1861 |
A job being run in the background stops if it tries to read from the
|
|
1862 |
terminal. Background jobs are normally allowed to produce output, but this can
|
|
1863 |
be disabled by giving the command `stty tostop'. If you set this tty option,
|
|
1864 |
then background jobs will stop when they try to produce output like they do
|
|
1865 |
when they try to read input.
|
|
1866 |
.PP
|
|
1867 |
There are several ways to refer to jobs in the shell. The character `%'
|
|
1868 |
introduces a job name. If you wish to refer to job number 1, you can name it
|
|
1869 |
as `%1'. Just naming a job brings it to the foreground; thus `%1' is a synonym
|
|
1870 |
for `fg %1', bringing job 1 back into the foreground. Similarly, saying `%1 &'
|
|
1871 |
resumes job 1 in the background, just like `bg %1'. A job can also be named
|
|
1872 |
by an unambiguous prefix of the string typed in to start it: `%ex' would
|
|
1873 |
normally restart a suspended \fIex\fR(1) job, if there were only one suspended
|
|
1874 |
job whose name began with the string `ex'. It is also possible to say
|
|
1875 |
`%?\fIstring\fR' to specify a job whose text contains \fIstring\fR, if there
|
|
1876 |
is only one such job.
|
|
1877 |
.PP
|
|
1878 |
The shell maintains a notion of the current and previous jobs. In output
|
|
1879 |
pertaining to jobs, the current job is marked with a `+' and the previous job
|
|
1880 |
with a `\-'. The abbreviations `%+', `%', and (by analogy with the syntax of
|
|
1881 |
the \fIhistory\fR mechanism) `%%' all refer to the current job, and `%\-' refers
|
|
1882 |
to the previous job.
|
|
1883 |
.PP
|
|
1884 |
The job control mechanism requires that the \fIstty\fR(1) option `new' be set
|
|
1885 |
on some systems. It is an artifact from a `new' implementation of the tty
|
|
1886 |
driver which allows generation of interrupt characters from the keyboard to
|
|
1887 |
tell jobs to stop. See \fIstty\fR(1) and the \fIsetty\fR builtin command for
|
|
1888 |
details on setting options in the new tty driver.
|
|
1889 |
.SS "Status reporting"
|
|
1890 |
The shell learns immediately whenever a process changes state. It normally
|
|
1891 |
informs you whenever a job becomes blocked so that no further progress is
|
|
1892 |
possible, but only right before it prints a prompt. This is done so that it
|
|
1893 |
does not otherwise disturb your work. If, however, you set the shell variable
|
|
1894 |
\fBnotify\fR, the shell will notify you immediately of changes of status in
|
|
1895 |
background jobs. There is also a shell command \fInotify\fR which marks a
|
|
1896 |
single process so that its status changes will be immediately reported. By
|
|
1897 |
default \fInotify\fR marks the current process; simply say `notify' after
|
|
1898 |
starting a background job to mark it.
|
|
1899 |
.PP
|
|
1900 |
When you try to leave the shell while jobs are stopped, you will be
|
|
1901 |
warned that `There are suspended jobs.' You may use the \fIjobs\fR command to
|
|
1902 |
see what they are. If you do this or immediately try to exit again, the shell
|
|
1903 |
will not warn you a second time, and the suspended jobs will be terminated.
|
|
1904 |
.SS "Automatic, periodic and timed events (+)"
|
|
1905 |
There are various ways to run commands and take other actions automatically
|
|
1906 |
at various times in the ``life cycle'' of the shell. They are summarized here,
|
|
1907 |
and described in detail under the appropriate \fBBuiltin commands\fR,
|
|
1908 |
\fBSpecial shell variables\fR and \fBSpecial aliases\fR.
|
|
1909 |
.PP
|
|
1910 |
The \fIsched\fR builtin command puts commands in a scheduled-event list,
|
|
1911 |
to be executed by the shell at a given time.
|
|
1912 |
.PP
|
|
1913 |
The \fIbeepcmd\fR, \fIcwdcmd\fR, \fIperiodic\fR, \fIprecmd\fR, \fIpostcmd\fR,
|
|
1914 |
and \fIjobcmd\fR
|
|
1915 |
\fBSpecial aliases\fR can be set, respectively, to execute commands when the shell wants
|
|
1916 |
to ring the bell, when the working directory changes, every \fBtperiod\fR
|
|
1917 |
minutes, before each prompt, before each command gets executed, after each
|
|
1918 |
command gets executed, and when a job is started or is brought into the
|
|
1919 |
foreground.
|
|
1920 |
.PP
|
|
1921 |
The \fBautologout\fR shell variable can be set to log out or lock the shell
|
|
1922 |
after a given number of minutes of inactivity.
|
|
1923 |
.PP
|
|
1924 |
The \fBmail\fR shell variable can be set to check for new mail periodically.
|
|
1925 |
.PP
|
|
1926 |
The \fBprintexitvalue\fR shell variable can be set to print the exit status
|
|
1927 |
of commands which exit with a status other than zero.
|
|
1928 |
.PP
|
|
1929 |
The \fBrmstar\fR shell variable can be set to ask the user, when `rm *' is
|
|
1930 |
typed, if that is really what was meant.
|
|
1931 |
.PP
|
|
1932 |
The \fBtime\fR shell variable can be set to execute the \fItime\fR builtin
|
|
1933 |
command after the completion of any process that takes more than a given
|
|
1934 |
number of CPU seconds.
|
|
1935 |
.PP
|
|
1936 |
The \fBwatch\fR and \fBwho\fR shell variables can be set to report when
|
|
1937 |
selected users log in or out, and the \fIlog\fR builtin command reports
|
|
1938 |
on those users at any time.
|
|
1939 |
.SS "Native Language System support (+)"
|
|
1940 |
The shell is eight bit clean
|
|
1941 |
(if so compiled; see the \fBversion\fR shell variable)
|
|
1942 |
and thus supports character sets needing this capability.
|
|
1943 |
NLS support differs depending on whether or not
|
|
1944 |
the shell was compiled to use the system's NLS (again, see \fBversion\fR).
|
|
1945 |
In either case, 7-bit ASCII is the default character code
|
|
1946 |
(e.g., the classification of which characters are printable) and sorting,
|
|
1947 |
and changing the \fBLANG\fR or \fBLC_CTYPE\fR environment variables
|
|
1948 |
causes a check for possible changes in these respects.
|
|
1949 |
.PP
|
|
1950 |
When using the system's NLS, the \fIsetlocale\fR(3C) function is called
|
|
1951 |
to determine appropriate character code/classification and sorting
|
|
1952 |
(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
|
|
1953 |
This function typically examines the \fBLANG\fR and \fBLC_CTYPE\fR
|
|
1954 |
environment variables; refer to the system documentation for further details.
|
|
1955 |
When not using the system's NLS, the shell simulates it by assuming that the
|
|
1956 |
ISO 8859-1 character set is used
|
|
1957 |
whenever either of the \fBLANG\fR and \fBLC_CTYPE\fR variables are set, regardless of
|
|
1958 |
their values. Sorting is not affected for the simulated NLS.
|
|
1959 |
.PP
|
|
1960 |
In addition, with both real and simulated NLS, all printable
|
|
1961 |
characters in the range \e200\-\e377, i.e., those that have
|
|
1962 |
M-\fIchar\fR bindings, are automatically rebound to \fIself-insert-command\fR.
|
|
1963 |
The corresponding binding for the escape-\fIchar\fR sequence, if any, is
|
|
1964 |
left alone.
|
|
1965 |
These characters are not rebound if the \fBNOREBIND\fR environment variable
|
|
1966 |
is set. This may be useful for the simulated NLS or a primitive real NLS
|
|
1967 |
which assumes full ISO 8859-1. Otherwise, all M-\fIchar\fR bindings in the
|
|
1968 |
range \e240\-\e377 are effectively undone.
|
|
1969 |
Explicitly rebinding the relevant keys with \fIbindkey\fR
|
|
1970 |
is of course still possible.
|
|
1971 |
.PP
|
|
1972 |
Unknown characters (i.e., those that are neither printable nor control
|
|
1973 |
characters) are printed in the format \ennn.
|
|
1974 |
If the tty is not in 8 bit mode, other 8 bit characters are printed by
|
|
1975 |
converting them to ASCII and using standout mode. The shell
|
|
1976 |
never changes the 7/8 bit mode of the tty and tracks user-initiated
|
|
1977 |
changes of 7/8 bit mode. NLS users (or, for that matter, those who want to
|
|
1978 |
use a meta key) may need to explicitly set
|
|
1979 |
the tty in 8 bit mode through the appropriate \fIstty\fR(1)
|
|
1980 |
command in, e.g., the \fI~/.login\fR file.
|
|
1981 |
.SS "OS variant support (+)"
|
|
1982 |
A number of new builtin commands are provided to support features in
|
|
1983 |
particular operating systems. All are described in detail in the
|
|
1984 |
\fBBuiltin commands\fR section.
|
|
1985 |
.PP
|
|
1986 |
On systems that support TCF (aix-ibm370, aix-ps2),
|
|
1987 |
\fIgetspath\fR and \fIsetspath\fR get and set the system execution path,
|
|
1988 |
\fIgetxvers\fR and \fIsetxvers\fR get and set the experimental version prefix
|
|
1989 |
and \fImigrate\fR migrates processes between sites. The \fIjobs\fR builtin
|
|
1990 |
prints the site on which each job is executing.
|
|
1991 |
.PP
|
|
1992 |
Under BS2000, \fIbs2cmd\fR executes commands of the underlying BS2000/OSD
|
|
1993 |
operating system.
|
|
1994 |
.PP
|
|
1995 |
Under Domain/OS, \fIinlib\fR adds shared libraries to the current environment,
|
|
1996 |
\fIrootnode\fR changes the rootnode and \fIver\fR changes the systype.
|
|
1997 |
.PP
|
|
1998 |
Under Mach, \fIsetpath\fR is equivalent to Mach's \fIsetpath\fR(1).
|
|
1999 |
.PP
|
|
2000 |
Under Masscomp/RTU and Harris CX/UX, \fIuniverse\fR sets the universe.
|
|
2001 |
.PP
|
|
2002 |
Under Harris CX/UX, \fIucb\fR or \fIatt\fR runs a command under the specified
|
|
2003 |
universe.
|
|
2004 |
.PP
|
|
2005 |
Under Convex/OS, \fIwarp\fR prints or sets the universe.
|
|
2006 |
.PP
|
|
2007 |
The \fBVENDOR\fR, \fBOSTYPE\fR and \fBMACHTYPE\fR environment variables
|
|
2008 |
indicate respectively the vendor, operating system and machine type
|
|
2009 |
(microprocessor class or machine model) of the
|
|
2010 |
system on which the shell thinks it is running.
|
|
2011 |
These are particularly useful when sharing one's home directory between several
|
|
2012 |
types of machines; one can, for example,
|
|
2013 |
.IP "" 4
|
|
2014 |
set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
|
|
2015 |
.PP
|
|
2016 |
in one's \fI~/.login\fR and put executables compiled for each machine in the
|
|
2017 |
appropriate directory.
|
|
2018 |
.PP
|
|
2019 |
The \fBversion\fR shell
|
|
2020 |
variable indicates what options were chosen when the shell was compiled.
|
|
2021 |
.PP
|
|
2022 |
Note also the \fInewgrp\fR builtin, the \fBafsuser\fR and
|
|
2023 |
\fBecho_style\fR shell variables and the system-dependent locations of
|
|
2024 |
the shell's input files (see \fBFILES\fR).
|
|
2025 |
.SS "Signal handling"
|
|
2026 |
Login shells ignore interrupts when reading the file \fI~/.logout\fR.
|
|
2027 |
The shell ignores quit signals unless started with \fB\-q\fR.
|
|
2028 |
Login shells catch the terminate signal, but non-login shells inherit the
|
|
2029 |
terminate behavior from their parents.
|
|
2030 |
Other signals have the values which the shell inherited from its parent.
|
|
2031 |
.PP
|
|
2032 |
In shell scripts, the shell's handling of interrupt and terminate signals
|
|
2033 |
can be controlled with \fIonintr\fR, and its handling of hangups can be
|
|
2034 |
controlled with \fIhup\fR and \fInohup\fR.
|
|
2035 |
.PP
|
|
2036 |
The shell exits on a hangup (see also the \fBlogout\fR shell variable). By
|
|
2037 |
default, the shell's children do too, but the shell does not send them a
|
|
2038 |
hangup when it exits. \fIhup\fR arranges for the shell to send a hangup to
|
|
2039 |
a child when it exits, and \fInohup\fR sets a child to ignore hangups.
|
|
2040 |
.SS "Terminal management (+)"
|
|
2041 |
The shell uses three different sets of terminal (``tty'') modes:
|
|
2042 |
`edit', used when editing, `quote', used when quoting literal characters,
|
|
2043 |
and `execute', used when executing commands.
|
|
2044 |
The shell holds some settings in each mode constant, so commands which leave
|
|
2045 |
the tty in a confused state do not interfere with the shell.
|
|
2046 |
The shell also matches changes in the speed and padding of the tty.
|
|
2047 |
The list of tty modes that are kept constant
|
|
2048 |
can be examined and modified with the \fIsetty\fR builtin.
|
|
2049 |
Note that although the editor uses CBREAK mode (or its equivalent),
|
|
2050 |
it takes typed-ahead characters anyway.
|
|
2051 |
.PP
|
|
2052 |
The \fIechotc\fR, \fIsettc\fR and \fItelltc\fR commands can be used to
|
|
2053 |
manipulate and debug terminal capabilities from the command line.
|
|
2054 |
.PP
|
|
2055 |
On systems that support SIGWINCH or SIGWINDOW, the shell
|
|
2056 |
adapts to window resizing automatically and adjusts the environment
|
|
2057 |
variables \fBLINES\fR and \fBCOLUMNS\fR if set. If the environment
|
|
2058 |
variable \fBTERMCAP\fR contains li# and co# fields, the shell adjusts
|
|
2059 |
them to reflect the new window size.
|
|
2060 |
.SH REFERENCE
|
|
2061 |
The next sections of this manual describe all of the available
|
|
2062 |
\fBBuiltin commands\fR, \fBSpecial aliases\fR and
|
|
2063 |
\fBSpecial shell variables\fR.
|
|
2064 |
.SS "Builtin commands"
|
|
2065 |
.TP 8
|
|
2066 |
.B %\fIjob
|
|
2067 |
A synonym for the \fIfg\fR builtin command.
|
|
2068 |
.TP 8
|
|
2069 |
.B %\fIjob \fB&
|
|
2070 |
A synonym for the \fIbg\fR builtin command.
|
|
2071 |
.TP 8
|
|
2072 |
.B :
|
|
2073 |
Does nothing, successfully.
|
|
2074 |
.PP
|
|
2075 |
.B @
|
|
2076 |
.br
|
|
2077 |
.B @ \fIname\fB = \fIexpr
|
|
2078 |
.br
|
|
2079 |
.B @ \fIname\fR[\fIindex\fR]\fB = \fIexpr
|
|
2080 |
.br
|
|
2081 |
.B @ \fIname\fB++\fR|\fB--
|
|
2082 |
.PD 0
|
|
2083 |
.TP 8
|
|
2084 |
.B @ \fIname\fR[\fIindex\fR]\fB++\fR|\fB--
|
|
2085 |
The first form prints the values of all shell variables.
|
|
2086 |
.PD
|
|
2087 |
.RS +8
|
|
2088 |
.PP
|
|
2089 |
The second form assigns the value of \fIexpr\fR to \fIname\fR.
|
|
2090 |
The third form assigns the value of \fIexpr\fR to the \fIindex\fR'th
|
|
2091 |
component of \fIname\fR; both \fIname\fR and its \fIindex\fR'th component
|
|
2092 |
must already exist.
|
|
2093 |
.PP
|
|
2094 |
\fIexpr\fR may contain the operators `*', `+', etc., as in C.
|
|
2095 |
If \fIexpr\fR contains `<', `>', `&' or `' then at least that part of
|
|
2096 |
\fIexpr\fR must be placed within `()'.
|
|
2097 |
Note that the syntax of \fIexpr\fR has nothing to do with that described
|
|
2098 |
under \fBExpressions\fR.
|
|
2099 |
.PP
|
|
2100 |
The fourth and fifth forms increment (`++') or decrement (`\-\-') \fIname\fR
|
|
2101 |
or its \fIindex\fR'th component.
|
|
2102 |
.PP
|
|
2103 |
The space between `@' and \fIname\fR is required. The spaces between
|
|
2104 |
\fIname\fR and `=' and between `=' and \fIexpr\fR are optional. Components of
|
|
2105 |
\fIexpr\fR must be separated by spaces.
|
|
2106 |
.RE
|
|
2107 |
.PD
|
|
2108 |
.TP 8
|
|
2109 |
.B alias \fR[\fIname \fR[\fIwordlist\fR]]
|
|
2110 |
Without arguments, prints all aliases.
|
|
2111 |
With \fIname\fR, prints the alias for name.
|
|
2112 |
With \fIname\fR and \fIwordlist\fR, assigns
|
|
2113 |
\fIwordlist\fR as the alias of \fIname\fR.
|
|
2114 |
\fIwordlist\fR is command and filename substituted.
|
|
2115 |
\fIname\fR may not be `alias' or `unalias'.
|
|
2116 |
See also the \fIunalias\fR builtin command.
|
|
2117 |
.TP 8
|
|
2118 |
.B alloc
|
|
2119 |
Shows the amount of dynamic memory acquired, broken down into used and free
|
|
2120 |
memory. With an argument shows the number of free and used blocks in each size
|
|
2121 |
category. The categories start at size 8 and double at each step. This
|
|
2122 |
command's output may vary across system types, because systems other than the VAX
|
|
2123 |
may use a different memory allocator.
|
|
2124 |
.TP 8
|
|
2125 |
.B bg \fR[\fB%\fIjob\fR ...]
|
|
2126 |
Puts the specified jobs (or, without arguments, the current job)
|
|
2127 |
into the background, continuing each if it is stopped.
|
|
2128 |
\fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
|
|
2129 |
under \fBJobs\fR.
|
|
2130 |
.PP
|
|
2131 |
.B bindkey \fR[\fB\-l\fR|\fB\-d\fR|\fB\-e\fR|\fB\-v\fR|\fB\-u\fR] (+)
|
|
2132 |
.br
|
|
2133 |
\fBbindkey \fR[\fB\-a\fR] [\fB\-b\fR] [\fB\-k\fR] [\fB\-r\fR] [\fB\-\-\fR] \fIkey \fR(+)
|
|
2134 |
.PD 0
|
|
2135 |
.TP 8
|
|
2136 |
\fBbindkey \fR[\fB\-a\fR] [\fB\-b\fR] [\fB\-k\fR] [\fB\-c\fR|\fB\-s\fR] [\fB\-\-\fR] \fIkey command \fR(+)
|
|
2137 |
.\" .B macro can't take too many words, so I used \fB in the previous tags
|
|
2138 |
Without options, the first form lists all bound keys and the editor command to which each is bound,
|
|
2139 |
the second form lists the editor command to which \fIkey\fR is bound and
|
|
2140 |
the third form binds the editor command \fIcommand\fR to \fIkey\fR.
|
|
2141 |
Options include:
|
|
2142 |
.PD
|
|
2143 |
.PP
|
|
2144 |
.PD 0
|
|
2145 |
.RS +8
|
|
2146 |
.TP 4
|
|
2147 |
.B \-l
|
|
2148 |
Lists all editor commands and a short description of each.
|
|
2149 |
.TP 4
|
|
2150 |
.B \-d
|
|
2151 |
Binds all keys to the standard bindings for the default editor.
|
|
2152 |
.TP 4
|
|
2153 |
.B \-e
|
|
2154 |
Binds all keys to the standard GNU Emacs-like bindings.
|
|
2155 |
.TP 4
|
|
2156 |
.B \-v
|
|
2157 |
Binds all keys to the standard \fIvi\fR(1)-like bindings.
|
|
2158 |
.TP 4
|
|
2159 |
.B \-a
|
|
2160 |
Lists or changes key-bindings in the alternative key map.
|
|
2161 |
This is the key map used in \fIvi\fR command mode.
|
|
2162 |
.TP 4
|
|
2163 |
.B \-b
|
|
2164 |
\fIkey\fR is interpreted as
|
|
2165 |
a control character written ^\fIcharacter\fR (e.g., `^A') or
|
|
2166 |
C-\fIcharacter\fR (e.g., `C-A'),
|
|
2167 |
a meta character written M-\fIcharacter\fR (e.g., `M-A'),
|
|
2168 |
a function key written F-\fIstring\fR (e.g., `F-string'),
|
|
2169 |
or an extended prefix key written X-\fIcharacter\fR (e.g., `X-A').
|
|
2170 |
.TP 4
|
|
2171 |
.B \-k
|
|
2172 |
\fIkey\fR is interpreted as a symbolic arrow key name, which may be one of
|
|
2173 |
`down', `up', `left' or `right'.
|
|
2174 |
.TP 4
|
|
2175 |
.B \-r
|
|
2176 |
Removes \fIkey\fR's binding.
|
|
2177 |
Be careful: `bindkey \-r' does \fInot\fR bind \fIkey\fR to
|
|
2178 |
\fIself-insert-command\fR (q.v.), it unbinds \fIkey\fR completely.
|
|
2179 |
.TP 4
|
|
2180 |
.B \-c
|
|
2181 |
\fIcommand\fR is interpreted as a builtin or external command instead of an
|
|
2182 |
editor command.
|
|
2183 |
.TP 4
|
|
2184 |
.B \-s
|
|
2185 |
\fIcommand\fR is taken as a literal string and treated as terminal input
|
|
2186 |
when \fIkey\fR is typed. Bound keys in \fIcommand\fR are themselves
|
|
2187 |
reinterpreted, and this continues for ten levels of interpretation.
|
|
2188 |
.TP 4
|
|
2189 |
.B \-\-
|
|
2190 |
Forces a break from option processing, so the next word is taken as \fIkey\fR
|
|
2191 |
even if it begins with '\-'.
|
|
2192 |
.TP 4
|
|
2193 |
.B \-u \fR(or any invalid option)
|
|
2194 |
Prints a usage message.
|
|
2195 |
.PD
|
|
2196 |
.PP
|
|
2197 |
\fIkey\fR may be a single character or a string.
|
|
2198 |
If a command is bound to a string, the first character of the string is bound to
|
|
2199 |
\fIsequence-lead-in\fR and the entire string is bound to the command.
|
|
2200 |
.PP
|
|
2201 |
Control characters in \fIkey\fR can be literal (they can be typed by preceding
|
|
2202 |
them with the editor command \fIquoted-insert\fR, normally bound to `^V') or
|
|
2203 |
written caret-character style, e.g., `^A'. Delete is written `^?'
|
|
2204 |
(caret-question mark). \fIkey\fR and \fIcommand\fR can contain backslashed
|
|
2205 |
escape sequences (in the style of System V \fIecho\fR(1)) as follows:
|
|
2206 |
.RS +4
|
|
2207 |
.TP 8
|
|
2208 |
.PD 0
|
|
2209 |
.B \ea
|
|
2210 |
Bell
|
|
2211 |
.TP 8
|
|
2212 |
.B \eb
|
|
2213 |
Backspace
|
|
2214 |
.TP 8
|
|
2215 |
.B \ee
|
|
2216 |
Escape
|
|
2217 |
.TP 8
|
|
2218 |
.B \ef
|
|
2219 |
Form feed
|
|
2220 |
.TP 8
|
|
2221 |
.B \en
|
|
2222 |
Newline
|
|
2223 |
.TP 8
|
|
2224 |
.B \er
|
|
2225 |
Carriage return
|
|
2226 |
.TP 8
|
|
2227 |
.B \et
|
|
2228 |
Horizontal tab
|
|
2229 |
.TP 8
|
|
2230 |
.B \ev
|
|
2231 |
Vertical tab
|
|
2232 |
.TP 8
|
|
2233 |
.B \e\fInnn
|
|
2234 |
The ASCII character corresponding to the octal number \fInnn\fR
|
|
2235 |
.PD
|
|
2236 |
.RE
|
|
2237 |
.PP
|
|
2238 |
`\e' nullifies the special meaning of the following character, if it has
|
|
2239 |
any, notably `\\' and `^'.
|
|
2240 |
.RE
|
|
2241 |
.TP 8
|
|
2242 |
.B bs2cmd \fIbs2000-command\fR (+)
|
|
2243 |
Passes \fIbs2000-command\fR to the BS2000 command interpreter for
|
|
2244 |
execution. Only non-interactive commands can be executed, and it is
|
|
2245 |
not possible to execute any command that would overlay the image
|
|
2246 |
of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
|
|
2247 |
.TP 8
|
|
2248 |
.B break
|
|
2249 |
Causes execution to resume after the \fIend\fR of the nearest
|
|
2250 |
enclosing \fIforeach\fR or \fIwhile\fR. The remaining commands on the
|
|
2251 |
current line are executed. Multi-level breaks are thus
|
|
2252 |
possible by writing them all on one line.
|
|
2253 |
.TP 8
|
|
2254 |
.B breaksw
|
|
2255 |
Causes a break from a \fIswitch\fR, resuming after the \fIendsw\fR.
|
|
2256 |
.TP 8
|
|
2257 |
.B builtins \fR(+)
|
|
2258 |
Prints the names of all builtin commands.
|
|
2259 |
.TP 8
|
|
2260 |
.B bye \fR(+)
|
|
2261 |
A synonym for the \fIlogout\fR builtin command.
|
|
2262 |
Available only if the shell was so compiled;
|
|
2263 |
see the \fBversion\fR shell variable.
|
|
2264 |
.TP 8
|
|
2265 |
.B case \fIlabel\fB:
|
|
2266 |
A label in a \fIswitch\fR statement as discussed below.
|
|
2267 |
.TP 8
|
|
2268 |
.B cd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\fIname\fR]
|
|
2269 |
If a directory \fIname\fR is given, changes the shell's working directory
|
|
2270 |
to \fIname\fR. If not, changes to \fBhome\fR.
|
|
2271 |
If \fIname\fR is `\-' it is interpreted as the previous working directory
|
|
2272 |
(see \fBOther substitutions\fR). (+)
|
|
2273 |
If \fIname\fR is not a subdirectory of the current directory
|
|
2274 |
(and does not begin with `/', `./' or `../'), each component of the variable
|
|
2275 |
\fBcdpath\fR is checked to see if it has a subdirectory \fIname\fR. Finally, if
|
|
2276 |
all else fails but \fIname\fR is a shell variable whose value
|
|
2277 |
begins with `/', then this is tried to see if it is a directory.
|
|
2278 |
.RS +8
|
|
2279 |
.PP
|
|
2280 |
With \fB\-p\fR, prints the final directory stack, just like \fIdirs\fR.
|
|
2281 |
The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIcd\fR
|
|
2282 |
as on \fIdirs\fR, and they imply \fB\-p\fR. (+)
|
|
2283 |
.PP
|
|
2284 |
See also the \fBimplicitcd\fR shell variable.
|
|
2285 |
.RE
|
|
2286 |
.TP 8
|
|
2287 |
.B chdir
|
|
2288 |
A synonym for the \fIcd\fR builtin command.
|
|
2289 |
.TP 8
|
|
2290 |
.B complete \fR[\fIcommand\fR [\fIword\fB/\fIpattern\fB/\fIlist\fR[\fB:\fIselect\fR]\fB/\fR[[\fIsuffix\fR]\fB/\fR] ...]] (+)
|
|
2291 |
Without arguments, lists all completions.
|
|
2292 |
With \fIcommand\fR, lists completions for \fIcommand\fR.
|
|
2293 |
With \fIcommand\fR and \fIword\fR etc., defines completions.
|
|
2294 |
.RS +8
|
|
2295 |
.PP
|
|
2296 |
\fIcommand\fR may be a full command name or a glob-pattern
|
|
2297 |
(see \fBFilename substitution\fR). It can begin with `\-' to indicate that
|
|
2298 |
completion should be used only when \fIcommand\fR is ambiguous.
|
|
2299 |
.PP
|
|
2300 |
\fIword\fR specifies which word relative to the current word
|
|
2301 |
is to be completed, and may be one of the following:
|
|
2302 |
.PP
|
|
2303 |
.PD 0
|
|
2304 |
.RS +4
|
|
2305 |
.TP 4
|
|
2306 |
.B c
|
|
2307 |
Current-word completion.
|
|
2308 |
\fIpattern\fR is a glob-pattern which must match the beginning of the current word on
|
|
2309 |
the command line. \fIpattern\fR is ignored when completing the current word.
|
|
2310 |
.TP 4
|
|
2311 |
.B C
|
|
2312 |
Like \fBc\fR, but includes \fIpattern\fR when completing the current word.
|
|
2313 |
.TP 4
|
|
2314 |
.B n
|
|
2315 |
Next-word completion.
|
|
2316 |
\fIpattern\fR is a glob-pattern which must match the beginning of the previous word on
|
|
2317 |
the command line.
|
|
2318 |
.TP 4
|
|
2319 |
.B N
|
|
2320 |
Like \fBn\fR, but must match the beginning of the word two before the current word.
|
|
2321 |
.TP 4
|
|
2322 |
.B p
|
|
2323 |
Position-dependent completion.
|
|
2324 |
\fIpattern\fR is a numeric range, with the same syntax used to index shell
|
|
2325 |
variables, which must include the current word.
|
|
2326 |
.PD
|
|
2327 |
.RE
|
|
2328 |
.PP
|
|
2329 |
\fIlist\fR, the list of possible completions, may be one of the following:
|
|
2330 |
.PP
|
|
2331 |
.PD 0
|
|
2332 |
.RS +4
|
|
2333 |
.TP 8
|
|
2334 |
.B a
|
|
2335 |
Aliases
|
|
2336 |
.TP 8
|
|
2337 |
.B b
|
|
2338 |
Bindings (editor commands)
|
|
2339 |
.TP 8
|
|
2340 |
.B c
|
|
2341 |
Commands (builtin or external commands)
|
|
2342 |
.TP 8
|
|
2343 |
.B C
|
|
2344 |
External commands which begin with the supplied path prefix
|
|
2345 |
.TP 8
|
|
2346 |
.B d
|
|
2347 |
Directories
|
|
2348 |
.TP 8
|
|
2349 |
.B D
|
|
2350 |
Directories which begin with the supplied path prefix
|
|
2351 |
.TP 8
|
|
2352 |
.B e
|
|
2353 |
Environment variables
|
|
2354 |
.TP 8
|
|
2355 |
.B f
|
|
2356 |
Filenames
|
|
2357 |
.TP 8
|
|
2358 |
.B F
|
|
2359 |
Filenames which begin with the supplied path prefix
|
|
2360 |
.TP 8
|
|
2361 |
.B g
|
|
2362 |
Groupnames
|
|
2363 |
.TP 8
|
|
2364 |
.B j
|
|
2365 |
Jobs
|
|
2366 |
.TP 8
|
|
2367 |
.B l
|
|
2368 |
Limits
|
|
2369 |
.TP 8
|
|
2370 |
.B n
|
|
2371 |
Nothing
|
|
2372 |
.TP 8
|
|
2373 |
.B s
|
|
2374 |
Shell variables
|
|
2375 |
.TP 8
|
|
2376 |
.B S
|
|
2377 |
Signals
|
|
2378 |
.TP 8
|
|
2379 |
.B t
|
|
2380 |
Plain (``text'') files
|
|
2381 |
.TP 8
|
|
2382 |
.B T
|
|
2383 |
Plain (``text'') files which begin with the supplied path prefix
|
|
2384 |
.TP 8
|
|
2385 |
.B v
|
|
2386 |
Any variables
|
|
2387 |
.TP 8
|
|
2388 |
.B u
|
|
2389 |
Usernames
|
|
2390 |
.TP 8
|
|
2391 |
.B x
|
|
2392 |
Like \fBn\fR, but prints \fIselect\fR when \fIlist-choices\fR is used.
|
|
2393 |
.TP 8
|
|
2394 |
.B X
|
|
2395 |
Completions
|
|
2396 |
.TP 8
|
|
2397 |
$\fIvar\fR
|
|
2398 |
Words from the variable \fIvar\fR
|
|
2399 |
.TP 8
|
|
2400 |
(...)
|
|
2401 |
Words from the given list
|
|
2402 |
.TP 8
|
|
2403 |
`...`
|
|
2404 |
Words from the output of command
|
|
2405 |
.PD
|
|
2406 |
.RE
|
|
2407 |
.PP
|
|
2408 |
\fIselect\fR is an optional glob-pattern.
|
|
2409 |
If given, words from only \fIlist\fR that match \fIselect\fR are considered
|
|
2410 |
and the \fBfignore\fR shell variable is ignored.
|
|
2411 |
The last three types of completion may not have a \fIselect\fR
|
|
2412 |
pattern, and \fBx\fR uses \fIselect\fR as an explanatory message when
|
|
2413 |
the \fIlist-choices\fR editor command is used.
|
|
2414 |
.PP
|
|
2415 |
\fIsuffix\fR is a single character to be appended to a successful
|
|
2416 |
completion. If null, no character is appended. If omitted (in which
|
|
2417 |
case the fourth delimiter can also be omitted), a slash is appended to
|
|
2418 |
directories and a space to other words.
|
|
2419 |
.PP
|
|
2420 |
\fIcommand\fR invoked from `...` version has additional environment
|
|
2421 |
variable set, the variable name is \%\fBCOMMAND_LINE\fR\% and
|
|
2422 |
contains (as its name indicates) contents of the current (already
|
|
2423 |
typed in) command line. One can examine and use contents of the
|
|
2424 |
\%\fBCOMMAND_LINE\fR\% variable in her custom script to build more
|
|
2425 |
sophisticated completions (see completion for svn(1) included in
|
|
2426 |
this package).
|
|
2427 |
.PP
|
|
2428 |
Now for some examples. Some commands take only directories as arguments,
|
|
2429 |
so there's no point completing plain files.
|
|
2430 |
.IP "" 4
|
|
2431 |
> complete cd 'p/1/d/'
|
|
2432 |
.PP
|
|
2433 |
completes only the first word following `cd' (`p/1') with a directory.
|
|
2434 |
\fBp\fR-type completion can also be used to narrow down command completion:
|
|
2435 |
.IP "" 4
|
|
2436 |
> co[^D]
|
|
2437 |
.br
|
|
2438 |
complete compress
|
|
2439 |
.br
|
|
2440 |
> complete \-co* 'p/0/(compress)/'
|
|
2441 |
.br
|
|
2442 |
> co[^D]
|
|
2443 |
.br
|
|
2444 |
> compress
|
|
2445 |
.PP
|
|
2446 |
This completion completes commands (words in position 0, `p/0')
|
|
2447 |
which begin with `co' (thus matching `co*') to `compress' (the only
|
|
2448 |
word in the list).
|
|
2449 |
The leading `\-' indicates that this completion is to be used with only
|
|
2450 |
ambiguous commands.
|
|
2451 |
.IP "" 4
|
|
2452 |
> complete find 'n/\-user/u/'
|
|
2453 |
.PP
|
|
2454 |
is an example of \fBn\fR-type completion. Any word following `find' and
|
|
2455 |
immediately following `\-user' is completed from the list of users.
|
|
2456 |
.IP "" 4
|
|
2457 |
> complete cc 'c/\-I/d/'
|
|
2458 |
.PP
|
|
2459 |
demonstrates \fBc\fR-type completion. Any word following `cc' and beginning
|
|
2460 |
with `\-I' is completed as a directory. `\-I' is not taken as part of the
|
|
2461 |
directory because we used lowercase \fBc\fR.
|
|
2462 |
.PP
|
|
2463 |
Different \fIlist\fRs are useful with different commands.
|
|
2464 |
.IP "" 4
|
|
2465 |
> complete alias 'p/1/a/'
|
|
2466 |
.br
|
|
2467 |
> complete man 'p/*/c/'
|
|
2468 |
.br
|
|
2469 |
> complete set 'p/1/s/'
|
|
2470 |
.br
|
|
2471 |
> complete true 'p/1/x:Truth has no options./'
|
|
2472 |
.PP
|
|
2473 |
These complete words following `alias' with aliases, `man' with commands,
|
|
2474 |
and `set' with shell variables.
|
|
2475 |
`true' doesn't have any options, so \fBx\fR does nothing when completion
|
|
2476 |
is attempted and prints `Truth has no options.' when completion choices are listed.
|
|
2477 |
.PP
|
|
2478 |
Note that the \fIman\fR example, and several other examples below, could
|
|
2479 |
just as well have used 'c/*' or 'n/*' as 'p/*'.
|
|
2480 |
.PP
|
|
2481 |
Words can be completed from a variable evaluated at completion time,
|
|
2482 |
.IP "" 4
|
|
2483 |
> complete ftp 'p/1/$hostnames/'
|
|
2484 |
.br
|
|
2485 |
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
|
|
2486 |
.br
|
|
2487 |
> ftp [^D]
|
|
2488 |
.br
|
|
2489 |
rtfm.mit.edu tesla.ee.cornell.edu
|
|
2490 |
.br
|
|
2491 |
> ftp [^C]
|
|
2492 |
.br
|
|
2493 |
> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
|
|
2494 |
.br
|
|
2495 |
> ftp [^D]
|
|
2496 |
.br
|
|
2497 |
rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
|
|
2498 |
.PP
|
|
2499 |
or from a command run at completion time:
|
|
2500 |
.IP "" 4
|
|
2501 |
> complete kill 'p/*/`ps | awk \\{print\\ \\$1\\}`/'
|
|
2502 |
.br
|
|
2503 |
> kill \-9 [^D]
|
|
2504 |
.br
|
|
2505 |
23113 23377 23380 23406 23429 23529 23530 PID
|
|
2506 |
.PP
|
|
2507 |
Note that the \fIcomplete\fR command does not itself quote its arguments,
|
|
2508 |
so the braces, space and `$' in `{print $1}' must be quoted explicitly.
|
|
2509 |
.PP
|
|
2510 |
One command can have multiple completions:
|
|
2511 |
.IP "" 4
|
|
2512 |
> complete dbx 'p/2/(core)/' 'p/*/c/'
|
|
2513 |
.PP
|
|
2514 |
completes the second argument to `dbx' with the word `core' and all other
|
|
2515 |
arguments with commands. Note that the positional completion is specified
|
|
2516 |
before the next-word completion.
|
|
2517 |
Because completions are evaluated from left to right, if
|
|
2518 |
the next-word completion were specified first it would always match
|
|
2519 |
and the positional completion would never be executed. This is a
|
|
2520 |
common mistake when defining a completion.
|
|
2521 |
.PP
|
|
2522 |
The \fIselect\fR pattern is useful when a command takes files with only
|
|
2523 |
particular forms as arguments. For example,
|
|
2524 |
.IP "" 4
|
|
2525 |
> complete cc 'p/*/f:*.[cao]/'
|
|
2526 |
.PP
|
|
2527 |
completes `cc' arguments to files ending in only `.c', `.a', or `.o'.
|
|
2528 |
\fIselect\fR can also exclude files, using negation of a glob-pattern as
|
|
2529 |
described under \fBFilename substitution\fR. One might use
|
|
2530 |
.IP "" 4
|
|
2531 |
> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
|
|
2532 |
.PP
|
|
2533 |
to exclude precious source code from `rm' completion. Of course, one
|
|
2534 |
could still type excluded names manually or override the completion
|
|
2535 |
mechanism using the \fIcomplete-word-raw\fR or \fIlist-choices-raw\fR
|
|
2536 |
editor commands (q.v.).
|
|
2537 |
.PP
|
|
2538 |
The `C', `D', `F' and `T' \fIlist\fRs are like `c', `d', `f' and `t'
|
|
2539 |
respectively, but they use the \fIselect\fR argument in a different way: to
|
|
2540 |
restrict completion to files beginning with a particular path prefix. For
|
|
2541 |
example, the Elm mail program uses `=' as an abbreviation for one's mail
|
|
2542 |
directory. One might use
|
|
2543 |
.IP "" 4
|
|
2544 |
> complete elm c@=@F:$HOME/Mail/@
|
|
2545 |
.PP
|
|
2546 |
to complete `elm \-f =' as if it were `elm \-f ~/Mail/'. Note that we used `@'
|
|
2547 |
instead of `/' to avoid confusion with the \fIselect\fR argument, and we used
|
|
2548 |
`$HOME' instead of `~' because home directory substitution works at only the
|
|
2549 |
beginning of a word.
|
|
2550 |
.PP
|
|
2551 |
\fIsuffix\fR is used to add a nonstandard suffix
|
|
2552 |
(not space or `/' for directories) to completed words.
|
|
2553 |
.IP "" 4
|
|
2554 |
> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
|
|
2555 |
.PP
|
|
2556 |
completes arguments to `finger' from the list of users, appends an `@',
|
|
2557 |
and then completes after the `@' from the `hostnames' variable. Note
|
|
2558 |
again the order in which the completions are specified.
|
|
2559 |
.PP
|
|
2560 |
Finally, here's a complex example for inspiration:
|
|
2561 |
.IP "" 4
|
|
2562 |
> complete find \\
|
|
2563 |
.br
|
|
2564 |
\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
|
|
2565 |
.br
|
|
2566 |
\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
|
|
2567 |
.br
|
|
2568 |
\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
|
|
2569 |
.br
|
|
2570 |
\&'n/\-type/(b c d f l p s)/' \e
|
|
2571 |
.br
|
|
2572 |
\'c/\-/(name newer cpio ncpio exec ok user \e
|
|
2573 |
.br
|
|
2574 |
group fstype type atime ctime depth inum \e
|
|
2575 |
.br
|
|
2576 |
ls mtime nogroup nouser perm print prune \e
|
|
2577 |
.br
|
|
2578 |
size xdev)/' \e
|
|
2579 |
.br
|
|
2580 |
\&'p/*/d/'
|
|
2581 |
.PP
|
|
2582 |
This completes words following `\-name', `\-newer', `\-cpio' or `ncpio'
|
|
2583 |
(note the pattern which matches both) to files,
|
|
2584 |
words following `\-exec' or `\-ok' to commands, words following `user'
|
|
2585 |
and `group' to users and groups respectively
|
|
2586 |
and words following `\-fstype' or `\-type' to members of the
|
|
2587 |
given lists. It also completes the switches themselves from the given list
|
|
2588 |
(note the use of \fBc\fR-type completion)
|
|
2589 |
and completes anything not otherwise completed to a directory. Whew.
|
|
2590 |
.PP
|
|
2591 |
Remember that programmed completions are ignored if the word being completed
|
|
2592 |
is a tilde substitution (beginning with `~') or a variable (beginning with `$').
|
|
2593 |
\fIcomplete\fR is an experimental feature, and the syntax may change
|
|
2594 |
in future versions of the shell.
|
|
2595 |
See also the \fIuncomplete\fR builtin command.
|
|
2596 |
.RE
|
|
2597 |
.TP 8
|
|
2598 |
.B continue
|
|
2599 |
Continues execution of the nearest enclosing \fIwhile\fR or \fIforeach\fR.
|
|
2600 |
The rest of the commands on the current line are executed.
|
|
2601 |
.TP 8
|
|
2602 |
.B default:
|
|
2603 |
Labels the default case in a \fIswitch\fR statement.
|
|
2604 |
It should come after all \fIcase\fR labels.
|
|
2605 |
.PP
|
|
2606 |
.B dirs \fR[\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR]
|
|
2607 |
.br
|
|
2608 |
.B dirs \-S\fR|\fB\-L \fR[\fIfilename\fR] (+)
|
|
2609 |
.PD 0
|
|
2610 |
.TP 8
|
|
2611 |
.B dirs \-c \fR(+)
|
|
2612 |
The first form prints the directory stack. The top of the stack is at the
|
|
2613 |
left and the first directory in the stack is the current directory.
|
|
2614 |
With \fB\-l\fR, `~' or `~\fIname\fP' in the output is expanded explicitly
|
|
2615 |
to \fBhome\fR or the pathname of the home directory for user \fIname\fP. (+)
|
|
2616 |
With \fB\-n\fR, entries are wrapped before they reach the edge of the screen. (+)
|
|
2617 |
With \fB\-v\fR, entries are printed one per line, preceded by their stack positions. (+)
|
|
2618 |
If more than one of \fB\-n\fR or \fB\-v\fR is given, \fB\-v\fR takes precedence.
|
|
2619 |
\fB\-p\fR is accepted but does nothing.
|
|
2620 |
.PD
|
|
2621 |
.RS +8
|
|
2622 |
.PP
|
|
2623 |
With \fB\-S\fR, the second form saves the directory stack to \fIfilename\fR
|
|
2624 |
as a series of \fIcd\fR and \fIpushd\fR commands.
|
|
2625 |
With \fB\-L\fR, the shell sources \fIfilename\fR, which is presumably
|
|
2626 |
a directory stack file saved by the \fB\-S\fR option or the \fBsavedirs\fR
|
|
2627 |
mechanism.
|
|
2628 |
In either case, \fBdirsfile\fR is used if \fIfilename\fR is not given and
|
|
2629 |
\fI~/.cshdirs\fR is used if \fBdirsfile\fR is unset.
|
|
2630 |
.PP
|
|
2631 |
Note that login shells do the equivalent of `dirs \-L' on startup
|
|
2632 |
and, if \fBsavedirs\fR is set, `dirs \-S' before exiting.
|
|
2633 |
Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.cshdirs\fR,
|
|
2634 |
\fBdirsfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR.
|
|
2635 |
.PP
|
|
2636 |
The last form clears the directory stack.
|
|
2637 |
.RE
|
|
2638 |
.TP 8
|
|
2639 |
.B echo \fR[\fB\-n\fR] \fIword\fR ...
|
|
2640 |
Writes each \fIword\fR to the shell's standard
|
|
2641 |
output, separated by spaces and terminated with a newline.
|
|
2642 |
The \fBecho_style\fR shell variable may be set to emulate (or not) the flags and escape
|
|
2643 |
sequences of the BSD and/or System V versions of \fIecho\fR; see \fIecho\fR(1).
|
|
2644 |
.TP 8
|
|
2645 |
.B echotc \fR[\fB\-sv\fR] \fIarg\fR ... (+)
|
|
2646 |
Exercises the terminal capabilities (see \fIterminfo\fR(4)) in \fIargs\fR.
|
|
2647 |
For example, 'echotc home' sends the cursor to the home position,
|
|
2648 |
\&'echotc cm 3 10' sends it to column 3 and row 10, and
|
|
2649 |
\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
|
|
2650 |
in the status line.
|
|
2651 |
.RS +8
|
|
2652 |
.PP
|
|
2653 |
If \fIarg\fR is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
|
|
2654 |
value of that capability ("yes" or "no" indicating that the terminal does
|
|
2655 |
or does not have that capability). One might use this to make the output
|
|
2656 |
from a shell script less verbose on slow terminals, or limit command
|
|
2657 |
output to the number of lines on the screen:
|
|
2658 |
.IP "" 4
|
|
2659 |
> set history=`echotc lines`
|
|
2660 |
.br
|
|
2661 |
> @ history\-\-
|
|
2662 |
.PP
|
|
2663 |
Termcap strings may contain wildcards which will not echo correctly.
|
|
2664 |
One should use double quotes when setting a shell variable to a terminal
|
|
2665 |
capability string, as in the following example that places the date in
|
|
2666 |
the status line:
|
|
2667 |
.IP "" 4
|
|
2668 |
> set tosl="`echotc ts 0`"
|
|
2669 |
.br
|
|
2670 |
> set frsl="`echotc fs`"
|
|
2671 |
.br
|
|
2672 |
> echo \-n "$tosl";date; echo \-n "$frsl"
|
|
2673 |
.PP
|
|
2674 |
With \fB\-s\fR, nonexistent capabilities return the empty string rather
|
|
2675 |
than causing an error.
|
|
2676 |
With \fB\-v\fR, messages are verbose.
|
|
2677 |
.RE
|
|
2678 |
.PP
|
|
2679 |
.B else
|
|
2680 |
.br
|
|
2681 |
.B end
|
|
2682 |
.br
|
|
2683 |
.B endif
|
|
2684 |
.PD 0
|
|
2685 |
.TP 8
|
|
2686 |
.B endsw
|
|
2687 |
See the description of the \fIforeach\fR, \fIif\fR, \fIswitch\fR, and
|
|
2688 |
\fIwhile\fR statements below.
|
|
2689 |
.PD
|
|
2690 |
.TP 8
|
|
2691 |
.B eval \fIarg\fR ...
|
|
2692 |
Treats the arguments as input to the
|
|
2693 |
shell and executes the resulting command(s) in the context
|
|
2694 |
of the current shell. This is usually used to execute commands
|
|
2695 |
generated as the result of command or variable substitution,
|
|
2696 |
because parsing occurs before these substitutions.
|
|
2697 |
See \fItset\fR(1B) for a sample use of \fIeval\fR.
|
|
2698 |
.TP 8
|
|
2699 |
.B exec \fIcommand\fR
|
|
2700 |
Executes the specified command in place of the current shell.
|
|
2701 |
.TP 8
|
|
2702 |
.B exit \fR[\fIexpr\fR]
|
|
2703 |
The shell exits either with the value of the specified \fIexpr\fR
|
|
2704 |
(an expression, as described under \fBExpressions\fR)
|
|
2705 |
or, without \fIexpr\fR, with the value 0.
|
|
2706 |
.TP 8
|
|
2707 |
.B fg \fR[\fB%\fIjob\fR ...]
|
|
2708 |
Brings the specified jobs (or, without arguments, the current job)
|
|
2709 |
into the foreground, continuing each if it is stopped.
|
|
2710 |
\fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
|
|
2711 |
under \fBJobs\fR.
|
|
2712 |
See also the \fIrun-fg-editor\fR editor command.
|
|
2713 |
.TP 8
|
|
2714 |
.B filetest \-\fIop file\fR ... (+)
|
|
2715 |
Applies \fIop\fR (which is a file inquiry operator as described under
|
|
2716 |
\fBFile inquiry operators\fR) to each \fIfile\fR and returns the results as a
|
|
2717 |
space-separated list.
|
|
2718 |
.PP
|
|
2719 |
.B foreach \fIname \fB(\fIwordlist\fB)
|
|
2720 |
.br
|
|
2721 |
\&...
|
|
2722 |
.PD 0
|
|
2723 |
.TP 8
|
|
2724 |
.B end
|
|
2725 |
Successively sets the variable \fIname\fR to each member of
|
|
2726 |
\fIwordlist\fR and executes the sequence of commands between this command
|
|
2727 |
and the matching \fIend\fR. (Both \fIforeach\fR and \fIend\fR
|
|
2728 |
must appear alone on separate lines.) The builtin command
|
|
2729 |
\fIcontinue\fR may be used to continue the loop prematurely and
|
|
2730 |
the builtin command \fIbreak\fR to terminate it prematurely.
|
|
2731 |
When this command is read from the terminal, the loop is read once
|
|
2732 |
prompting with `foreach? ' (or \fBprompt2\fR) before any statements in
|
|
2733 |
the loop are executed. If you make a mistake typing in a
|
|
2734 |
loop at the terminal you can rub it out.
|
|
2735 |
.PD
|
|
2736 |
.TP 8
|
|
2737 |
.B getspath \fR(+)
|
|
2738 |
Prints the system execution path. (TCF only)
|
|
2739 |
.TP 8
|
|
2740 |
.B getxvers \fR(+)
|
|
2741 |
Prints the experimental version prefix. (TCF only)
|
|
2742 |
.TP 8
|
|
2743 |
.B glob \fIwordlist
|
|
2744 |
Like \fIecho\fR, but the `-n' parameter is not recognized and words are
|
|
2745 |
delimited by null characters in the output. Useful for
|
|
2746 |
programs which wish to use the shell to filename expand a list of words.
|
|
2747 |
.TP 8
|
|
2748 |
.B goto \fIword
|
|
2749 |
\fIword\fR is filename and command-substituted to
|
|
2750 |
yield a string of the form `label'. The shell rewinds its
|
|
2751 |
input as much as possible, searches for a line of the
|
|
2752 |
form `label:', possibly preceded by blanks or tabs, and
|
|
2753 |
continues execution after that line.
|
|
2754 |
.TP 8
|
|
2755 |
.B hashstat
|
|
2756 |
Prints a statistics line indicating how effective the
|
|
2757 |
internal hash table has been at locating commands (and avoiding
|
|
2758 |
\fIexec\fR's). An \fIexec\fR is attempted for each component of the
|
|
2759 |
\fBpath\fR where the hash function indicates a possible hit, and
|
|
2760 |
in each component which does not begin with a `/'.
|
|
2761 |
.IP
|
|
2762 |
On machines without \fIvfork\fR(2), prints only the number and size of
|
|
2763 |
hash buckets.
|
|
2764 |
.PP
|
|
2765 |
.B history \fR[\fB\-hTr\fR] [\fIn\fR]
|
|
2766 |
.br
|
|
2767 |
.B history \-S\fR|\fB\-L|\fB\-M \fR[\fIfilename\fR] (+)
|
|
2768 |
.PD 0
|
|
2769 |
.TP 8
|
|
2770 |
.B history \-c \fR(+)
|
|
2771 |
The first form prints the history event list.
|
|
2772 |
If \fIn\fR is given only the \fIn\fR most recent events are printed or saved.
|
|
2773 |
With \fB\-h\fR, the history list is printed without leading numbers. If
|
|
2774 |
\fB-T\fR is specified, timestamps are printed also in comment form.
|
|
2775 |
(This can be used to
|
|
2776 |
produce files suitable for loading with 'history \-L' or 'source \-h'.)
|
|
2777 |
With \fB\-r\fR, the order of printing is most recent
|
|
2778 |
first rather than oldest first.
|
|
2779 |
.PD
|
|
2780 |
.RS +8
|
|
2781 |
.PP
|
|
2782 |
With \fB\-S\fR, the second form saves the history list to \fIfilename\fR.
|
|
2783 |
If the first word of the \fBsavehist\fR shell variable is set to a
|
|
2784 |
number, at most that many lines are saved. If the second word of
|
|
2785 |
\fBsavehist\fR is set to `merge', the history list is merged with the
|
|
2786 |
existing history file instead of replacing it (if there is one) and
|
|
2787 |
sorted by time stamp. (+) Merging is intended for an environment like
|
|
2788 |
the X Window System
|
|
2789 |
with several shells in simultaneous use. Currently it succeeds
|
|
2790 |
only when the shells quit nicely one after another.
|
|
2791 |
.PP
|
|
2792 |
With \fB\-L\fR, the shell appends \fIfilename\fR, which is presumably a
|
|
2793 |
history list saved by the \fB\-S\fR option or the \fBsavehist\fR mechanism,
|
|
2794 |
to the history list.
|
|
2795 |
\fB\-M\fR is like \fB\-L\fR, but the contents of \fIfilename\fR are merged
|
|
2796 |
into the history list and sorted by timestamp.
|
|
2797 |
In either case, \fBhistfile\fR is used if \fIfilename\fR is not given and
|
|
2798 |
\fI~/.history\fR is used if \fBhistfile\fR is unset.
|
|
2799 |
`history \-L' is exactly like 'source \-h' except that it does not require a
|
|
2800 |
filename.
|
|
2801 |
.PP
|
|
2802 |
Note that login shells do the equivalent of `history \-L' on startup
|
|
2803 |
and, if \fBsavehist\fR is set, `history \-S' before exiting.
|
|
2804 |
Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.history\fR,
|
|
2805 |
\fBhistfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR.
|
|
2806 |
.PP
|
|
2807 |
If \fBhistlit\fR is set, the first and second forms print and save the literal
|
|
2808 |
(unexpanded) form of the history list.
|
|
2809 |
.PP
|
|
2810 |
The last form clears the history list.
|
|
2811 |
.RE
|
|
2812 |
.TP 8
|
|
2813 |
.B hup \fR[\fIcommand\fR] \fR(+)
|
|
2814 |
With \fIcommand\fR, runs \fIcommand\fR such that it will exit on a hangup
|
|
2815 |
signal and arranges for the shell to send it a hangup signal when the shell
|
|
2816 |
exits.
|
|
2817 |
Note that commands may set their own response to hangups, overriding \fIhup\fR.
|
|
2818 |
Without an argument (allowed in only a shell script), causes the shell to
|
|
2819 |
exit on a hangup for the remainder of the script.
|
|
2820 |
See also \fBSignal handling\fR and the \fInohup\fR builtin command.
|
|
2821 |
.TP 8
|
|
2822 |
.B if (\fIexpr\fB) \fIcommand
|
|
2823 |
If \fIexpr\fR (an expression, as described under \fBExpressions\fR)
|
|
2824 |
evaluates true, then \fIcommand\fR is executed.
|
|
2825 |
Variable substitution on \fIcommand\fR happens early, at the same time it
|
|
2826 |
does for the rest of the \fIif\fR command.
|
|
2827 |
\fIcommand\fR must be a simple command, not an alias, a pipeline, a command list
|
|
2828 |
or a parenthesized command list, but it may have arguments.
|
|
2829 |
Input/output redirection occurs even if \fIexpr\fR is
|
|
2830 |
false and \fIcommand\fR is thus \fInot\fR executed; this is a bug.
|
|
2831 |
.PP
|
|
2832 |
.B if (\fIexpr\fB) then
|
|
2833 |
.br
|
|
2834 |
\&...
|
|
2835 |
.br
|
|
2836 |
.B else if (\fIexpr2\fB) then
|
|
2837 |
.br
|
|
2838 |
\&...
|
|
2839 |
.br
|
|
2840 |
.B else
|
|
2841 |
.br
|
|
2842 |
\&...
|
|
2843 |
.PD 0
|
|
2844 |
.TP 8
|
|
2845 |
.B endif
|
|
2846 |
If the specified \fIexpr\fR is true then the commands to the
|
|
2847 |
first \fIelse\fR are executed; otherwise if \fIexpr2\fR is true then
|
|
2848 |
the commands to the second \fIelse\fR are executed, etc. Any
|
|
2849 |
number of \fIelse-if\fR pairs are possible; only one \fIendif\fR is
|
|
2850 |
needed. The \fIelse\fR part is likewise optional. (The words
|
|
2851 |
\fIelse\fR and \fIendif\fR must appear at the beginning of input lines;
|
|
2852 |
the \fIif\fR must appear alone on its input line or after an
|
|
2853 |
\fIelse\fR.)
|
|
2854 |
.PD
|
|
2855 |
.TP 8
|
|
2856 |
.B inlib \fIshared-library\fR ... (+)
|
|
2857 |
Adds each \fIshared-library\fR to the current environment. There is no way
|
|
2858 |
to remove a shared library. (Domain/OS only)
|
|
2859 |
.TP 8
|
|
2860 |
.B jobs \fR[\fB\-l\fR]
|
|
2861 |
Lists the active jobs. With \fB\-l\fR, lists process
|
|
2862 |
IDs in addition to the normal information. On TCF systems, prints
|
|
2863 |
the site on which each job is executing.
|
|
2864 |
.PP
|
|
2865 |
.PD 0
|
|
2866 |
.TP 8
|
|
2867 |
.B kill \fR[\fB\-s \fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ...
|
|
2868 |
.PD 0
|
|
2869 |
.TP 8
|
|
2870 |
.B kill \-l
|
|
2871 |
The first and second forms sends the specified \fIsignal\fR (or, if none
|
|
2872 |
is given, the TERM (terminate) signal) to the specified jobs or processes.
|
|
2873 |
\fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
|
|
2874 |
under \fBJobs\fR.
|
|
2875 |
Signals are either given by number or by name (as given in
|
|
2876 |
\fI/usr/include/signal.h\fR, stripped of the prefix `SIG').
|
|
2877 |
There is no default \fIjob\fR; saying just `kill' does not send a signal
|
|
2878 |
to the current job. If the signal being sent is TERM (terminate)
|
|
2879 |
or HUP (hangup), then the job or process is sent a
|
|
2880 |
CONT (continue) signal as well.
|
|
2881 |
The third form lists the signal names.
|
|
2882 |
.PD
|
|
2883 |
.TP 8
|
|
2884 |
.B limit \fR[\fB\-h\fR] [\fIresource\fR [\fImaximum-use\fR]]
|
|
2885 |
Limits the consumption by the current process and each
|
|
2886 |
process it creates to not individually exceed \fImaximum-use\fR on
|
|
2887 |
the specified \fIresource\fR. If no \fImaximum-use\fR is given, then
|
|
2888 |
the current limit is printed; if no \fIresource\fR is given, then
|
|
2889 |
all limitations are given. If the \fB\-h\fR flag is given, the
|
|
2890 |
hard limits are used instead of the current limits. The
|
|
2891 |
hard limits impose a ceiling on the values of the current
|
|
2892 |
limits. Only the super-user may raise the hard limits, but
|
|
2893 |
a user may lower or raise the current limits within the legal range.
|
|
2894 |
.RS +8
|
|
2895 |
.PP
|
|
2896 |
Controllable resources currently include (if supported by the OS):
|
|
2897 |
.TP
|
|
2898 |
\fIcputime\fR
|
|
2899 |
the maximum number of cpu-seconds to be used by each process
|
|
2900 |
.TP
|
|
2901 |
\fIfilesize\fR
|
|
2902 |
the largest single file which can be created
|
|
2903 |
.TP
|
|
2904 |
\fIdatasize\fR
|
|
2905 |
the maximum growth of the data+stack region via sbrk(2) beyond
|
|
2906 |
the end of the program text
|
|
2907 |
.TP
|
|
2908 |
\fIstacksize\fR
|
|
2909 |
the maximum size of the automatically-extended stack region
|
|
2910 |
.TP
|
|
2911 |
\fIcoredumpsize\fR
|
|
2912 |
the size of the largest core dump that will be created
|
|
2913 |
.TP
|
|
2914 |
\fImemoryuse\fR
|
|
2915 |
the maximum amount of physical memory a process
|
|
2916 |
may have allocated to it at a given time
|
|
2917 |
.TP
|
|
2918 |
\fIheapsize\fR
|
|
2919 |
the maximum amount of memory a process
|
|
2920 |
may allocate per \fIbrk()\fR system call
|
|
2921 |
.TP
|
|
2922 |
\fIdescriptors\fR or \fIopenfiles\fR
|
|
2923 |
the maximum number of open files for this process
|
|
2924 |
.TP
|
|
2925 |
\fIconcurrency\fR
|
|
2926 |
the maximum number of threads for this process
|
|
2927 |
.TP
|
|
2928 |
\fImemorylocked\fR
|
|
2929 |
the maximum size which a process may lock into memory using mlock(2)
|
|
2930 |
.TP
|
|
2931 |
\fImaxproc\fR
|
|
2932 |
the maximum number of simultaneous processes for this user id
|
|
2933 |
.TP
|
|
2934 |
\fIsbsize\fR
|
|
2935 |
the maximum size of socket buffer usage for this user
|
|
2936 |
.PP
|
|
2937 |
\fImaximum-use\fR may be given as a (floating point or
|
|
2938 |
integer) number followed by a scale factor. For all limits
|
|
2939 |
other than \fIcputime\fR the default scale is `k' or `kilobytes'
|
|
2940 |
(1024 bytes); a scale factor of `m' or `megabytes' may also
|
|
2941 |
be used. For \fIcputime\fR the default scaling is `seconds',
|
|
2942 |
while `m' for minutes or `h' for hours, or a time of the
|
|
2943 |
form `mm:ss' giving minutes and seconds may be used.
|
|
2944 |
.PP
|
|
2945 |
For both \fIresource\fR names and scale factors, unambiguous
|
|
2946 |
prefixes of the names suffice.
|
|
2947 |
.RE
|
|
2948 |
.TP 8
|
|
2949 |
.B log \fR(+)
|
|
2950 |
Prints the \fBwatch\fR shell variable and reports on each user indicated
|
|
2951 |
in \fBwatch\fR who is logged in, regardless of when they last logged in.
|
|
2952 |
See also \fIwatchlog\fR.
|
|
2953 |
.TP 8
|
|
2954 |
.B login
|
|
2955 |
Terminates a login shell, replacing it with an instance of
|
|
2956 |
\fI/bin/login.\fR This is one way to log off, included for
|
|
2957 |
compatibility with \fIsh\fR(1).
|
|
2958 |
.TP 8
|
|
2959 |
.B logout
|
|
2960 |
Terminates a login shell. Especially useful if \fBignoreeof\fR is set.
|
|
2961 |
.TP 8
|
|
2962 |
.B ls\-F \fR[\-\fIswitch\fR ...] [\fIfile\fR ...] (+)
|
|
2963 |
Lists files like `ls \-F', but much faster. It identifies each type of
|
|
2964 |
special file in the listing with a special character:
|
|
2965 |
.PP
|
|
2966 |
.RS +8
|
|
2967 |
.PD 0
|
|
2968 |
.TP 4
|
|
2969 |
/
|
|
2970 |
Directory
|
|
2971 |
.TP 4
|
|
2972 |
*
|
|
2973 |
Executable
|
|
2974 |
.TP 4
|
|
2975 |
#
|
|
2976 |
Block device
|
|
2977 |
.TP 4
|
|
2978 |
%
|
|
2979 |
Character device
|
|
2980 |
.TP 4
|
|
2981 |
|
|
|
2982 |
Named pipe (systems with named pipes only)
|
|
2983 |
.TP 4
|
|
2984 |
=
|
|
2985 |
Socket (systems with sockets only)
|
|
2986 |
.TP 4
|
|
2987 |
@
|
|
2988 |
Symbolic link (systems with symbolic links only)
|
|
2989 |
.TP 4
|
|
2990 |
+
|
|
2991 |
Hidden directory (AIX only) or context dependent (HP/UX only)
|
|
2992 |
.TP 4
|
|
2993 |
:
|
|
2994 |
Network special (HP/UX only)
|
|
2995 |
.PD
|
|
2996 |
.PP
|
|
2997 |
If the \fBlistlinks\fR shell variable is set, symbolic links are identified
|
|
2998 |
in more detail (on only systems that have them, of course):
|
|
2999 |
.PP
|
|
3000 |
.PD 0
|
|
3001 |
.TP 4
|
|
3002 |
@
|
|
3003 |
Symbolic link to a non-directory
|
|
3004 |
.TP 4
|
|
3005 |
>
|
|
3006 |
Symbolic link to a directory
|
|
3007 |
.TP 4
|
|
3008 |
&
|
|
3009 |
Symbolic link to nowhere
|
|
3010 |
.PD
|
|
3011 |
.PP
|
|
3012 |
\fBlistlinks\fR also slows down \fIls\-F\fR and causes partitions holding
|
|
3013 |
files pointed to by symbolic links to be mounted.
|
|
3014 |
.PP
|
|
3015 |
If the \fBlistflags\fR shell variable is set to `x', `a' or `A', or any
|
|
3016 |
combination thereof (e.g., `xA'), they are used as flags to \fIls\-F\fR,
|
|
3017 |
making it act like `ls \-xF', `ls \-Fa', `ls \-FA' or a combination
|
|
3018 |
(e.g., `ls \-FxA').
|
|
3019 |
On machines where `ls \-C' is not the default, \fIls\-F\fR acts like `ls \-CF',
|
|
3020 |
unless \fBlistflags\fR contains an `x', in which case it acts like `ls \-xF'.
|
|
3021 |
\fIls\-F\fR passes its arguments to \fIls\fR(1) if it is given any switches,
|
|
3022 |
so `alias ls ls\-F' generally does the right thing.
|
|
3023 |
.PP
|
|
3024 |
The \fBls\-F\fR builtin can list files using different colors depending on the
|
|
3025 |
filetype or extension. See the \fBcolor\fR \fItcsh\fR variable and the
|
|
3026 |
\fBLS_COLORS\fR environment variable.
|
|
3027 |
.RE
|
|
3028 |
.PP
|
|
3029 |
.B migrate \fR[\fB\-\fIsite\fR] \fIpid\fR|\fB%\fIjobid\fR ... (+)
|
|
3030 |
.PD 0
|
|
3031 |
.TP 8
|
|
3032 |
.B migrate \-\fIsite\fR (+)
|
|
3033 |
The first form migrates the process or job to the site specified or the
|
|
3034 |
default site determined by the system path.
|
|
3035 |
The second form is equivalent to `migrate \-\fIsite\fR $$': it migrates the
|
|
3036 |
current process to the specified site. Migrating the shell
|
|
3037 |
itself can cause unexpected behavior, because the shell
|
|
3038 |
does not like to lose its tty. (TCF only)
|
|
3039 |
.PD
|
|
3040 |
.TP 8
|
|
3041 |
.B newgrp \fR[\fB\-\fR] \fIgroup\fR (+)
|
|
3042 |
Equivalent to `exec newgrp'; see \fInewgrp\fR(1).
|
|
3043 |
Available only if the shell was so compiled;
|
|
3044 |
see the \fBversion\fR shell variable.
|
|
3045 |
.TP 8
|
|
3046 |
.B nice \fR[\fB+\fInumber\fR] [\fIcommand\fR]
|
|
3047 |
Sets the scheduling priority for the shell to \fInumber\fR, or, without
|
|
3048 |
\fInumber\fR, to 4. With \fIcommand\fR, runs \fIcommand\fR at the appropriate
|
|
3049 |
priority.
|
|
3050 |
The greater the \fInumber\fR, the less cpu
|
|
3051 |
the process gets. The super-user may specify negative
|
|
3052 |
priority by using `nice \-number ...'. Command is always
|
|
3053 |
executed in a sub-shell, and the restrictions placed on
|
|
3054 |
commands in simple \fIif\fR statements apply.
|
|
3055 |
.TP 8
|
|
3056 |
.B nohup \fR[\fIcommand\fR]
|
|
3057 |
With \fIcommand\fR, runs \fIcommand\fR such that it will ignore hangup signals.
|
|
3058 |
Note that commands may set their own response to hangups, overriding \fInohup\fR.
|
|
3059 |
Without an argument (allowed in only a shell script), causes the shell to
|
|
3060 |
ignore hangups for the remainder of the script.
|
|
3061 |
See also \fBSignal handling\fR and the \fIhup\fR builtin command.
|
|
3062 |
.TP 8
|
|
3063 |
.B notify \fR[\fB%\fIjob\fR ...]
|
|
3064 |
Causes the shell to notify the user asynchronously when the status of any
|
|
3065 |
of the specified jobs (or, without %\fIjob\fR, the current job) changes,
|
|
3066 |
instead of waiting until the next prompt as is usual.
|
|
3067 |
\fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
|
|
3068 |
under \fBJobs\fR.
|
|
3069 |
See also the \fBnotify\fR shell variable.
|
|
3070 |
.TP 8
|
|
3071 |
.B onintr \fR[\fB\-\fR|\fIlabel\fR]
|
|
3072 |
Controls the action of the shell on interrupts. Without arguments,
|
|
3073 |
restores the default action of the shell on interrupts,
|
|
3074 |
which is to terminate shell scripts or to return to the
|
|
3075 |
terminal command input level.
|
|
3076 |
With `\-', causes all interrupts to be ignored.
|
|
3077 |
With \fIlabel\fR, causes the shell to execute a `goto \fIlabel\fR'
|
|
3078 |
when an interrupt is received or a child process terminates because it was
|
|
3079 |
interrupted.
|
|
3080 |
.IP "" 8
|
|
3081 |
\fIonintr\fR is ignored if the shell is running detached and in system
|
|
3082 |
startup files (see \fBFILES\fR), where interrupts are disabled anyway.
|
|
3083 |
.TP 8
|
|
3084 |
.B popd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] \fR[\fB+\fIn\fR]
|
|
3085 |
Without arguments, pops the directory stack and returns to the new top directory.
|
|
3086 |
With a number `+\fIn\fR', discards the \fIn\fR'th entry in the stack.
|
|
3087 |
.IP "" 8
|
|
3088 |
Finally, all forms of \fIpopd\fR print the final directory stack,
|
|
3089 |
just like \fIdirs\fR. The \fBpushdsilent\fR shell variable can be set to
|
|
3090 |
prevent this and the \fB\-p\fR flag can be given to override \fBpushdsilent\fR.
|
|
3091 |
The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIpopd\fR
|
|
3092 |
as on \fIdirs\fR. (+)
|
|
3093 |
.TP 8
|
|
3094 |
.B printenv \fR[\fIname\fR] (+)
|
|
3095 |
Prints the names and values of all environment variables or,
|
|
3096 |
with \fIname\fR, the value of the environment variable \fIname\fR.
|
|
3097 |
.TP 8
|
|
3098 |
.B pushd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\fIname\fR|\fB+\fIn\fR]
|
|
3099 |
Without arguments, exchanges the top two elements of the directory stack.
|
|
3100 |
If \fBpushdtohome\fR is set, \fIpushd\fR without arguments does `pushd ~',
|
|
3101 |
like \fIcd\fR. (+)
|
|
3102 |
With \fIname\fR, pushes the current working directory onto the directory
|
|
3103 |
stack and changes to \fIname\fR.
|
|
3104 |
If \fIname\fR is `\-' it is interpreted as the previous working directory
|
|
3105 |
(see \fBFilename substitution\fR). (+)
|
|
3106 |
If \fBdunique\fR is set, \fIpushd\fR removes any instances of \fIname\fR
|
|
3107 |
from the stack before pushing it onto the stack. (+)
|
|
3108 |
With a number `+\fIn\fR', rotates the \fIn\fRth element of the
|
|
3109 |
directory stack around to be the top element and changes to it.
|
|
3110 |
If \fBdextract\fR is set, however, `pushd +\fIn\fR' extracts the \fIn\fRth
|
|
3111 |
directory, pushes it onto the top of the stack and changes to it. (+)
|
|
3112 |
.IP "" 8
|
|
3113 |
Finally, all forms of \fIpushd\fR print the final directory stack,
|
|
3114 |
just like \fIdirs\fR. The \fBpushdsilent\fR shell variable can be set to
|
|
3115 |
prevent this and the \fB\-p\fR flag can be given to override \fBpushdsilent\fR.
|
|
3116 |
The \fB\-l\fR, \fB\-n\fR and \fB\-v\fR flags have the same effect on \fIpushd\fR
|
|
3117 |
as on \fIdirs\fR. (+)
|
|
3118 |
.TP 8
|
|
3119 |
.B rehash
|
|
3120 |
Causes the internal hash table of the contents of the
|
|
3121 |
directories in the \fBpath\fR variable to be recomputed. This is
|
|
3122 |
needed if new commands are added to directories in \fBpath\fR
|
|
3123 |
while you are logged in. This should be necessary only if
|
|
3124 |
you add commands to one of your own directories, or if a
|
|
3125 |
systems programmer changes the contents of one of the
|
|
3126 |
system directories. Also flushes the cache of home directories
|
|
3127 |
built by tilde expansion.
|
|
3128 |
.TP 8
|
|
3129 |
.B repeat \fIcount command
|
|
3130 |
The specified \fIcommand\fR,
|
|
3131 |
which is subject to the same restrictions as the \fIcommand\fR
|
|
3132 |
in the one line \fIif\fR statement above, is executed \fIcount\fR times.
|
|
3133 |
I/O redirections occur exactly once, even if \fIcount\fR is 0.
|
|
3134 |
.TP 8
|
|
3135 |
.B rootnode //\fInodename \fR(+)
|
|
3136 |
Changes the rootnode to //\fInodename\fR, so that `/' will be interpreted
|
|
3137 |
as `//\fInodename\fR'. (Domain/OS only)
|
|
3138 |
.PP
|
|
3139 |
.B sched \fR(+)
|
|
3140 |
.br
|
|
3141 |
.B sched \fR[\fB+\fR]\fIhh:mm command\fR \fR(+)
|
|
3142 |
.PD 0
|
|
3143 |
.TP 8
|
|
3144 |
.B sched \-\fIn\fR (+)
|
|
3145 |
The first form prints the scheduled-event list.
|
|
3146 |
The \fBsched\fR shell variable may be set to define the format in which
|
|
3147 |
the scheduled-event list is printed.
|
|
3148 |
The second form adds \fIcommand\fR to the scheduled-event list.
|
|
3149 |
For example,
|
|
3150 |
.PD
|
|
3151 |
.RS +8
|
|
3152 |
.IP "" 4
|
|
3153 |
> sched 11:00 echo It\\'s eleven o\\'clock.
|
|
3154 |
.PP
|
|
3155 |
causes the shell to echo `It's eleven o'clock.' at 11 AM.
|
|
3156 |
The time may be in 12-hour AM/PM format
|
|
3157 |
.IP "" 4
|
|
3158 |
> sched 5pm set prompt='[%h] It\\'s after 5; go home: >'
|
|
3159 |
.PP
|
|
3160 |
or may be relative to the current time:
|
|
3161 |
.IP "" 4
|
|
3162 |
> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
|
|
3163 |
.PP
|
|
3164 |
A relative time specification may not use AM/PM format.
|
|
3165 |
The third form removes item \fIn\fR from the event list:
|
|
3166 |
.IP "" 4
|
|
3167 |
> sched
|
|
3168 |
.br
|
|
3169 |
1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
|
|
3170 |
.br
|
|
3171 |
2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: >
|
|
3172 |
.br
|
|
3173 |
> sched \-2
|
|
3174 |
.br
|
|
3175 |
> sched
|
|
3176 |
.br
|
|
3177 |
1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
|
|
3178 |
.PP
|
|
3179 |
A command in the scheduled-event list is executed just before the first
|
|
3180 |
prompt is printed after the time when the command is scheduled.
|
|
3181 |
It is possible to miss the exact time when the command is to be run, but
|
|
3182 |
an overdue command will execute at the next prompt.
|
|
3183 |
A command which comes due while the shell
|
|
3184 |
is waiting for user input is executed immediately.
|
|
3185 |
However, normal operation of an already-running command will not
|
|
3186 |
be interrupted so that a scheduled-event list element may be run.
|
|
3187 |
.PP
|
|
3188 |
This mechanism is similar to, but not the same as, the \fIat\fR(1)
|
|
3189 |
command on some Unix systems.
|
|
3190 |
Its major disadvantage is that it may not run a command at exactly the
|
|
3191 |
specified time.
|
|
3192 |
Its major advantage is that because \fIsched\fR runs directly from
|
|
3193 |
the shell, it has access to shell variables and other structures.
|
|
3194 |
This provides a mechanism for changing one's working environment
|
|
3195 |
based on the time of day.
|
|
3196 |
.RE
|
|
3197 |
.PP
|
|
3198 |
.B set
|
|
3199 |
.br
|
|
3200 |
.B set \fIname\fR ...
|
|
3201 |
.br
|
|
3202 |
.B set \fIname\fR\fB=\fIword\fR ...
|
|
3203 |
.br
|
|
3204 |
.B set [\-r] [\-f|\-l] \fIname\fR\fB=(\fIwordlist\fB)\fR ... (+)
|
|
3205 |
.br
|
|
3206 |
.B set \fIname[index]\fR\fB=\fIword\fR ...
|
|
3207 |
.br
|
|
3208 |
.B set \-r \fR(+)
|
|
3209 |
.br
|
|
3210 |
.B set \-r \fIname\fR ... (+)
|
|
3211 |
.PD 0
|
|
3212 |
.TP 8
|
|
3213 |
.B set \-r \fIname\fR\fB=\fIword\fR ... (+)
|
|
3214 |
The first form of the command prints the value of all shell variables.
|
|
3215 |
Variables which contain more than a single word print as a
|
|
3216 |
parenthesized word list.
|
|
3217 |
The second form sets \fIname\fR to the null string.
|
|
3218 |
The third form sets \fIname\fR to the single \fIword\fR.
|
|
3219 |
The fourth form sets \fIname\fR to the list of words in
|
|
3220 |
\fIwordlist\fR. In all cases the value is command and filename expanded.
|
|
3221 |
If \-r is specified, the value is set read-only. If \-f or \-l are
|
|
3222 |
specified, set only unique words keeping their order.
|
|
3223 |
\-f prefers the first occurrence of a word, and \-l the last.
|
|
3224 |
The fifth form sets the \fIindex\fR'th component of name to \fIword\fR;
|
|
3225 |
this component must already exist.
|
|
3226 |
The sixth form lists only the names of all shell variables that are read-only.
|
|
3227 |
The seventh form makes \fIname\fR read-only, whether or not it has a value.
|
|
3228 |
The second form sets \fIname\fR to the null string.
|
|
3229 |
The eighth form is the same as the third form, but
|
|
3230 |
make \fIname\fR read-only at the same time.
|
|
3231 |
.PD
|
|
3232 |
.IP "" 8
|
|
3233 |
These arguments can be repeated to set and/or make read-only multiple variables
|
|
3234 |
in a single set command. Note, however, that variable expansion
|
|
3235 |
happens for all arguments before any setting occurs. Note also that `=' can
|
|
3236 |
be adjacent to both \fIname\fR and \fIword\fR or separated from both by
|
|
3237 |
whitespace, but cannot be adjacent to only one or the other.
|
|
3238 |
See also the \fIunset\fR builtin command.
|
|
3239 |
.TP 8
|
|
3240 |
.B setenv \fR[\fIname \fR[\fIvalue\fR]]
|
|
3241 |
Without arguments, prints the names and values of all environment variables.
|
|
3242 |
Given \fIname\fR, sets the environment variable \fIname\fR to \fIvalue\fR
|
|
3243 |
or, without \fIvalue\fR, to the null string.
|
|
3244 |
.TP 8
|
|
3245 |
.B setpath \fIpath \fR(+)
|
|
3246 |
Equivalent to \fIsetpath\fR(1). (Mach only)
|
|
3247 |
.TP 8
|
|
3248 |
.B setspath\fR LOCAL|\fIsite\fR|\fIcpu\fR ... (+)
|
|
3249 |
Sets the system execution path. (TCF only)
|
|
3250 |
.TP 8
|
|
3251 |
.B settc \fIcap value \fR(+)
|
|
3252 |
Tells the shell to believe that the terminal capability \fIcap\fR
|
|
3253 |
(as defined in \fIterminfo\fR(4)) has the value \fIvalue\fR.
|
|
3254 |
No sanity checking is done.
|
|
3255 |
Concept terminal users may have to `settc xn no' to get proper
|
|
3256 |
wrapping at the rightmost column.
|
|
3257 |
.TP 8
|
|
3258 |
.B setty \fR[\fB\-d\fR|\fB\-q\fR|\fB\-x\fR] [\fB\-a\fR] [[\fB+\fR|\fB\-\fR]\fImode\fR] (+)
|
|
3259 |
Controls which tty modes (see \fBTerminal management\fR)
|
|
3260 |
the shell does not allow to change.
|
|
3261 |
\fB\-d\fR, \fB\-q\fR or \fB\-x\fR tells \fIsetty\fR to act
|
|
3262 |
on the `edit', `quote' or `execute' set of tty modes respectively; without
|
|
3263 |
\fB\-d\fR, \fB\-q\fR or \fB\-x\fR, `execute' is used.
|
|
3264 |
.IP "" 8
|
|
3265 |
Without other arguments, \fIsetty\fR lists the modes in the chosen set
|
|
3266 |
which are fixed on (`+mode') or off (`\-mode').
|
|
3267 |
The available modes, and thus the display, vary from system to system.
|
|
3268 |
With \fB\-a\fR, lists all tty modes in the chosen set
|
|
3269 |
whether or not they are fixed.
|
|
3270 |
With \fB+\fImode\fR, \fB\-\fImode\fR or \fImode\fR, fixes \fImode\fR on or off
|
|
3271 |
or removes control from \fImode\fR in the chosen set.
|
|
3272 |
For example, `setty +echok echoe' fixes `echok' mode on and allows commands
|
|
3273 |
to turn `echoe' mode on or off, both when the shell is executing commands.
|
|
3274 |
.TP 8
|
|
3275 |
.B setxvers\fR [\fIstring\fR] (+)
|
|
3276 |
Set the experimental version prefix to \fIstring\fR, or removes it
|
|
3277 |
if \fIstring\fR is omitted. (TCF only)
|
|
3278 |
.TP 8
|
|
3279 |
.B shift \fR[\fIvariable\fR]
|
|
3280 |
Without arguments, discards \fBargv\fR[1] and shifts the members of
|
|
3281 |
\fBargv\fR to the left. It is an error for \fBargv\fR not to be set or to have
|
|
3282 |
less than one word as value. With \fIvariable\fR, performs the
|
|
3283 |
same function on \fIvariable\fR.
|
|
3284 |
.TP 8
|
|
3285 |
.B source \fR[\fB\-h\fR] \fIname\fR [\fIargs\fR ...]
|
|
3286 |
The shell reads and executes commands from \fIname\fR.
|
|
3287 |
The commands are not placed on the history list.
|
|
3288 |
If any \fIargs\fR are given, they are placed in \fBargv\fR. (+)
|
|
3289 |
\fIsource\fR commands may be nested;
|
|
3290 |
if they are nested too deeply the shell may run out of file descriptors.
|
|
3291 |
An error in a \fIsource\fR at any level terminates all nested
|
|
3292 |
\fIsource\fR commands.
|
|
3293 |
With \fB\-h\fR, commands are placed on the history list instead of being
|
|
3294 |
executed, much like `history \-L'.
|
|
3295 |
.TP 8
|
|
3296 |
.B stop \fB%\fIjob\fR|\fIpid\fR ...
|
|
3297 |
Stops the specified jobs or processes which are executing in the background.
|
|
3298 |
\fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
|
|
3299 |
under \fBJobs\fR.
|
|
3300 |
There is no default \fIjob\fR; saying just `stop' does not stop
|
|
3301 |
the current job.
|
|
3302 |
.TP 8
|
|
3303 |
.B suspend
|
|
3304 |
Causes the shell to stop in its tracks, much as if it had
|
|
3305 |
been sent a stop signal with \fB^Z\fR. This is most often used to
|
|
3306 |
stop shells started by \fIsu\fR(1M).
|
|
3307 |
.PP
|
|
3308 |
.B switch (\fIstring\fB)
|
|
3309 |
.br
|
|
3310 |
.B case \fIstr1\fB:
|
|
3311 |
.PD 0
|
|
3312 |
.IP "" 4
|
|
3313 |
\&...
|
|
3314 |
.br
|
|
3315 |
.B breaksw
|
|
3316 |
.PP
|
|
3317 |
\&...
|
|
3318 |
.PP
|
|
3319 |
.B default:
|
|
3320 |
.IP "" 4
|
|
3321 |
\&...
|
|
3322 |
.br
|
|
3323 |
.B breaksw
|
|
3324 |
.TP 8
|
|
3325 |
.B endsw
|
|
3326 |
Each case label is successively matched, against the
|
|
3327 |
specified \fIstring\fR which is first command and filename expanded.
|
|
3328 |
The file metacharacters `*', `?' and `[...]' may be used
|
|
3329 |
in the case labels, which are variable expanded. If none
|
|
3330 |
of the labels match before a `default' label is found, then
|
|
3331 |
the execution begins after the default label. Each case
|
|
3332 |
label and the default label must appear at the beginning of
|
|
3333 |
a line. The command \fIbreaksw\fR causes execution to continue
|
|
3334 |
after the \fIendsw\fR. Otherwise control may fall through case
|
|
3335 |
labels and default labels as in C. If no label matches and
|
|
3336 |
there is no default, execution continues after the \fIendsw\fR.
|
|
3337 |
.PD
|
|
3338 |
.TP 8
|
|
3339 |
.B telltc \fR(+)
|
|
3340 |
Lists the values of all terminal capabilities (see \fIterminfo\fR(4)).
|
|
3341 |
.TP 8
|
|
3342 |
.B termname \fR[\fIterminal type\fR] \fR(+)
|
|
3343 |
Tests if \fIterminal type\fR (or the current value of \fBTERM\fR if no
|
|
3344 |
\fIterminal type\fR is given) has an entry in the hosts
|
|
3345 |
terminfo(4) database. Prints the terminal type to stdout and returns 0
|
|
3346 |
if an entry is present otherwise returns 1.
|
|
3347 |
.TP 8
|
|
3348 |
.B time \fR[\fIcommand\fR]
|
|
3349 |
Executes \fIcommand\fR (which must be a simple command, not an alias,
|
|
3350 |
a pipeline, a command list or a parenthesized command list)
|
|
3351 |
and prints a time summary as described under the \fBtime\fR variable.
|
|
3352 |
If necessary, an extra shell is created to print the time statistic when
|
|
3353 |
the command completes.
|
|
3354 |
Without \fIcommand\fR, prints a time summary for the current shell and its
|
|
3355 |
children.
|
|
3356 |
.TP 8
|
|
3357 |
.B umask \fR[\fIvalue\fR]
|
|
3358 |
Sets the file creation mask to \fIvalue\fR, which is given in octal.
|
|
3359 |
Common values for the mask are
|
|
3360 |
002, giving all access to the group and read and execute access to others, and
|
|
3361 |
022, giving read and execute access to the group and others.
|
|
3362 |
Without \fIvalue\fR, prints the current file creation mask.
|
|
3363 |
.TP 8
|
|
3364 |
.B unalias \fIpattern
|
|
3365 |
.br
|
|
3366 |
Removes all aliases whose names match \fIpattern\fR.
|
|
3367 |
`unalias *' thus removes all aliases.
|
|
3368 |
It is not an error for nothing to be \fIunalias\fRed.
|
|
3369 |
.TP 8
|
|
3370 |
.B uncomplete \fIpattern\fR (+)
|
|
3371 |
Removes all completions whose names match \fIpattern\fR.
|
|
3372 |
`uncomplete *' thus removes all completions.
|
|
3373 |
It is not an error for nothing to be \fIuncomplete\fRd.
|
|
3374 |
.TP 8
|
|
3375 |
.B unhash
|
|
3376 |
Disables use of the internal hash table to speed location of
|
|
3377 |
executed programs.
|
|
3378 |
.TP 8
|
|
3379 |
.B universe \fIuniverse\fR (+)
|
|
3380 |
Sets the universe to \fIuniverse\fR. (Masscomp/RTU only)
|
|
3381 |
.TP 8
|
|
3382 |
.B unlimit \fR[\fB\-hf\fR] [\fIresource\fR]
|
|
3383 |
Removes the limitation on \fIresource\fR or, if no \fIresource\fR is
|
|
3384 |
specified, all \fIresource\fR limitations.
|
|
3385 |
With \fB\-h\fR, the corresponding hard limits are removed.
|
|
3386 |
Only the super-user may do this.
|
|
3387 |
Note that \fBunlimit\fR may not exit successful, since most systems
|
|
3388 |
do not allow \fIdescriptors\fR to be unlimited.
|
|
3389 |
With \fB\-f\fR errors are ignored.
|
|
3390 |
.TP 8
|
|
3391 |
.B unset \fIpattern
|
|
3392 |
Removes all variables whose names match \fIpattern\fR, unless they are read-only.
|
|
3393 |
`unset *' thus removes all variables unless they are read-only;
|
|
3394 |
this is a bad idea.
|
|
3395 |
It is not an error for nothing to be \fIunset\fR.
|
|
3396 |
.TP 8
|
|
3397 |
.B unsetenv \fIpattern
|
|
3398 |
Removes all environment variables whose names match \fIpattern\fR.
|
|
3399 |
`unsetenv *' thus removes all environment variables;
|
|
3400 |
this is a bad idea.
|
|
3401 |
It is not an error for nothing to be \fIunsetenv\fRed.
|
|
3402 |
.TP 8
|
|
3403 |
.B ver \fR[\fIsystype\fR [\fIcommand\fR]] (+)
|
|
3404 |
Without arguments, prints \fBSYSTYPE\fR. With \fIsystype\fR, sets \fBSYSTYPE\fR
|
|
3405 |
to \fIsystype\fR. With \fIsystype\fR and \fIcommand\fR, executes \fIcommand\fR
|
|
3406 |
under \fIsystype\fR. \fIsystype\fR may be `bsd4.3' or `sys5.3'.
|
|
3407 |
(Domain/OS only)
|
|
3408 |
.TP 8
|
|
3409 |
.B wait
|
|
3410 |
The shell waits for all background jobs. If the shell is interactive, an
|
|
3411 |
interrupt will disrupt the wait and cause the shell to print the names and job
|
|
3412 |
numbers of all outstanding jobs.
|
|
3413 |
.TP 8
|
|
3414 |
.B warp \fIuniverse\fR (+)
|
|
3415 |
Sets the universe to \fIuniverse\fR. (Convex/OS only)
|
|
3416 |
.TP 8
|
|
3417 |
.B watchlog \fR(+)
|
|
3418 |
An alternate name for the \fIlog\fR builtin command (q.v.).
|
|
3419 |
Available only if the shell was so compiled;
|
|
3420 |
see the \fBversion\fR shell variable.
|
|
3421 |
.TP 8
|
|
3422 |
.B where \fIcommand\fR (+)
|
|
3423 |
Reports all known instances of \fIcommand\fR, including aliases, builtins and
|
|
3424 |
executables in \fBpath\fR.
|
|
3425 |
.TP 8
|
|
3426 |
.B which\fR \fIcommand\fR (+)
|
|
3427 |
Displays the command that will be executed by the shell after substitutions,
|
|
3428 |
\fBpath\fR searching, etc.
|
|
3429 |
The builtin command is just like \fIwhich\fR(1), but it correctly reports
|
|
3430 |
\fItcsh\fR aliases and builtins and is 10 to 100 times faster.
|
|
3431 |
See also the \fIwhich-command\fR editor command.
|
|
3432 |
.PP
|
|
3433 |
.B while (\fIexpr\fB)\fR
|
|
3434 |
.br
|
|
3435 |
\&...
|
|
3436 |
.PD 0
|
|
3437 |
.TP 8
|
|
3438 |
.B end
|
|
3439 |
Executes the commands between the \fIwhile\fR and the matching \fIend\fR
|
|
3440 |
while \fIexpr\fR (an expression, as described under \fBExpressions\fR)
|
|
3441 |
evaluates non-zero.
|
|
3442 |
\fIwhile\fR and \fIend\fR must appear alone on their input lines.
|
|
3443 |
\fIbreak\fR and \fIcontinue\fR may be used to terminate or continue the
|
|
3444 |
loop prematurely.
|
|
3445 |
If the input is a terminal, the user is prompted the first time
|
|
3446 |
through the loop as with \fIforeach\fR.
|
|
3447 |
.PD
|
|
3448 |
.SS "Special aliases (+)"
|
|
3449 |
If set, each of these aliases executes automatically at the indicated time.
|
|
3450 |
They are all initially undefined.
|
|
3451 |
.TP 8
|
|
3452 |
.B beepcmd
|
|
3453 |
Runs when the shell wants to ring the terminal bell.
|
|
3454 |
.TP 8
|
|
3455 |
.B cwdcmd
|
|
3456 |
Runs after every change of working directory. For example, if the user is
|
|
3457 |
working on an X window system using \fIxterm\fR(1) and a re-parenting window
|
|
3458 |
manager that supports title bars such as \fItwm\fR(1) and does
|
|
3459 |
.RS +8
|
|
3460 |
.IP "" 4
|
|
3461 |
> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd ^G"'
|
|
3462 |
.PP
|
|
3463 |
then the shell will change the title of the running \fIxterm\fR(1)
|
|
3464 |
to be the name of the host, a colon, and the full current working directory.
|
|
3465 |
A fancier way to do that is
|
|
3466 |
.IP "" 4
|
|
3467 |
> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
|
|
3468 |
.PP
|
|
3469 |
This will put the hostname and working directory on the title bar but
|
|
3470 |
only the hostname in the icon manager menu.
|
|
3471 |
.PP
|
|
3472 |
Note that putting a \fIcd\fR, \fIpushd\fR or \fIpopd\fR in \fIcwdcmd\fR
|
|
3473 |
may cause an infinite loop. It is the author's opinion that anyone doing
|
|
3474 |
so will get what they deserve.
|
|
3475 |
.RE
|
|
3476 |
.TP 8
|
|
3477 |
.B jobcmd
|
|
3478 |
Runs before each command gets executed, or when the command changes state.
|
|
3479 |
This is similar to \fIpostcmd\fR, but it does not print builtins.
|
|
3480 |
.RS +8
|
|
3481 |
.IP "" 4
|
|
3482 |
> alias jobcmd 'echo \-n "^[]2\e;\e!#:q^G"'
|
|
3483 |
.PP
|
|
3484 |
then executing \fIvi foo.c\fR will put the command string in the xterm title bar.
|
|
3485 |
.RE
|
|
3486 |
.TP 8
|
|
3487 |
.B helpcommand
|
|
3488 |
Invoked by the \fBrun-help\fR editor command. The command name for which help
|
|
3489 |
is sought is passed as sole argument.
|
|
3490 |
For example, if one does
|
|
3491 |
.RS +8
|
|
3492 |
.IP "" 4
|
|
3493 |
> alias helpcommand '\e!:1 --help'
|
|
3494 |
.PP
|
|
3495 |
then the help display of the command itself will be invoked, using the GNU
|
|
3496 |
help calling convention.
|
|
3497 |
Currently there is no easy way to account for various calling conventions (e.g.,
|
|
3498 |
the customary Unix `-h'), except by using a table of many commands.
|
|
3499 |
.RE
|
|
3500 |
.TP 8
|
|
3501 |
.B periodic
|
|
3502 |
Runs every \fBtperiod\fR minutes. This provides a convenient means for
|
|
3503 |
checking on common but infrequent changes such as new mail. For example,
|
|
3504 |
if one does
|
|
3505 |
.RS +8
|
|
3506 |
.IP "" 4
|
|
3507 |
> set tperiod = 30
|
|
3508 |
.br
|
|
3509 |
> alias periodic checknews
|
|
3510 |
.PP
|
|
3511 |
then the \fIchecknews\fR(1) program runs every 30 minutes.
|
|
3512 |
If \fIperiodic\fR is set but \fBtperiod\fR is unset or set to 0,
|
|
3513 |
\fIperiodic\fR behaves like \fIprecmd\fR.
|
|
3514 |
.RE
|
|
3515 |
.TP 8
|
|
3516 |
.B precmd
|
|
3517 |
Runs just before each prompt is printed. For example, if one does
|
|
3518 |
.RS +8
|
|
3519 |
.IP "" 4
|
|
3520 |
> alias precmd date
|
|
3521 |
.PP
|
|
3522 |
then \fIdate\fR(1) runs just before the shell prompts for each command.
|
|
3523 |
There are no limits on what \fIprecmd\fR can be set to do, but discretion
|
|
3524 |
should be used.
|
|
3525 |
.RE
|
|
3526 |
.TP 8
|
|
3527 |
.B postcmd
|
|
3528 |
Runs before each command gets executed.
|
|
3529 |
.RS +8
|
|
3530 |
.IP "" 4
|
|
3531 |
> alias postcmd 'echo \-n "^[]2\e;\e!#:q^G"'
|
|
3532 |
.PP
|
|
3533 |
then executing \fIvi foo.c\fR will put the command string in the xterm title bar.
|
|
3534 |
.RE
|
|
3535 |
.TP 8
|
|
3536 |
.B shell
|
|
3537 |
Specifies the interpreter for executable scripts which do not themselves
|
|
3538 |
specify an interpreter. The first word should be a full path name to the
|
|
3539 |
desired interpreter (e.g., `/bin/csh' or `/usr/local/bin/tcsh').
|
|
3540 |
.SS "Special shell variables"
|
|
3541 |
The variables described in this section have special meaning to the shell.
|
|
3542 |
.PP
|
|
3543 |
The shell sets \fBaddsuffix\fR, \fBargv\fR, \fBautologout\fR, \fBcsubstnonl\fR, \fBcommand\fR, \fBecho_style\fR,
|
|
3544 |
\fBedit\fR, \fBgid\fR, \fBgroup\fR, \fBhome\fR, \fBloginsh\fR, \fBoid\fR, \fBpath\fR,
|
|
3545 |
\fBprompt\fR, \fBprompt2\fR, \fBprompt3\fR, \fBshell\fR, \fBshlvl\fR,
|
|
3546 |
\fBtcsh\fR, \fBterm\fR, \fBtty\fR, \fBuid\fR, \fBuser\fR and \fBversion\fR at
|
|
3547 |
startup; they do not change thereafter unless changed by the user. The shell
|
|
3548 |
updates \fBcwd\fR, \fBdirstack\fR, \fBowd\fR and \fBstatus\fR when necessary,
|
|
3549 |
and sets \fBlogout\fR on logout.
|
|
3550 |
.PP
|
|
3551 |
The shell synchronizes \fBgroup\fR, \fBhome\fR, \fBpath\fR, \fBshlvl\fR,
|
|
3552 |
\fBterm\fR and \fBuser\fR with the environment variables of the same names:
|
|
3553 |
whenever the environment variable changes the shell changes the corresponding
|
|
3554 |
shell variable to match (unless the shell variable is read-only) and vice
|
|
3555 |
versa. Note that although \fBcwd\fR and \fBPWD\fR have identical meanings, they
|
|
3556 |
are not synchronized in this manner, and that the shell automatically
|
|
3557 |
interconverts the different formats of \fBpath\fR and \fBPATH\fR.
|
|
3558 |
.TP 8
|
|
3559 |
.B addsuffix \fR(+)
|
|
3560 |
If set, filename completion adds `/' to the end of directories and a space
|
|
3561 |
to the end of normal files when they are matched exactly.
|
|
3562 |
Set by default.
|
|
3563 |
.TP 8
|
|
3564 |
.B afsuser \fR(+)
|
|
3565 |
If set, \fBautologout\fR's autolock feature uses its value instead of
|
|
3566 |
the local username for kerberos authentication.
|
|
3567 |
.TP 8
|
|
3568 |
.B ampm \fR(+)
|
|
3569 |
If set, all times are shown in 12-hour AM/PM format.
|
|
3570 |
.TP 8
|
|
3571 |
.B argv
|
|
3572 |
The arguments to the shell. Positional parameters are taken from \fBargv\fR,
|
|
3573 |
i.e., `$1' is replaced by `$argv[1]', etc.
|
|
3574 |
Set by default, but usually empty in interactive shells.
|
|
3575 |
.TP 8
|
|
3576 |
.B autocorrect \fR(+)
|
|
3577 |
If set, the \fIspell-word\fR editor command is invoked automatically before
|
|
3578 |
each completion attempt.
|
|
3579 |
.TP 8
|
|
3580 |
.B autoexpand \fR(+)
|
|
3581 |
If set, the \fIexpand-history\fR editor command is invoked automatically
|
|
3582 |
before each completion attempt. If this is set to \fIonlyhistory\fR, then
|
|
3583 |
only history will be expanded and a second completion will expand filenames.
|
|
3584 |
.TP 8
|
|
3585 |
.B autolist \fR(+)
|
|
3586 |
If set, possibilities are listed after an ambiguous completion.
|
|
3587 |
If set to `ambiguous', possibilities are listed only when no new
|
|
3588 |
characters are added by completion.
|
|
3589 |
.TP 8
|
|
3590 |
.B autologout \fR(+)
|
|
3591 |
The first word is the number of minutes of inactivity before automatic
|
|
3592 |
logout. The optional second word is the number of minutes of inactivity
|
|
3593 |
before automatic locking.
|
|
3594 |
When the shell automatically logs out,
|
|
3595 |
it prints `auto-logout', sets the variable logout to `automatic' and exits.
|
|
3596 |
When the shell automatically locks, the user is required to enter his password
|
|
3597 |
to continue working. Five incorrect attempts result in automatic logout.
|
|
3598 |
Set to `60' (automatic logout after 60 minutes, and no locking) by default
|
|
3599 |
in login and superuser shells, but not if the shell thinks it is running
|
|
3600 |
under a window system (i.e., the \fBDISPLAY\fR environment variable is set),
|
|
3601 |
the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
|
|
3602 |
\fBversion\fR shell variable).
|
|
3603 |
See also the \fBafsuser\fR and \fBlogout\fR shell variables.
|
|
3604 |
.TP 8
|
|
3605 |
.B backslash_quote \fR(+)
|
|
3606 |
If set, backslashes (`\\') always quote `\\', `'', and `"'. This may make
|
|
3607 |
complex quoting tasks easier, but it can cause syntax errors in \fIcsh\fR(1)
|
|
3608 |
scripts.
|
|
3609 |
.TP 8
|
|
3610 |
.B catalog
|
|
3611 |
The file name of the message catalog.
|
|
3612 |
If set, tcsh use `tcsh.${catalog}' as a message catalog instead of
|
|
3613 |
default `tcsh'.
|
|
3614 |
.TP 8
|
|
3615 |
.B cdpath
|
|
3616 |
A list of directories in which \fIcd\fR should search for
|
|
3617 |
subdirectories if they aren't found in the current directory.
|
|
3618 |
.TP 8
|
|
3619 |
.B color
|
|
3620 |
If set, it enables color display for the builtin \fBls\-F\fR and it passes
|
|
3621 |
\fB\-\-color=auto\fR to \fBls\fR. Alternatively, it can be set to only
|
|
3622 |
\fBls\-F\fR or only \fBls\fR to enable color to only one command. Setting
|
|
3623 |
it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
|
|
3624 |
.TP 8
|
|
3625 |
.B colorcat
|
|
3626 |
If set, it enables color escape sequence for NLS message files.
|
|
3627 |
And display colorful NLS messages.
|
|
3628 |
.TP 8
|
|
3629 |
.B command \fR(+)
|
|
3630 |
If set, the command which was passed to the shell with the \fB-c\fR flag (q.v.).
|
|
3631 |
.TP 8
|
|
3632 |
.B compat_expr \fR(+)
|
|
3633 |
If set, the shell will evaluate expressions right to left, like the original
|
|
3634 |
\fIcsh\fR.
|
|
3635 |
.TP 8
|
|
3636 |
.B complete \fR(+)
|
|
3637 |
If set to `enhance', completion 1) ignores case and 2) considers
|
|
3638 |
periods, hyphens and underscores (`.', `\-' and `_') to be word
|
|
3639 |
separators and hyphens and underscores to be equivalent. If set to
|
|
3640 |
`igncase', the completion becomes case insensitive.
|
|
3641 |
.TP 8
|
|
3642 |
.B continue \fR(+)
|
|
3643 |
If set to a list of commands, the shell will continue the listed
|
|
3644 |
commands, instead of starting a new one.
|
|
3645 |
.TP 8
|
|
3646 |
.B continue_args \fR(+)
|
|
3647 |
Same as continue, but the shell will execute:
|
|
3648 |
.RS +8
|
|
3649 |
.IP "" 4
|
|
3650 |
echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
|
|
3651 |
.RE
|
|
3652 |
.TP 8
|
|
3653 |
.B correct \fR(+)
|
|
3654 |
If set to `cmd', commands are automatically spelling-corrected.
|
|
3655 |
If set to `complete', commands are automatically completed.
|
|
3656 |
If set to `all', the entire command line is corrected.
|
|
3657 |
.TP 8
|
|
3658 |
.B csubstnonl \fR(+)
|
|
3659 |
If set, newlines and carriage returns in command substitution are
|
|
3660 |
replaced by spaces. Set by default.
|
|
3661 |
.TP 8
|
|
3662 |
.B cwd
|
|
3663 |
The full pathname of the current directory.
|
|
3664 |
See also the \fBdirstack\fR and \fBowd\fR shell variables.
|
|
3665 |
.TP 8
|
|
3666 |
.B dextract \fR(+)
|
|
3667 |
If set, `pushd +\fIn\fR' extracts the \fIn\fRth directory from the directory
|
|
3668 |
stack rather than rotating it to the top.
|
|
3669 |
.TP 8
|
|
3670 |
.B dirsfile \fR(+)
|
|
3671 |
The default location in which `dirs \-S' and `dirs \-L' look for
|
|
3672 |
a history file. If unset, \fI~/.cshdirs\fR is used.
|
|
3673 |
Because only \fI~/.tcshrc\fR is normally sourced before \fI~/.cshdirs\fR,
|
|
3674 |
\fBdirsfile\fR should be set in \fI~/.tcshrc\fR rather than \fI~/.login\fR.
|
|
3675 |
.TP 8
|
|
3676 |
.B dirstack \fR(+)
|
|
3677 |
An array of all the directories on the directory stack.
|
|
3678 |
`$dirstack[1]' is the current working directory, `$dirstack[2]'
|
|
3679 |
the first directory on the stack, etc.
|
|
3680 |
Note that the current working directory is `$dirstack[1]' but `=0' in
|
|
3681 |
directory stack substitutions, etc.
|
|
3682 |
One can change the stack arbitrarily by setting \fBdirstack\fR,
|
|
3683 |
but the first element (the current working directory) is always correct.
|
|
3684 |
See also the \fBcwd\fR and \fBowd\fR shell variables.
|
|
3685 |
.TP 8
|
|
3686 |
.B dspmbyte \fR(+)
|
|
3687 |
Has an affect iff 'dspm' is listed as part of the \fBversion\fR shell variable.
|
|
3688 |
If set to `euc', it enables display and editing EUC-kanji(Japanese) code.
|
|
3689 |
If set to `sjis', it enables display and editing Shift-JIS(Japanese) code.
|
|
3690 |
If set to `big5', it enables display and editing Big5(Chinese) code.
|
|
3691 |
If set to `utf8', it enables display and editing Utf8(Unicode) code.
|
|
3692 |
If set to the following format, it enables display and editing of original
|
|
3693 |
multi-byte code format:
|
|
3694 |
.RS +8
|
|
3695 |
.IP "" 4
|
|
3696 |
> set dspmbyte = 0000....(256 bytes)....0000
|
|
3697 |
.PP
|
|
3698 |
The table requires \fBjust\fR 256 bytes. Each character of 256 characters
|
|
3699 |
corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff. Each
|
|
3700 |
character
|
|
3701 |
.\" (position in this table?)
|
|
3702 |
is set to number 0,1,2 and 3. Each number has the following meaning:
|
|
3703 |
.br
|
|
3704 |
0 ... not used for multi-byte characters.
|
|
3705 |
.br
|
|
3706 |
1 ... used for the first byte of a multi-byte character.
|
|
3707 |
.br
|
|
3708 |
2 ... used for the second byte of a multi-byte character.
|
|
3709 |
.br
|
|
3710 |
3 ... used for both the first byte and second byte of a multi-byte character.
|
|
3711 |
.\" SHK: I tried my best to get the following to be grammatically correct.
|
|
3712 |
.\" However, I still don't understand what's going on here. In the
|
|
3713 |
\" following example, there are three bytes, but the text seems to refer to
|
|
3714 |
\" each nybble as a character. What's going on here? It this 3-byte code
|
|
3715 |
\" in the table? The text above seems to imply that there are 256
|
|
3716 |
\" characters/bytes in the table. If I get some more info on this (perhaps
|
|
3717 |
\" a complete example), I could fix the text to be grammatically correct.
|
|
3718 |
\" ([email protected] 1999/09/13)
|
|
3719 |
.PP
|
|
3720 |
Example:
|
|
3721 |
.br
|
|
3722 |
If set to `001322', the first character (means 0x00 of the ASCII code) and
|
|
3723 |
second character (means 0x01 of ASCII code) are set to `0'. Then, it is not
|
|
3724 |
used for multi-byte characters. The 3rd character (0x02) is set to '1',
|
|
3725 |
indicating that it is used for the first byte of a multi-byte character.
|
|
3726 |
The 4th character(0x03) is set '3'. It is used for both the first byte and
|
|
3727 |
the second byte of a multi-byte character. The 5th and 6th characters
|
|
3728 |
(0x04,0x05) are set to '2', indicating that they are used for the second
|
|
3729 |
byte of a multi-byte character.
|
|
3730 |
.PP
|
|
3731 |
The GNU fileutils version of ls cannot display multi-byte
|
|
3732 |
filenames without the -N ( --literal ) option. If you are using
|
|
3733 |
this version, set the second word of dspmbyte to "ls". If not, for
|
|
3734 |
example, "ls-F -l" cannot display multi-byte filenames.
|
|
3735 |
.PP
|
|
3736 |
Note:
|
|
3737 |
.br
|
|
3738 |
This variable can only be used if KANJI and DSPMBYTE has been defined at
|
|
3739 |
compile time.
|
|
3740 |
.RE
|
|
3741 |
.TP 8
|
|
3742 |
.B dunique \fR(+)
|
|
3743 |
If set, \fIpushd\fR removes any instances of \fIname\fR
|
|
3744 |
from the stack before pushing it onto the stack.
|
|
3745 |
.TP 8
|
|
3746 |
.B echo
|
|
3747 |
If set, each command with its arguments is echoed just before it is
|
|
3748 |
executed. For non-builtin commands all expansions occur before
|
|
3749 |
echoing. Builtin commands are echoed before command and filename
|
|
3750 |
substitution, because these substitutions are then done selectively.
|
|
3751 |
Set by the \fB\-x\fR command line option.
|
|
3752 |
.TP 8
|
|
3753 |
.B echo_style \fR(+)
|
|
3754 |
The style of the \fIecho\fR builtin. May be set to
|
|
3755 |
.PP
|
|
3756 |
.RS +8
|
|
3757 |
.PD 0
|
|
3758 |
.TP 8
|
|
3759 |
bsd
|
|
3760 |
Don't echo a newline if the first argument is `\-n'.
|
|
3761 |
.TP 8
|
|
3762 |
sysv
|
|
3763 |
Recognize backslashed escape sequences in echo strings.
|
|
3764 |
.TP 8
|
|
3765 |
both
|
|
3766 |
Recognize both the `\-n' flag and backslashed escape sequences; the default.
|
|
3767 |
.TP 8
|
|
3768 |
none
|
|
3769 |
Recognize neither.
|
|
3770 |
.PD
|
|
3771 |
.PP
|
|
3772 |
Set by default to the local system default. The BSD and System V
|
|
3773 |
options are described in the \fIecho\fR(1) man pages on the appropriate
|
|
3774 |
systems.
|
|
3775 |
.RE
|
|
3776 |
.TP 8
|
|
3777 |
.B edit \fR(+)
|
|
3778 |
If set, the command-line editor is used. Set by default in interactive
|
|
3779 |
shells.
|
|
3780 |
.TP 8
|
|
3781 |
.B ellipsis \fR(+)
|
|
3782 |
If set, the `%c'/`%.' and `%C' prompt sequences (see the \fBprompt\fR
|
|
3783 |
shell variable) indicate skipped directories with an ellipsis (`...')
|
|
3784 |
instead of `/<skipped>'.
|
|
3785 |
.TP 8
|
|
3786 |
.B fignore \fR(+)
|
|
3787 |
Lists file name suffixes to be ignored by completion.
|
|
3788 |
.TP 8
|
|
3789 |
.B filec
|
|
3790 |
In \fItcsh\fR, completion is always used and this variable is ignored
|
|
3791 |
by default. If
|
|
3792 |
.B edit
|
|
3793 |
is unset, then the traditional \fIcsh\fR completion is used.
|
|
3794 |
If set in \fIcsh\fR, filename completion is used.
|
|
3795 |
.TP 8
|
|
3796 |
.B gid \fR(+)
|
|
3797 |
The user's real group ID.
|
|
3798 |
.TP 8
|
|
3799 |
.B group \fR(+)
|
|
3800 |
The user's group name.
|
|
3801 |
.TP 8
|
|
3802 |
.B highlight
|
|
3803 |
If set, the incremental search match (in \fIi-search-back\fR and
|
|
3804 |
\fIi-search-fwd\fR) and the region between the mark and the cursor are
|
|
3805 |
highlighted in reverse video.
|
|
3806 |
|
|
3807 |
Highlighting requires more frequent terminal writes, which introduces extra
|
|
3808 |
overhead. If you care about terminal performance, you may want to leave this
|
|
3809 |
unset.
|
|
3810 |
.TP 8
|
|
3811 |
.B histchars
|
|
3812 |
A string value determining the characters used in \fBHistory
|
|
3813 |
substitution\fR (q.v.). The first character of its value is used as
|
|
3814 |
the history substitution character, replacing the default character
|
|
3815 |
`!'. The second character of its value replaces the character `^' in
|
|
3816 |
quick substitutions.
|
|
3817 |
.TP 8
|
|
3818 |
.B histdup \fR(+)
|
|
3819 |
Controls handling of duplicate entries in the history list. If set to
|
|
3820 |
`all' only unique history events are entered in the history list. If
|
|
3821 |
set to `prev' and the last history event is the same as the current
|
|
3822 |
command, then the current command is not entered in the history. If
|
|
3823 |
set to `erase' and the same event is found in the history list, that
|
|
3824 |
old event gets erased and the current one gets inserted. Note that the
|
|
3825 |
`prev' and `all' options renumber history events so there are no gaps.
|
|
3826 |
.TP 8
|
|
3827 |
.B histfile \fR(+)
|
|
3828 |
The default location in which `history \-S' and `history \-L' look for
|
|
3829 |
a history file. If unset, \fI~/.history\fR is used. \fBhistfile\fR is
|
|
3830 |
useful when sharing the same home directory between different machines,
|
|
3831 |
or when saving separate histories on different terminals. Because only
|
|
3832 |
\fI~/.tcshrc\fR is normally sourced before \fI~/.history\fR,
|
|
3833 |
\fBhistfile\fR should be set in \fI~/.tcshrc\fR rather than
|
|
3834 |
\fI~/.login\fR.
|
|
3835 |
.TP 8
|
|
3836 |
.B histlit \fR(+)
|
|
3837 |
If set, builtin and editor commands and the \fBsavehist\fR mechanism
|
|
3838 |
use the literal (unexpanded) form of lines in the history list. See
|
|
3839 |
also the \fItoggle-literal-history\fR editor command.
|
|
3840 |
.TP 8
|
|
3841 |
.B history
|
|
3842 |
The first word indicates the number of history events to save. The
|
|
3843 |
optional second word (+) indicates the format in which history is
|
|
3844 |
printed; if not given, `%h\\t%T\\t%R\\n' is used. The format sequences
|
|
3845 |
are described below under \fBprompt\fR; note the variable meaning of
|
|
3846 |
`%R'. Set to `100' by default.
|
|
3847 |
.TP 8
|
|
3848 |
.B home
|
|
3849 |
Initialized to the home directory of the invoker. The filename
|
|
3850 |
expansion of `\fI~\fR' refers to this variable.
|
|
3851 |
.TP 8
|
|
3852 |
.B ignoreeof
|
|
3853 |
If set to the empty string or `0' and the input device is a terminal,
|
|
3854 |
the \fIend-of-file\fR command (usually generated by the user by typing
|
|
3855 |
`^D' on an empty line) causes the shell to print `Use "exit" to leave
|
|
3856 |
tcsh.' instead of exiting. This prevents the shell from accidentally
|
|
3857 |
being killed. Historically this setting exited after 26 successive
|
|
3858 |
EOF's to avoid infinite loops. If set to a number \fIn\fR, the shell
|
|
3859 |
ignores \fIn - 1\fR consecutive \fIend-of-file\fRs and exits on the
|
|
3860 |
\fIn\fRth. (+) If unset, `1' is used, i.e., the shell exits on a
|
|
3861 |
single `^D'.
|
|
3862 |
.TP 8
|
|
3863 |
.B implicitcd \fR(+)
|
|
3864 |
If set, the shell treats a directory name typed as a command as though
|
|
3865 |
it were a request to change to that directory. If set to \fIverbose\fR,
|
|
3866 |
the change of directory is echoed to the standard output. This behavior
|
|
3867 |
is inhibited in non-interactive shell scripts, or for command strings
|
|
3868 |
with more than one word. Changing directory takes precedence over
|
|
3869 |
executing a like-named command, but it is done after alias
|
|
3870 |
substitutions. Tilde and variable expansions work as expected.
|
|
3871 |
.TP 8
|
|
3872 |
.B inputmode \fR(+)
|
|
3873 |
If set to `insert' or `overwrite', puts the editor into that input mode
|
|
3874 |
at the beginning of each line.
|
|
3875 |
.TP 8
|
|
3876 |
.B killdup \fR(+)
|
|
3877 |
Controls handling of duplicate entries in the kill ring. If set to
|
|
3878 |
`all' only unique strings are entered in the kill ring. If set to
|
|
3879 |
`prev' and the last killed string is the same as the current killed
|
|
3880 |
string, then the current string is not entered in the ring. If set
|
|
3881 |
to `erase' and the same string is found in the kill ring, the old
|
|
3882 |
string is erased and the current one is inserted.
|
|
3883 |
.TP 8
|
|
3884 |
.B killring \fR(+)
|
|
3885 |
Indicates the number of killed strings to keep in memory. Set to `30'
|
|
3886 |
by default. If unset or set to less than `2', the shell will only
|
|
3887 |
keep the most recently killed string.
|
|
3888 |
Strings are put in the killring by the editor commands that delete
|
|
3889 |
(kill) strings of text, e.g. \fIbackward-delete-word\fR,
|
|
3890 |
\fIkill-line\fR, etc, as well as the \fIcopy-region-as-kill\fR command.
|
|
3891 |
The \fIyank\fR editor command will yank the most recently killed string
|
|
3892 |
into the command-line, while \fIyank-pop\fR (see \fBEditor commands\fR)
|
|
3893 |
can be used to yank earlier killed strings.
|
|
3894 |
.TP 8
|
|
3895 |
.B listflags \fR(+)
|
|
3896 |
If set to `x', `a' or `A', or any combination thereof (e.g., `xA'), they
|
|
3897 |
are used as flags to \fIls\-F\fR, making it act like `ls \-xF', `ls
|
|
3898 |
\-Fa', `ls \-FA' or a combination (e.g., `ls \-FxA'): `a' shows all
|
|
3899 |
files (even if they start with a `.'), `A' shows all files but `.' and
|
|
3900 |
`..', and `x' sorts across instead of down. If the second word of
|
|
3901 |
\fBlistflags\fR is set, it is used as the path to `ls(1)'.
|
|
3902 |
.TP 8
|
|
3903 |
.B listjobs \fR(+)
|
|
3904 |
If set, all jobs are listed when a job is suspended. If set to `long',
|
|
3905 |
the listing is in long format.
|
|
3906 |
.TP 8
|
|
3907 |
.B listlinks \fR(+)
|
|
3908 |
If set, the \fIls\-F\fR builtin command shows the type of file to which
|
|
3909 |
each symbolic link points.
|
|
3910 |
.TP 8
|
|
3911 |
.B listmax \fR(+)
|
|
3912 |
The maximum number of items which the \fIlist-choices\fR editor command
|
|
3913 |
will list without asking first.
|
|
3914 |
.TP 8
|
|
3915 |
.B listmaxrows \fR(+)
|
|
3916 |
The maximum number of rows of items which the \fIlist-choices\fR editor
|
|
3917 |
command will list without asking first.
|
|
3918 |
.TP 8
|
|
3919 |
.B loginsh \fR(+)
|
|
3920 |
Set by the shell if it is a login shell. Setting or unsetting it
|
|
3921 |
within a shell has no effect. See also \fBshlvl\fR.
|
|
3922 |
.TP 8
|
|
3923 |
.B logout \fR(+)
|
|
3924 |
Set by the shell to `normal' before a normal logout, `automatic' before
|
|
3925 |
an automatic logout, and `hangup' if the shell was killed by a hangup
|
|
3926 |
signal (see \fBSignal handling\fR). See also the \fBautologout\fR
|
|
3927 |
shell variable.
|
|
3928 |
.TP 8
|
|
3929 |
.B mail
|
|
3930 |
The names of the files or directories to check for incoming mail,
|
|
3931 |
separated by whitespace, and optionally preceded by a numeric word.
|
|
3932 |
Before each prompt, if 10 minutes have passed since the last check, the
|
|
3933 |
shell checks each file and says `You have new mail.' (or, if \fBmail\fR
|
|
3934 |
contains multiple files, `You have new mail in \fIname\fR.') if the
|
|
3935 |
filesize is greater than zero in size and has a modification time
|
|
3936 |
greater than its access time.
|
|
3937 |
.PP
|
|
3938 |
.RS +8
|
|
3939 |
.PD
|
|
3940 |
.PP
|
|
3941 |
If you are in a login shell, then no mail file is reported unless it has
|
|
3942 |
been modified after the time the shell has started up, to prevent
|
|
3943 |
redundant notifications. Most login programs will tell you whether or not
|
|
3944 |
you have mail when you log in.
|
|
3945 |
.PP
|
|
3946 |
If a file specified in \fBmail\fR is a directory, the shell will count each
|
|
3947 |
file within that directory as a separate message, and will report `You have
|
|
3948 |
\fIn\fR mails.' or `You have \fIn\fR mails in \fIname\fR.' as appropriate.
|
|
3949 |
This functionality is provided primarily for those systems which store mail
|
|
3950 |
in this manner, such as the Andrew Mail System.
|
|
3951 |
.PP
|
|
3952 |
If the first word of \fBmail\fR is numeric it is taken as a different mail
|
|
3953 |
checking interval, in seconds.
|
|
3954 |
.PP
|
|
3955 |
Under very rare circumstances, the shell may report `You have mail.' instead
|
|
3956 |
of `You have new mail.'
|
|
3957 |
.RE
|
|
3958 |
.TP 8
|
|
3959 |
.B matchbeep \fR(+)
|
|
3960 |
If set to `never', completion never beeps.
|
|
3961 |
If set to `nomatch', it beeps only when there is no match.
|
|
3962 |
If set to `ambiguous', it beeps when there are multiple matches.
|
|
3963 |
If set to `notunique', it beeps when there is one exact and other longer matches.
|
|
3964 |
If unset, `ambiguous' is used.
|
|
3965 |
.TP 8
|
|
3966 |
.B nobeep \fR(+)
|
|
3967 |
If set, beeping is completely disabled.
|
|
3968 |
See also \fBvisiblebell\fR.
|
|
3969 |
.TP 8
|
|
3970 |
.B noclobber
|
|
3971 |
If set, restrictions are placed on output redirection to insure that files
|
|
3972 |
are not accidentally destroyed and that `>>' redirections refer to existing
|
|
3973 |
files, as described in the \fBInput/output\fR section.
|
|
3974 |
.TP 8
|
|
3975 |
.B noding
|
|
3976 |
If set, disable the printing of `DING!' in the \fBprompt\fR time
|
|
3977 |
specifiers at the change of hour.
|
|
3978 |
.TP 8
|
|
3979 |
.B noglob
|
|
3980 |
If set, \fBFilename substitution\fR and \fBDirectory stack substitution\fR
|
|
3981 |
(q.v.) are inhibited. This is most useful in shell scripts which do not deal
|
|
3982 |
with filenames, or after a list of filenames has been obtained and further
|
|
3983 |
expansions are not desirable.
|
|
3984 |
.TP 8
|
|
3985 |
.B nokanji \fR(+)
|
|
3986 |
If set and the shell supports Kanji (see the \fBversion\fR shell variable),
|
|
3987 |
it is disabled so that the meta key can be used.
|
|
3988 |
.TP 8
|
|
3989 |
.B nonomatch
|
|
3990 |
If set, a \fBFilename substitution\fR or \fBDirectory stack substitution\fR
|
|
3991 |
(q.v.) which does not match any
|
|
3992 |
existing files is left untouched rather than causing an error.
|
|
3993 |
It is still an error for the substitution to be
|
|
3994 |
malformed, e.g., `echo [' still gives an error.
|
|
3995 |
.TP 8
|
|
3996 |
.B nostat \fR(+)
|
|
3997 |
A list of directories (or glob-patterns which match directories; see
|
|
3998 |
\fBFilename substitution\fR) that should not be \fIstat\fR(2)ed during a
|
|
3999 |
completion operation. This is usually used to exclude directories which
|
|
4000 |
take too much time to \fIstat\fR(2), for example \fI/afs\fR.
|
|
4001 |
.TP 8
|
|
4002 |
.B notify
|
|
4003 |
If set, the shell announces job completions asynchronously.
|
|
4004 |
The default is to present job completions just before printing a prompt.
|
|
4005 |
.TP 8
|
|
4006 |
.B oid \fR(+)
|
|
4007 |
The user's real organization ID. (Domain/OS only)
|
|
4008 |
.TP 8
|
|
4009 |
.B owd \fR(+)
|
|
4010 |
The old working directory, equivalent to the `\-' used by \fIcd\fR and \fIpushd\fR.
|
|
4011 |
See also the \fBcwd\fR and \fBdirstack\fR shell variables.
|
|
4012 |
.TP 8
|
|
4013 |
.B padhour
|
|
4014 |
If set, enable the printing of padding '0' for hours, in 24 and 12 hour
|
|
4015 |
formats. E.G.: 07:45:42 vs. 7:45:42
|
|
4016 |
.TP 8
|
|
4017 |
.B path
|
|
4018 |
A list of directories in which to look for executable commands.
|
|
4019 |
A null word specifies the current directory.
|
|
4020 |
If there is no \fBpath\fR variable then only full path names will execute.
|
|
4021 |
\fBpath\fR is set by the shell at startup from the \fBPATH\fR environment
|
|
4022 |
variable or, if \fBPATH\fR does not exist, to a system-dependent default
|
|
4023 |
something like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'.
|
|
4024 |
The shell may put `.' first or last in \fBpath\fR or omit it entirely
|
|
4025 |
depending on how it was compiled; see the \fBversion\fR shell variable.
|
|
4026 |
A shell which is given neither the \fB\-c\fR nor the \fB\-t\fR option
|
|
4027 |
hashes the contents of the directories in \fBpath\fR after
|
|
4028 |
reading \fI~/.tcshrc\fR and each time \fBpath\fR is reset.
|
|
4029 |
If one adds a new command to a directory in \fBpath\fR while the shell
|
|
4030 |
is active, one may need to do a \fIrehash\fR for the shell to find it.
|
|
4031 |
.TP 8
|
|
4032 |
.B printexitvalue \fR(+)
|
|
4033 |
If set and an interactive program exits with a non-zero status, the shell
|
|
4034 |
prints `Exit \fBstatus\fR'.
|
|
4035 |
.TP 8
|
|
4036 |
.B prompt
|
|
4037 |
The string which is printed before reading each command from the terminal.
|
|
4038 |
\fBprompt\fR may include any of the following formatting sequences (+), which
|
|
4039 |
are replaced by the given information:
|
|
4040 |
.PP
|
|
4041 |
.RS +8
|
|
4042 |
.PD 0
|
|
4043 |
.TP 4
|
|
4044 |
%/
|
|
4045 |
The current working directory.
|
|
4046 |
.TP 4
|
|
4047 |
%~
|
|
4048 |
The current working directory, but with one's home directory
|
|
4049 |
represented by `~' and other users' home directories represented by
|
|
4050 |
`~user' as per \fBFilename substitution\fR. `~user' substitution
|
|
4051 |
happens only if the shell has already used `~\fIuser\fR' in a pathname
|
|
4052 |
in the current session.
|
|
4053 |
.TP 4
|
|
4054 |
%c[[0]\fIn\fR], %.[[0]\fIn\fR]
|
|
4055 |
The trailing component of the current working directory, or \fIn\fR
|
|
4056 |
trailing components if a digit \fIn\fR is given.
|
|
4057 |
If \fIn\fR begins with `0', the number of skipped components precede
|
|
4058 |
the trailing component(s) in the format `/<\fIskipped\fR>trailing'.
|
|
4059 |
If the \fBellipsis\fR shell variable is set, skipped components
|
|
4060 |
are represented by an ellipsis so the whole becomes `...trailing'.
|
|
4061 |
`~' substitution is done as in `%~' above, but the `~' component
|
|
4062 |
is ignored when counting trailing components.
|
|
4063 |
.TP 4
|
|
4064 |
%C
|
|
4065 |
Like %c, but without `~' substitution.
|
|
4066 |
.TP 4
|
|
4067 |
%h, %!, !
|
|
4068 |
The current history event number.
|
|
4069 |
.TP 4
|
|
4070 |
%M
|
|
4071 |
The full hostname.
|
|
4072 |
.TP 4
|
|
4073 |
%m
|
|
4074 |
The hostname up to the first `.'.
|
|
4075 |
.TP 4
|
|
4076 |
%S (%s)
|
|
4077 |
Start (stop) standout mode.
|
|
4078 |
.TP 4
|
|
4079 |
%B (%b)
|
|
4080 |
Start (stop) boldfacing mode.
|
|
4081 |
.TP 4
|
|
4082 |
%U (%u)
|
|
4083 |
Start (stop) underline mode.
|
|
4084 |
.TP 4
|
|
4085 |
%t, %@
|
|
4086 |
The time of day in 12-hour AM/PM format.
|
|
4087 |
.TP 4
|
|
4088 |
%T
|
|
4089 |
Like `%t', but in 24-hour format (but see the \fBampm\fR shell variable).
|
|
4090 |
.TP 4
|
|
4091 |
%p
|
|
4092 |
The `precise' time of day in 12-hour AM/PM format, with seconds.
|
|
4093 |
.TP 4
|
|
4094 |
%P
|
|
4095 |
Like `%p', but in 24-hour format (but see the \fBampm\fR shell variable).
|
|
4096 |
.TP 4
|
|
4097 |
\e\fIc\fR
|
|
4098 |
\fIc\fR is parsed as in \fIbindkey\fR.
|
|
4099 |
.TP 4
|
|
4100 |
^\fIc\fR
|
|
4101 |
\fIc\fR is parsed as in \fIbindkey\fR.
|
|
4102 |
.TP 4
|
|
4103 |
%%
|
|
4104 |
A single `%'.
|
|
4105 |
.TP 4
|
|
4106 |
%n
|
|
4107 |
The user name.
|
|
4108 |
.TP 4
|
|
4109 |
%j
|
|
4110 |
The number of jobs.
|
|
4111 |
.TP 4
|
|
4112 |
%d
|
|
4113 |
The weekday in `Day' format.
|
|
4114 |
.TP 4
|
|
4115 |
%D
|
|
4116 |
The day in `dd' format.
|
|
4117 |
.TP 4
|
|
4118 |
%w
|
|
4119 |
The month in `Mon' format.
|
|
4120 |
.TP 4
|
|
4121 |
%W
|
|
4122 |
The month in `mm' format.
|
|
4123 |
.TP 4
|
|
4124 |
%y
|
|
4125 |
The year in `yy' format.
|
|
4126 |
.TP 4
|
|
4127 |
%Y
|
|
4128 |
The year in `yyyy' format.
|
|
4129 |
.TP 4
|
|
4130 |
%l
|
|
4131 |
The shell's tty.
|
|
4132 |
.TP 4
|
|
4133 |
%L
|
|
4134 |
Clears from the end of the prompt to end of the display or the end of the line.
|
|
4135 |
.TP 4
|
|
4136 |
%$
|
|
4137 |
Expands the shell or environment variable name immediately after the `$'.
|
|
4138 |
.TP 4
|
|
4139 |
%#
|
|
4140 |
`>' (or the first character of the \fBpromptchars\fR shell variable)
|
|
4141 |
for normal users, `#' (or the second character of \fBpromptchars\fR)
|
|
4142 |
for the superuser.
|
|
4143 |
.TP 4
|
|
4144 |
%{\fIstring\fR%}
|
|
4145 |
Includes \fIstring\fR as a literal escape sequence.
|
|
4146 |
It should be used only to change terminal attributes and
|
|
4147 |
should not move the cursor location. This
|
|
4148 |
cannot be the last sequence in \fBprompt\fR.
|
|
4149 |
.TP 4
|
|
4150 |
%?
|
|
4151 |
The return code of the command executed just before the prompt.
|
|
4152 |
.TP 4
|
|
4153 |
%R
|
|
4154 |
In \fBprompt2\fR, the status of the parser.
|
|
4155 |
In \fBprompt3\fR, the corrected string.
|
|
4156 |
In \fBhistory\fR, the history string.
|
|
4157 |
.PD
|
|
4158 |
.PP
|
|
4159 |
`%B', `%S', `%U' and `%{\fIstring\fR%}' are available in only
|
|
4160 |
eight-bit-clean shells; see the \fBversion\fR shell variable.
|
|
4161 |
.PP
|
|
4162 |
The bold, standout and underline sequences are often used to distinguish a
|
|
4163 |
superuser shell. For example,
|
|
4164 |
.IP "" 4
|
|
4165 |
> set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
|
|
4166 |
.br
|
|
4167 |
tut [37] \fB[2:54pm]\fR [/usr/accts/sys] you rang? _
|
|
4168 |
.PP
|
|
4169 |
If `%t', `%@', `%T', `%p', or `%P' is used, and \fBnoding\fR is not set,
|
|
4170 |
then print `DING!' on the change of hour (i.e, `:00' minutes) instead of
|
|
4171 |
the actual time.
|
|
4172 |
.PP
|
|
4173 |
Set by default to `%# ' in interactive shells.
|
|
4174 |
.RE
|
|
4175 |
.TP 8
|
|
4176 |
.B prompt2 \fR(+)
|
|
4177 |
The string with which to prompt in \fIwhile\fR and \fIforeach\fR loops and
|
|
4178 |
after lines ending in `\\'.
|
|
4179 |
The same format sequences may be used as in \fBprompt\fR (q.v.);
|
|
4180 |
note the variable meaning of `%R'.
|
|
4181 |
Set by default to `%R? ' in interactive shells.
|
|
4182 |
.TP 8
|
|
4183 |
.B prompt3 \fR(+)
|
|
4184 |
The string with which to prompt when confirming automatic spelling correction.
|
|
4185 |
The same format sequences may be used as in \fBprompt\fR (q.v.);
|
|
4186 |
note the variable meaning of `%R'.
|
|
4187 |
Set by default to `CORRECT>%R (y|n|e|a)? ' in interactive shells.
|
|
4188 |
.TP 8
|
|
4189 |
.B promptchars \fR(+)
|
|
4190 |
If set (to a two-character string), the `%#' formatting sequence in the
|
|
4191 |
\fBprompt\fR shell variable is replaced with the first character for
|
|
4192 |
normal users and the second character for the superuser.
|
|
4193 |
.TP 8
|
|
4194 |
.B pushdtohome \fR(+)
|
|
4195 |
If set, \fIpushd\fR without arguments does `pushd ~', like \fIcd\fR.
|
|
4196 |
.TP 8
|
|
4197 |
.B pushdsilent \fR(+)
|
|
4198 |
If set, \fIpushd\fR and \fIpopd\fR do not print the directory stack.
|
|
4199 |
.TP 8
|
|
4200 |
.B recexact \fR(+)
|
|
4201 |
If set, completion completes on an exact match even if a longer match is
|
|
4202 |
possible.
|
|
4203 |
.TP 8
|
|
4204 |
.B recognize_only_executables \fR(+)
|
|
4205 |
If set, command listing displays only files in the path that are
|
|
4206 |
executable. Slow.
|
|
4207 |
.TP 8
|
|
4208 |
.B rmstar \fR(+)
|
|
4209 |
If set, the user is prompted before `rm *' is executed.
|
|
4210 |
.TP 8
|
|
4211 |
.B rprompt \fR(+)
|
|
4212 |
The string to print on the right-hand side of the screen (after
|
|
4213 |
the command input) when the prompt is being displayed on the left.
|
|
4214 |
It recognizes the same formatting characters as \fBprompt\fR.
|
|
4215 |
It will automatically disappear and reappear as necessary, to ensure that
|
|
4216 |
command input isn't obscured, and will appear only if the prompt,
|
|
4217 |
command input, and itself will fit together on the first line.
|
|
4218 |
If \fBedit\fR isn't set, then \fBrprompt\fR will be printed after
|
|
4219 |
the prompt and before the command input.
|
|
4220 |
.TP 8
|
|
4221 |
.B savedirs \fR(+)
|
|
4222 |
If set, the shell does `dirs \-S' before exiting.
|
|
4223 |
If the first word is set to a number, at most that many directory stack
|
|
4224 |
entries are saved.
|
|
4225 |
.TP 8
|
|
4226 |
.B savehist
|
|
4227 |
If set, the shell does `history \-S' before exiting.
|
|
4228 |
If the first word is set to a number, at most that many lines are saved.
|
|
4229 |
(The number must be less than or equal to \fBhistory\fR.)
|
|
4230 |
If the second word is set to `merge', the history list is merged with
|
|
4231 |
the existing history file instead of replacing it (if there is one) and
|
|
4232 |
sorted by time stamp and the most recent events are retained. (+)
|
|
4233 |
.TP 8
|
|
4234 |
.B sched \fR(+)
|
|
4235 |
The format in which the \fIsched\fR builtin command prints scheduled events;
|
|
4236 |
if not given, `%h\\t%T\\t%R\\n' is used.
|
|
4237 |
The format sequences are described above under \fBprompt\fR;
|
|
4238 |
note the variable meaning of `%R'.
|
|
4239 |
.TP 8
|
|
4240 |
.B shell
|
|
4241 |
The file in which the shell resides. This is used in forking
|
|
4242 |
shells to interpret files which have execute bits set, but
|
|
4243 |
which are not executable by the system. (See the description
|
|
4244 |
of \fBBuiltin and non-builtin command execution\fR.) Initialized to the
|
|
4245 |
(system-dependent) home of the shell.
|
|
4246 |
.TP 8
|
|
4247 |
.B shlvl \fR(+)
|
|
4248 |
The number of nested shells.
|
|
4249 |
Reset to 1 in login shells.
|
|
4250 |
See also \fBloginsh\fR.
|
|
4251 |
.TP 8
|
|
4252 |
.B status
|
|
4253 |
The status returned by the last command. If it terminated
|
|
4254 |
abnormally, then 0200 is added to the status. Builtin commands
|
|
4255 |
which fail return exit status `1', all other builtin commands
|
|
4256 |
return status `0'.
|
|
4257 |
.TP 8
|
|
4258 |
.B symlinks \fR(+)
|
|
4259 |
Can be set to several different values to control symbolic link (`symlink')
|
|
4260 |
resolution:
|
|
4261 |
.RS +8
|
|
4262 |
.PP
|
|
4263 |
If set to `chase', whenever the current directory changes to a directory
|
|
4264 |
containing a symbolic link, it is expanded to the real name of the directory
|
|
4265 |
to which the link points. This does not work for the user's home directory;
|
|
4266 |
this is a bug.
|
|
4267 |
.PP
|
|
4268 |
If set to `ignore', the shell tries to construct a current directory
|
|
4269 |
relative to the current directory before the link was crossed.
|
|
4270 |
This means that \fIcd\fRing through a symbolic link and then `cd ..'ing
|
|
4271 |
returns one to the original directory. This affects only builtin commands
|
|
4272 |
and filename completion.
|
|
4273 |
.PP
|
|
4274 |
If set to `expand', the shell tries to fix symbolic links by actually expanding
|
|
4275 |
arguments which look like path names. This affects any command, not just
|
|
4276 |
builtins. Unfortunately, this does not work for hard-to-recognize filenames,
|
|
4277 |
such as those embedded in command options. Expansion may be prevented by
|
|
4278 |
quoting. While this setting is usually the most convenient, it is sometimes
|
|
4279 |
misleading and sometimes confusing when it fails to recognize an argument
|
|
4280 |
which should be expanded. A compromise is to use `ignore' and use the
|
|
4281 |
editor command \fInormalize-path\fR (bound by default to ^X-n) when necessary.
|
|
4282 |
.PP
|
|
4283 |
Some examples are in order. First, let's set up some play directories:
|
|
4284 |
.IP "" 4
|
|
4285 |
> cd /tmp
|
|
4286 |
.br
|
|
4287 |
> mkdir from from/src to
|
|
4288 |
.br
|
|
4289 |
> ln \-s from/src to/dst
|
|
4290 |
.PP
|
|
4291 |
Here's the behavior with \fBsymlinks\fR unset,
|
|
4292 |
.IP "" 4
|
|
4293 |
> cd /tmp/to/dst; echo $cwd
|
|
4294 |
.br
|
|
4295 |
/tmp/to/dst
|
|
4296 |
.br
|
|
4297 |
> cd ..; echo $cwd
|
|
4298 |
.br
|
|
4299 |
/tmp/from
|
|
4300 |
.PP
|
|
4301 |
here's the behavior with \fBsymlinks\fR set to `chase',
|
|
4302 |
.IP "" 4
|
|
4303 |
> cd /tmp/to/dst; echo $cwd
|
|
4304 |
.br
|
|
4305 |
/tmp/from/src
|
|
4306 |
.br
|
|
4307 |
> cd ..; echo $cwd
|
|
4308 |
.br
|
|
4309 |
/tmp/from
|
|
4310 |
.PP
|
|
4311 |
here's the behavior with \fBsymlinks\fR set to `ignore',
|
|
4312 |
.IP "" 4
|
|
4313 |
> cd /tmp/to/dst; echo $cwd
|
|
4314 |
.br
|
|
4315 |
/tmp/to/dst
|
|
4316 |
.br
|
|
4317 |
> cd ..; echo $cwd
|
|
4318 |
.br
|
|
4319 |
/tmp/to
|
|
4320 |
.PP
|
|
4321 |
and here's the behavior with \fBsymlinks\fR set to `expand'.
|
|
4322 |
.IP "" 4
|
|
4323 |
> cd /tmp/to/dst; echo $cwd
|
|
4324 |
.br
|
|
4325 |
/tmp/to/dst
|
|
4326 |
.br
|
|
4327 |
> cd ..; echo $cwd
|
|
4328 |
.br
|
|
4329 |
/tmp/to
|
|
4330 |
.br
|
|
4331 |
> cd /tmp/to/dst; echo $cwd
|
|
4332 |
.br
|
|
4333 |
/tmp/to/dst
|
|
4334 |
.br
|
|
4335 |
> cd ".."; echo $cwd
|
|
4336 |
.br
|
|
4337 |
/tmp/from
|
|
4338 |
.br
|
|
4339 |
> /bin/echo ..
|
|
4340 |
.br
|
|
4341 |
/tmp/to
|
|
4342 |
.br
|
|
4343 |
> /bin/echo ".."
|
|
4344 |
.br
|
|
4345 |
\&..
|
|
4346 |
.PP
|
|
4347 |
Note that `expand' expansion 1) works just like `ignore' for builtins
|
|
4348 |
like \fIcd\fR, 2) is prevented by quoting, and 3) happens before
|
|
4349 |
filenames are passed to non-builtin commands.
|
|
4350 |
.RE
|
|
4351 |
.TP 8
|
|
4352 |
.B tcsh \fR(+)
|
|
4353 |
The version number of the shell in the format `R.VV.PP',
|
|
4354 |
where `R' is the major release number, `VV' the current version
|
|
4355 |
and `PP' the patchlevel.
|
|
4356 |
.TP 8
|
|
4357 |
.B term
|
|
4358 |
The terminal type. Usually set in \fI~/.login\fR as described under
|
|
4359 |
\fBStartup and shutdown\fR.
|
|
4360 |
.TP 8
|
|
4361 |
.B time
|
|
4362 |
If set to a number, then the \fItime\fR builtin (q.v.) executes automatically
|
|
4363 |
after each command which takes more than that many CPU seconds.
|
|
4364 |
If there is a second word, it is used as a format string for the output
|
|
4365 |
of the \fItime\fR builtin. (u) The following sequences may be used in the
|
|
4366 |
format string:
|
|
4367 |
.PP
|
|
4368 |
.RS +8
|
|
4369 |
.PD 0
|
|
4370 |
.TP 4
|
|
4371 |
%U
|
|
4372 |
The time the process spent in user mode in cpu seconds.
|
|
4373 |
.TP 4
|
|
4374 |
%S
|
|
4375 |
The time the process spent in kernel mode in cpu seconds.
|
|
4376 |
.TP 4
|
|
4377 |
%E
|
|
4378 |
The elapsed (wall clock) time in seconds.
|
|
4379 |
.TP 4
|
|
4380 |
%P
|
|
4381 |
The CPU percentage computed as (%U + %S) / %E.
|
|
4382 |
.TP 4
|
|
4383 |
%W
|
|
4384 |
Number of times the process was swapped.
|
|
4385 |
.TP 4
|
|
4386 |
%X
|
|
4387 |
The average amount in (shared) text space used in Kbytes.
|
|
4388 |
.TP 4
|
|
4389 |
%D
|
|
4390 |
The average amount in (unshared) data/stack space used in Kbytes.
|
|
4391 |
.TP 4
|
|
4392 |
%K
|
|
4393 |
The total space used (%X + %D) in Kbytes.
|
|
4394 |
.TP 4
|
|
4395 |
%M
|
|
4396 |
The maximum memory the process had in use at any time in Kbytes.
|
|
4397 |
.TP 4
|
|
4398 |
%F
|
|
4399 |
The number of major page faults (page needed to be brought from disk).
|
|
4400 |
.TP 4
|
|
4401 |
%R
|
|
4402 |
The number of minor page faults.
|
|
4403 |
.TP 4
|
|
4404 |
%I
|
|
4405 |
The number of input operations.
|
|
4406 |
.TP 4
|
|
4407 |
%O
|
|
4408 |
The number of output operations.
|
|
4409 |
.TP 4
|
|
4410 |
%r
|
|
4411 |
The number of socket messages received.
|
|
4412 |
.TP 4
|
|
4413 |
%s
|
|
4414 |
The number of socket messages sent.
|
|
4415 |
.TP 4
|
|
4416 |
%k
|
|
4417 |
The number of signals received.
|
|
4418 |
.TP 4
|
|
4419 |
%w
|
|
4420 |
The number of voluntary context switches (waits).
|
|
4421 |
.TP 4
|
|
4422 |
%c
|
|
4423 |
The number of involuntary context switches.
|
|
4424 |
.PD
|
|
4425 |
.PP
|
|
4426 |
Only the first four sequences are supported on systems without BSD resource
|
|
4427 |
limit functions.
|
|
4428 |
The default time format is `%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww' for
|
|
4429 |
systems that support resource usage reporting and `%Uu %Ss %E %P' for
|
|
4430 |
systems that do not.
|
|
4431 |
.PP
|
|
4432 |
Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
|
|
4433 |
available, but the following additional sequences are:
|
|
4434 |
.PP
|
|
4435 |
.PD 0
|
|
4436 |
.TP 4
|
|
4437 |
%Y
|
|
4438 |
The number of system calls performed.
|
|
4439 |
.TP 4
|
|
4440 |
%Z
|
|
4441 |
The number of pages which are zero-filled on demand.
|
|
4442 |
.TP 4
|
|
4443 |
%i
|
|
4444 |
The number of times a process's resident set size was increased by the kernel.
|
|
4445 |
.TP 4
|
|
4446 |
%d
|
|
4447 |
The number of times a process's resident set size was decreased by the kernel.
|
|
4448 |
.TP 4
|
|
4449 |
%l
|
|
4450 |
The number of read system calls performed.
|
|
4451 |
.TP 4
|
|
4452 |
%m
|
|
4453 |
The number of write system calls performed.
|
|
4454 |
.TP 4
|
|
4455 |
%p
|
|
4456 |
The number of reads from raw disk devices.
|
|
4457 |
.TP 4
|
|
4458 |
%q
|
|
4459 |
The number of writes to raw disk devices.
|
|
4460 |
.PD
|
|
4461 |
.PP
|
|
4462 |
and the default time format is `%Uu %Ss %E %P %I+%Oio %Fpf+%Ww'.
|
|
4463 |
Note that the CPU percentage can be higher than 100% on multi-processors.
|
|
4464 |
.RE
|
|
4465 |
.TP 8
|
|
4466 |
.B tperiod \fR(+)
|
|
4467 |
The period, in minutes, between executions of the \fIperiodic\fR special alias.
|
|
4468 |
.TP 8
|
|
4469 |
.B tty \fR(+)
|
|
4470 |
The name of the tty, or empty if not attached to one.
|
|
4471 |
.TP 8
|
|
4472 |
.B uid \fR(+)
|
|
4473 |
The user's real user ID.
|
|
4474 |
.TP 8
|
|
4475 |
.B user
|
|
4476 |
The user's login name.
|
|
4477 |
.TP 8
|
|
4478 |
.B verbose
|
|
4479 |
If set, causes the words of each
|
|
4480 |
command to be printed, after history substitution (if any).
|
|
4481 |
Set by the \fB\-v\fR command line option.
|
|
4482 |
.TP 8
|
|
4483 |
.B version \fR(+)
|
|
4484 |
The version ID stamp. It contains the shell's version number (see \fBtcsh\fR),
|
|
4485 |
origin, release date, vendor, operating system and machine (see \fBVENDOR\fR,
|
|
4486 |
\fBOSTYPE\fR and \fBMACHTYPE\fR) and a comma-separated
|
|
4487 |
list of options which were set at compile time.
|
|
4488 |
Options which are set by default in the distribution are noted.
|
|
4489 |
.PP
|
|
4490 |
.RS +8
|
|
4491 |
.PD 0
|
|
4492 |
.TP 6
|
|
4493 |
8b
|
|
4494 |
The shell is eight bit clean; default
|
|
4495 |
.TP 6
|
|
4496 |
7b
|
|
4497 |
The shell is not eight bit clean
|
|
4498 |
.TP 6
|
|
4499 |
wide
|
|
4500 |
The shell is multibyte encoding clean (like UTF-8)
|
|
4501 |
.TP 6
|
|
4502 |
nls
|
|
4503 |
The system's NLS is used; default for systems with NLS
|
|
4504 |
.TP 6
|
|
4505 |
lf
|
|
4506 |
Login shells execute \fI/etc/.login\fR before instead of after
|
|
4507 |
\fI/etc/.cshrc\fR and \fI~/.login\fR before instead of after
|
|
4508 |
\fI~/.tcshrc\fR and \fI~/.history\fR.
|
|
4509 |
.TP 6
|
|
4510 |
dl
|
|
4511 |
`.' is put last in \fBpath\fR for security; default
|
|
4512 |
.TP 6
|
|
4513 |
nd
|
|
4514 |
`.' is omitted from \fBpath\fR for security
|
|
4515 |
.TP 6
|
|
4516 |
vi
|
|
4517 |
\fIvi\fR-style editing is the default rather than \fIemacs\fR
|
|
4518 |
.TP 6
|
|
4519 |
dtr
|
|
4520 |
Login shells drop DTR when exiting
|
|
4521 |
.TP 6
|
|
4522 |
bye
|
|
4523 |
\fIbye\fR is a synonym for \fIlogout\fR and \fIlog\fR
|
|
4524 |
is an alternate name for \fIwatchlog\fR
|
|
4525 |
.TP 6
|
|
4526 |
al
|
|
4527 |
\fBautologout\fR is enabled; default
|
|
4528 |
.TP 6
|
|
4529 |
kan
|
|
4530 |
Kanji is used if appropriate according to locale settings,
|
|
4531 |
unless the \fBnokanji\fR shell variable is set
|
|
4532 |
.TP 6
|
|
4533 |
sm
|
|
4534 |
The system's \fImalloc\fR(3C) is used
|
|
4535 |
.TP 6
|
|
4536 |
hb
|
|
4537 |
The `#!<program> <args>' convention is emulated when executing shell scripts
|
|
4538 |
.TP 6
|
|
4539 |
ng
|
|
4540 |
The \fInewgrp\fR builtin is available
|
|
4541 |
.TP 6
|
|
4542 |
rh
|
|
4543 |
The shell attempts to set the \fBREMOTEHOST\fR environment variable
|
|
4544 |
.TP 6
|
|
4545 |
afs
|
|
4546 |
The shell verifies your password with the kerberos server if local
|
|
4547 |
authentication fails. The \fBafsuser\fR shell variable or the
|
|
4548 |
\fBAFSUSER\fR environment variable override your local username if set.
|
|
4549 |
.PD
|
|
4550 |
.PP
|
|
4551 |
An administrator may enter additional strings to indicate differences
|
|
4552 |
in the local version.
|
|
4553 |
.RE
|
|
4554 |
.TP 8
|
|
4555 |
.B visiblebell \fR(+)
|
|
4556 |
If set, a screen flash is used rather than the audible bell.
|
|
4557 |
See also \fBnobeep\fR.
|
|
4558 |
.TP 8
|
|
4559 |
.B watch \fR(+)
|
|
4560 |
A list of user/terminal pairs to watch for logins and logouts.
|
|
4561 |
If either the user is `any' all terminals are watched for the given user
|
|
4562 |
and vice versa.
|
|
4563 |
Setting \fBwatch\fR to `(any any)' watches all users and terminals.
|
|
4564 |
For example,
|
|
4565 |
.RS +8
|
|
4566 |
.IP "" 4
|
|
4567 |
set watch = (george ttyd1 any console $user any)
|
|
4568 |
.PP
|
|
4569 |
reports activity of the user `george' on ttyd1, any user on the console, and
|
|
4570 |
oneself (or a trespasser) on any terminal.
|
|
4571 |
.PP
|
|
4572 |
Logins and logouts are checked every 10 minutes by default, but the first
|
|
4573 |
word of \fBwatch\fR can be set to a number to check every so many minutes.
|
|
4574 |
For example,
|
|
4575 |
.IP "" 4
|
|
4576 |
set watch = (1 any any)
|
|
4577 |
.PP
|
|
4578 |
reports any login/logout once every minute. For the impatient, the \fIlog\fR
|
|
4579 |
builtin command triggers a \fBwatch\fR report at any time. All current logins
|
|
4580 |
are reported (as with the \fIlog\fR builtin) when \fBwatch\fR is first set.
|
|
4581 |
.PP
|
|
4582 |
The \fBwho\fR shell variable controls the format of \fBwatch\fR reports.
|
|
4583 |
.RE
|
|
4584 |
.TP 8
|
|
4585 |
.B who \fR(+)
|
|
4586 |
The format string for \fBwatch\fR messages. The following sequences
|
|
4587 |
are replaced by the given information:
|
|
4588 |
.PP
|
|
4589 |
.RS +8
|
|
4590 |
.PD 0
|
|
4591 |
.TP 4
|
|
4592 |
%n
|
|
4593 |
The name of the user who logged in/out.
|
|
4594 |
.TP 4
|
|
4595 |
%a
|
|
4596 |
The observed action, i.e., `logged on', `logged off' or `replaced \fIolduser\fR on'.
|
|
4597 |
.TP 4
|
|
4598 |
%l
|
|
4599 |
The terminal (tty) on which the user logged in/out.
|
|
4600 |
.TP 4
|
|
4601 |
%M
|
|
4602 |
The full hostname of the remote host, or `local' if the login/logout was
|
|
4603 |
from the local host.
|
|
4604 |
.TP 4
|
|
4605 |
%m
|
|
4606 |
The hostname of the remote host up to the first `.'.
|
|
4607 |
The full name is printed if it is an IP address or an X Window System display.
|
|
4608 |
.PD
|
|
4609 |
.PP
|
|
4610 |
%M and %m are available on only systems that store the remote hostname in
|
|
4611 |
\fI/etc/utmp\fR or
|
|
4612 |
\fI/etc/utmpx\fR.
|
|
4613 |
If unset, `%n has %a %l from %m.' is used, or `%n has %a %l.' on systems
|
|
4614 |
which don't store the remote hostname.
|
|
4615 |
.RE
|
|
4616 |
.TP 8
|
|
4617 |
.B wordchars \fR(+)
|
|
4618 |
A list of non-alphanumeric characters to be considered part of a word by the
|
|
4619 |
\fIforward-word\fR, \fIbackward-word\fR etc., editor commands.
|
|
4620 |
If unset, `*?_\-.[]~=' is used.
|
|
4621 |
.SH ENVIRONMENT
|
|
4622 |
.TP 8
|
|
4623 |
.B AFSUSER \fR(+)
|
|
4624 |
Equivalent to the \fBafsuser\fR shell variable.
|
|
4625 |
.TP 8
|
|
4626 |
.B COLUMNS
|
|
4627 |
The number of columns in the terminal. See \fBTerminal management\fR.
|
|
4628 |
.TP 8
|
|
4629 |
.B DISPLAY
|
|
4630 |
Used by X Window System (see \fIX\fR(5)).
|
|
4631 |
If set, the shell does not set \fBautologout\fR (q.v.).
|
|
4632 |
.TP 8
|
|
4633 |
.B EDITOR
|
|
4634 |
The pathname to a default editor.
|
|
4635 |
See also the \fBVISUAL\fR environment variable
|
|
4636 |
and the \fIrun-fg-editor\fR editor command.
|
|
4637 |
.TP 8
|
|
4638 |
.B GROUP \fR(+)
|
|
4639 |
Equivalent to the \fBgroup\fR shell variable.
|
|
4640 |
.TP 8
|
|
4641 |
.B HOME
|
|
4642 |
Equivalent to the \fBhome\fR shell variable.
|
|
4643 |
.TP 8
|
|
4644 |
.B HOST \fR(+)
|
|
4645 |
Initialized to the name of the machine on which the shell
|
|
4646 |
is running, as determined by the \fIgethostname\fR(3C) library call.
|
|
4647 |
.TP 8
|
|
4648 |
.B HOSTTYPE \fR(+)
|
|
4649 |
Initialized to the type of machine on which the shell
|
|
4650 |
is running, as determined at compile time. This variable is obsolete and
|
|
4651 |
will be removed in a future version.
|
|
4652 |
.TP 8
|
|
4653 |
.B HPATH \fR(+)
|
|
4654 |
A colon-separated list of directories in which the \fIrun-help\fR editor
|
|
4655 |
command looks for command documentation.
|
|
4656 |
.TP 8
|
|
4657 |
.B LANG
|
|
4658 |
Gives the preferred character environment.
|
|
4659 |
See \fBNative Language System support\fR.
|
|
4660 |
.TP 8
|
|
4661 |
.B LC_CTYPE
|
|
4662 |
If set, only ctype character handling is changed.
|
|
4663 |
See \fBNative Language System support\fR.
|
|
4664 |
.TP 8
|
|
4665 |
.B LINES
|
|
4666 |
The number of lines in the terminal. See \fBTerminal management\fR.
|
|
4667 |
.TP 8
|
|
4668 |
.B LS_COLORS
|
|
4669 |
The format of this variable is reminiscent of the \fBtermcap(5)\fR
|
|
4670 |
file format; a colon-separated list of expressions of the form
|
|
4671 |
"\fIxx=string\fR", where "\fIxx\fR" is a two-character variable name. The
|
|
4672 |
variables with their associated defaults are:
|
|
4673 |
.PP
|
|
4674 |
.RS +8
|
|
4675 |
.RS +4
|
|
4676 |
.PD 0
|
|
4677 |
.TP 12
|
|
4678 |
no 0
|
|
4679 |
Normal (non-filename) text
|
|
4680 |
.TP 12
|
|
4681 |
fi 0
|
|
4682 |
Regular file
|
|
4683 |
.TP 12
|
|
4684 |
di 01;34
|
|
4685 |
Directory
|
|
4686 |
.TP 12
|
|
4687 |
ln 01;36
|
|
4688 |
Symbolic link
|
|
4689 |
.TP 12
|
|
4690 |
pi 33
|
|
4691 |
Named pipe (FIFO)
|
|
4692 |
.TP 12
|
|
4693 |
so 01;35
|
|
4694 |
Socket
|
|
4695 |
.TP 12
|
|
4696 |
do 01;35
|
|
4697 |
Door
|
|
4698 |
.TP 12
|
|
4699 |
bd 01;33
|
|
4700 |
Block device
|
|
4701 |
.TP 12
|
|
4702 |
cd 01;32
|
|
4703 |
Character device
|
|
4704 |
.TP 12
|
|
4705 |
ex 01;32
|
|
4706 |
Executable file
|
|
4707 |
.TP 12
|
|
4708 |
mi (none)
|
|
4709 |
Missing file (defaults to fi)
|
|
4710 |
.TP 12
|
|
4711 |
or (none)
|
|
4712 |
Orphaned symbolic link (defaults to ln)
|
|
4713 |
.TP 12
|
|
4714 |
lc ^[[
|
|
4715 |
Left code
|
|
4716 |
.TP 12
|
|
4717 |
rc m
|
|
4718 |
Right code
|
|
4719 |
.TP 12
|
|
4720 |
ec (none)
|
|
4721 |
End code (replaces lc+no+rc)
|
|
4722 |
.PD
|
|
4723 |
.RE
|
|
4724 |
.PP
|
|
4725 |
You need to include only the variables you want to change from
|
|
4726 |
the default.
|
|
4727 |
.PP
|
|
4728 |
File names can also be colorized based on filename extension.
|
|
4729 |
This is specified in the \fBLS_COLORS\fR variable using the syntax
|
|
4730 |
\fB"*ext=string"\fR. For example, using ISO 6429 codes, to color
|
|
4731 |
all C\-language source files blue you would specify \fB"*.c=34"\fR.
|
|
4732 |
This would color all files ending in \fB.c\fR in blue (34) color.
|
|
4733 |
.PP
|
|
4734 |
Control characters can be written either in C\-style\-escaped
|
|
4735 |
notation, or in stty\-like ^\-notation. The C\-style notation
|
|
4736 |
adds \fB^[\fR for Escape, \fB\_\fR for a normal space character,
|
|
4737 |
and \fB?\fR for Delete. In addition, the \fB^[\fR escape character
|
|
4738 |
can be used to override the default interpretation of \fB^[\fR,
|
|
4739 |
\fB^\fR, \fB:\fR and \fB=\fR.
|
|
4740 |
.PP
|
|
4741 |
Each file will be written as \fB<lc>\fR \fB<color-code>\fR
|
|
4742 |
\fB<rc>\fR \fB<filename>\fR \fB<ec>\fR. If the \fB<ec>\fR
|
|
4743 |
code is undefined, the sequence \fB<lc>\fR \fB<no>
|
|
4744 |
\fB<rc>\fR will be used instead. This is generally more convenient
|
|
4745 |
to use, but less general. The left, right and end codes are
|
|
4746 |
provided so you don't have to type common parts over and over
|
|
4747 |
again and to support weird terminals; you will generally not
|
|
4748 |
need to change them at all unless your terminal does not use
|
|
4749 |
ISO 6429 color sequences but a different system.
|
|
4750 |
.PP
|
|
4751 |
If your terminal does use ISO 6429 color codes, you can
|
|
4752 |
compose the type codes (i.e., all except the \fBlc\fR, \fBrc\fR,
|
|
4753 |
and \fBec\fR codes) from numerical commands separated by semicolons. The
|
|
4754 |
most common commands are:
|
|
4755 |
.PP
|
|
4756 |
.RS +8
|
|
4757 |
.PD 0
|
|
4758 |
.TP 4
|
|
4759 |
0
|
|
4760 |
to restore default color
|
|
4761 |
.TP 4
|
|
4762 |
1
|
|
4763 |
for brighter colors
|
|
4764 |
.TP 4
|
|
4765 |
4
|
|
4766 |
for underlined text
|
|
4767 |
.TP 4
|
|
4768 |
5
|
|
4769 |
for flashing text
|
|
4770 |
.TP 4
|
|
4771 |
30
|
|
4772 |
for black foreground
|
|
4773 |
.TP 4
|
|
4774 |
31
|
|
4775 |
for red foreground
|
|
4776 |
.TP 4
|
|
4777 |
32
|
|
4778 |
for green foreground
|
|
4779 |
.TP 4
|
|
4780 |
33
|
|
4781 |
for yellow (or brown) foreground
|
|
4782 |
.TP 4
|
|
4783 |
34
|
|
4784 |
for blue foreground
|
|
4785 |
.TP 4
|
|
4786 |
35
|
|
4787 |
for purple foreground
|
|
4788 |
.TP 4
|
|
4789 |
36
|
|
4790 |
for cyan foreground
|
|
4791 |
.TP 4
|
|
4792 |
37
|
|
4793 |
for white (or gray) foreground
|
|
4794 |
.TP 4
|
|
4795 |
40
|
|
4796 |
for black background
|
|
4797 |
.TP 4
|
|
4798 |
41
|
|
4799 |
for red background
|
|
4800 |
.TP 4
|
|
4801 |
42
|
|
4802 |
for green background
|
|
4803 |
.TP 4
|
|
4804 |
43
|
|
4805 |
for yellow (or brown) background
|
|
4806 |
.TP 4
|
|
4807 |
44
|
|
4808 |
for blue background
|
|
4809 |
.TP 4
|
|
4810 |
45
|
|
4811 |
for purple background
|
|
4812 |
.TP 4
|
|
4813 |
46
|
|
4814 |
for cyan background
|
|
4815 |
.TP 4
|
|
4816 |
47
|
|
4817 |
for white (or gray) background
|
|
4818 |
.PD
|
|
4819 |
.RE
|
|
4820 |
.PP
|
|
4821 |
Not all commands will work on all systems or display devices.
|
|
4822 |
.PP
|
|
4823 |
A few terminal programs do not recognize the default end code
|
|
4824 |
properly. If all text gets colorized after you do a directory
|
|
4825 |
listing, try changing the \fBno\fR and \fBfi\fR codes from 0 to the
|
|
4826 |
numerical codes for your standard fore- and background colors.
|
|
4827 |
.RE
|
|
4828 |
.TP 8
|
|
4829 |
.B MACHTYPE \fR(+)
|
|
4830 |
The machine type (microprocessor class or machine model), as determined at compile time.
|
|
4831 |
.TP 8
|
|
4832 |
.B NOREBIND \fR(+)
|
|
4833 |
If set, printable characters are not rebound to \fIself-insert-command\fR.
|
|
4834 |
See \fBNative Language System support\fR.
|
|
4835 |
.TP 8
|
|
4836 |
.B OSTYPE \fR(+)
|
|
4837 |
The operating system, as determined at compile time.
|
|
4838 |
.TP 8
|
|
4839 |
.B PATH
|
|
4840 |
A colon-separated list of directories in which to look for executables.
|
|
4841 |
Equivalent to the \fBpath\fR shell variable, but in a different format.
|
|
4842 |
.TP 8
|
|
4843 |
.B PWD \fR(+)
|
|
4844 |
Equivalent to the \fBcwd\fR shell variable, but not synchronized to it;
|
|
4845 |
updated only after an actual directory change.
|
|
4846 |
.TP 8
|
|
4847 |
.B REMOTEHOST \fR(+)
|
|
4848 |
The host from which the user has logged in remotely, if this is the case and
|
|
4849 |
the shell is able to determine it. Set only if the shell was so compiled;
|
|
4850 |
see the \fBversion\fR shell variable.
|
|
4851 |
.TP 8
|
|
4852 |
.B SHLVL \fR(+)
|
|
4853 |
Equivalent to the \fBshlvl\fR shell variable.
|
|
4854 |
.TP 8
|
|
4855 |
.B SYSTYPE \fR(+)
|
|
4856 |
The current system type. (Domain/OS only)
|
|
4857 |
.TP 8
|
|
4858 |
.B TERM
|
|
4859 |
Equivalent to the \fBterm\fR shell variable.
|
|
4860 |
.TP 8
|
|
4861 |
.B TERMCAP
|
|
4862 |
The terminal capability string. See \fBTerminal management\fR.
|
|
4863 |
.TP 8
|
|
4864 |
.B USER
|
|
4865 |
Equivalent to the \fBuser\fR shell variable.
|
|
4866 |
.TP 8
|
|
4867 |
.B VENDOR \fR(+)
|
|
4868 |
The vendor, as determined at compile time.
|
|
4869 |
.TP 8
|
|
4870 |
.B VISUAL
|
|
4871 |
The pathname to a default full-screen editor.
|
|
4872 |
See also the \fBEDITOR\fR environment variable
|
|
4873 |
and the \fIrun-fg-editor\fR editor command.
|
|
4874 |
.SH FILES
|
|
4875 |
.PD 0
|
|
4876 |
.TP 16
|
|
4877 |
.I /etc/csh.cshrc
|
|
4878 |
Read first by every shell.
|
|
4879 |
ConvexOS, Stellix and Intel use \fI/etc/cshrc\fR and
|
|
4880 |
NeXTs use \fI/etc/cshrc.std\fR.
|
|
4881 |
A/UX, AMIX, Cray and IRIX have no equivalent in \fIcsh\fR(1),
|
|
4882 |
but read this file in \fItcsh\fR anyway.
|
|
4883 |
Solaris does not have it either, but \fItcsh\fR reads \fI/etc/.cshrc\fR. (+)
|
|
4884 |
.TP 16
|
|
4885 |
.I /etc/csh.login
|
|
4886 |
Read by login shells after \fI/etc/csh.cshrc\fR.
|
|
4887 |
ConvexOS, Stellix and Intel use \fI/etc/login\fR,
|
|
4888 |
NeXTs use \fI/etc/login.std\fR, Solaris uses \fI/etc/.login\fR and
|
|
4889 |
A/UX, AMIX, Cray and IRIX use \fI/etc/cshrc\fR.
|
|
4890 |
.TP 16
|
|
4891 |
.I ~/.tcshrc \fR(+)
|
|
4892 |
Read by every shell after \fI/etc/csh.cshrc\fR or its equivalent.
|
|
4893 |
.TP 16
|
|
4894 |
.I ~/.cshrc
|
|
4895 |
Read by every shell, if \fI~/.tcshrc\fR doesn't exist,
|
|
4896 |
after \fI/etc/csh.cshrc\fR or its equivalent.
|
|
4897 |
This manual uses `\fI~/.tcshrc\fR' to mean `\fI~/.tcshrc\fR or,
|
|
4898 |
if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR'.
|
|
4899 |
.TP 16
|
|
4900 |
.I ~/.history
|
|
4901 |
Read by login shells after \fI~/.tcshrc\fR
|
|
4902 |
if \fBsavehist\fR is set, but see also \fBhistfile\fR.
|
|
4903 |
.TP 16
|
|
4904 |
.I ~/.login
|
|
4905 |
Read by login shells after \fI~/.tcshrc\fR or \fI~/.history\fR.
|
|
4906 |
The shell may be compiled to read \fI~/.login\fR before instead of after
|
|
4907 |
\fI~/.tcshrc\fR and \fI~/.history\fR; see the \fBversion\fR shell variable.
|
|
4908 |
.TP 16
|
|
4909 |
.I ~/.cshdirs \fR(+)
|
|
4910 |
Read by login shells after \fI~/.login\fR
|
|
4911 |
if \fBsavedirs\fR is set, but see also \fBdirsfile\fR.
|
|
4912 |
.TP 16
|
|
4913 |
.I /etc/csh.logout
|
|
4914 |
Read by login shells at logout.
|
|
4915 |
ConvexOS, Stellix and Intel use \fI/etc/logout\fR and
|
|
4916 |
NeXTs use \fI/etc/logout.std\fR.
|
|
4917 |
A/UX, AMIX, Cray and IRIX have no equivalent in \fIcsh\fR(1),
|
|
4918 |
but read this file in \fItcsh\fR anyway.
|
|
4919 |
Solaris 2.x does not have it either, but \fItcsh\fR reads \fI/etc/.logout\fR. (+)
|
|
4920 |
.TP 16
|
|
4921 |
.I ~/.logout
|
|
4922 |
Read by login shells at logout after \fI/etc/csh.logout\fR or its equivalent.
|
|
4923 |
.TP 16
|
|
4924 |
.I /bin/sh
|
|
4925 |
Used to interpret shell scripts not starting with a `#'.
|
|
4926 |
.TP 16
|
|
4927 |
.I /tmp/sh*
|
|
4928 |
Temporary file for `<<'.
|
|
4929 |
.TP 16
|
|
4930 |
.I /etc/passwd
|
|
4931 |
Source of home directories for `~name' substitutions.
|
|
4932 |
.PD
|
|
4933 |
.PP
|
|
4934 |
The order in which startup files are read may differ if the shell was so
|
|
4935 |
compiled; see \fBStartup and shutdown\fR and the \fBversion\fR shell variable.
|
|
4936 |
.SH "NEW FEATURES (+)"
|
|
4937 |
This manual describes \fItcsh\fR as a single entity,
|
|
4938 |
but experienced \fIcsh\fR(1) users will want to pay special attention to
|
|
4939 |
\fItcsh\fR's new features.
|
|
4940 |
.PP
|
|
4941 |
A command-line editor, which supports GNU Emacs or \fIvi\fR(1)-style
|
|
4942 |
key bindings. See \fBThe command-line editor\fR and \fBEditor commands\fR.
|
|
4943 |
.PP
|
|
4944 |
Programmable, interactive word completion and listing.
|
|
4945 |
See \fBCompletion and listing\fR and the \fIcomplete\fR and \fIuncomplete\fR
|
|
4946 |
builtin commands.
|
|
4947 |
.PP
|
|
4948 |
\fBSpelling correction\fR (q.v.) of filenames, commands and variables.
|
|
4949 |
.PP
|
|
4950 |
\fBEditor commands\fR (q.v.) which perform other useful functions in the middle of
|
|
4951 |
typed commands, including documentation lookup (\fIrun-help\fR),
|
|
4952 |
quick editor restarting (\fIrun-fg-editor\fR) and
|
|
4953 |
command resolution (\fIwhich-command\fR).
|
|
4954 |
.PP
|
|
4955 |
An enhanced history mechanism. Events in the history list are time-stamped.
|
|
4956 |
See also the \fIhistory\fR command and its associated shell variables,
|
|
4957 |
the previously undocumented `#' event specifier and new modifiers
|
|
4958 |
under \fBHistory substitution\fR,
|
|
4959 |
the \fI*-history\fR, \fIhistory-search-*\fR, \fIi-search-*\fR, \fIvi-search-*\fR and
|
|
4960 |
\fItoggle-literal-history\fR editor commands
|
|
4961 |
and the \fBhistlit\fR shell variable.
|
|
4962 |
.PP
|
|
4963 |
Enhanced directory parsing and directory stack handling.
|
|
4964 |
See the \fIcd\fR, \fIpushd\fR, \fIpopd\fR and \fIdirs\fR commands and their associated
|
|
4965 |
shell variables, the description of \fBDirectory stack substitution\fR,
|
|
4966 |
the \fBdirstack\fR, \fBowd\fR and \fBsymlinks\fR shell variables and
|
|
4967 |
the \fInormalize-command\fR and \fInormalize-path\fR editor commands.
|
|
4968 |
.PP
|
|
4969 |
Negation in glob-patterns. See \fBFilename substitution\fR.
|
|
4970 |
.PP
|
|
4971 |
New \fBFile inquiry operators\fR (q.v.) and a \fIfiletest\fR
|
|
4972 |
builtin which uses them.
|
|
4973 |
.PP
|
|
4974 |
A variety of \fBAutomatic, periodic and timed events\fR (q.v.) including
|
|
4975 |
scheduled events, special aliases, automatic logout and terminal locking,
|
|
4976 |
command timing and watching for logins and logouts.
|
|
4977 |
.PP
|
|
4978 |
Support for the Native Language System
|
|
4979 |
(see \fBNative Language System support\fR),
|
|
4980 |
OS variant features
|
|
4981 |
(see \fBOS variant support\fR and the \fBecho_style\fR shell variable)
|
|
4982 |
and system-dependent file locations (see \fBFILES\fR).
|
|
4983 |
.PP
|
|
4984 |
Extensive terminal-management capabilities. See \fBTerminal management\fR.
|
|
4985 |
.PP
|
|
4986 |
New builtin commands including \fIbuiltins\fR, \fIhup\fR, \fIls\-F\fR,
|
|
4987 |
\fInewgrp\fR, \fIprintenv\fR, \fIwhich\fR and \fIwhere\fR (q.v.).
|
|
4988 |
.PP
|
|
4989 |
New variables that make useful information easily available to the shell.
|
|
4990 |
See the \fBgid\fR, \fBloginsh\fR, \fBoid\fR, \fBshlvl\fR, \fBtcsh\fR,
|
|
4991 |
\fBtty\fR, \fBuid\fR and \fBversion\fR shell variables and the \fBHOST\fR,
|
|
4992 |
\fBREMOTEHOST\fR, \fBVENDOR\fR, \fBOSTYPE\fR and \fBMACHTYPE\fR environment
|
|
4993 |
variables.
|
|
4994 |
.PP
|
|
4995 |
A new syntax for including useful information in the prompt string
|
|
4996 |
(see \fBprompt\fR).
|
|
4997 |
and special prompts for loops and spelling correction
|
|
4998 |
(see \fBprompt2\fR and \fBprompt3\fR).
|
|
4999 |
.PP
|
|
5000 |
Read-only variables. See \fBVariable substitution\fR.
|
|
5001 |
.SH BUGS
|
|
5002 |
When a suspended command is restarted, the shell prints the directory
|
|
5003 |
it started in if this is different from the current directory. This can
|
|
5004 |
be misleading (i.e., wrong) as the job may have changed directories internally.
|
|
5005 |
.PP
|
|
5006 |
Shell builtin functions are not stoppable/restartable. Command sequences
|
|
5007 |
of the form `a ; b ; c' are also not handled gracefully when stopping is
|
|
5008 |
attempted. If you suspend `b', the shell will then immediately execute
|
|
5009 |
`c'. This is especially noticeable if this expansion results from an
|
|
5010 |
\fIalias\fR. It suffices to place the sequence of commands in ()'s to force it
|
|
5011 |
to a subshell, i.e., `( a ; b ; c )'.
|
|
5012 |
.PP
|
|
5013 |
Control over tty output after processes are started is primitive; perhaps
|
|
5014 |
this will inspire someone to work on a good virtual terminal interface.
|
|
5015 |
In a virtual terminal interface much more interesting things could be
|
|
5016 |
done with output control.
|
|
5017 |
.PP
|
|
5018 |
Alias substitution is most often used to clumsily simulate shell procedures;
|
|
5019 |
shell procedures should be provided rather than aliases.
|
|
5020 |
.PP
|
|
5021 |
Commands within loops are not placed in the history
|
|
5022 |
list. Control structures should be parsed rather than being recognized as
|
|
5023 |
built-in commands. This would allow control commands to be placed anywhere,
|
|
5024 |
to be combined with `|', and to be used with `&' and `;' metasyntax.
|
|
5025 |
.PP
|
|
5026 |
\fIforeach\fR doesn't ignore here documents when looking for its \fIend\fR.
|
|
5027 |
.PP
|
|
5028 |
It should be possible to use the `:' modifiers on the output of command
|
|
5029 |
substitutions.
|
|
5030 |
.PP
|
|
5031 |
The screen update for lines longer than the screen width is very poor
|
|
5032 |
if the terminal cannot move the cursor up (i.e., terminal type `dumb').
|
|
5033 |
.PP
|
|
5034 |
\fBHPATH\fR and \fBNOREBIND\fR don't need to be environment variables.
|
|
5035 |
.PP
|
|
5036 |
Glob-patterns which do not use `?', `*' or `[]' or which use `{}' or `~'
|
|
5037 |
are not negated correctly.
|
|
5038 |
.PP
|
|
5039 |
The single-command form of \fIif\fR does output redirection even if
|
|
5040 |
the expression is false and the command is not executed.
|
|
5041 |
.PP
|
|
5042 |
\fIls\-F\fR includes file identification characters when sorting filenames
|
|
5043 |
and does not handle control characters in filenames well. It cannot be
|
|
5044 |
interrupted.
|
|
5045 |
.PP
|
|
5046 |
Command substitution supports multiple commands and conditions, but not
|
|
5047 |
cycles or backward \fIgoto\fRs.
|
|
5048 |
.PP
|
|
5049 |
Report bugs at http://bugs.gw.com/, preferably with fixes. If you want to
|
|
5050 |
help maintain and test tcsh, send mail to [email protected] with the
|
|
5051 |
text `subscribe tcsh' on a line by itself in the body.
|
|
5052 |
.SH THE T IN TCSH
|
|
5053 |
In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementation. It
|
|
5054 |
was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
|
|
5055 |
second model, the KI10.
|
|
5056 |
.PP
|
|
5057 |
TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
|
|
5058 |
think tank) in
|
|
5059 |
1972 as an experiment in demand-paged virtual memory operating systems. They
|
|
5060 |
built a new pager for the DEC PDP-10 and created the OS to go with it. It was
|
|
5061 |
extremely successful in academia.
|
|
5062 |
.PP
|
|
5063 |
In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
|
|
5064 |
have only a version of TENEX, which they had licensed from BBN, for the new
|
|
5065 |
box. They called their version TOPS-20 (their capitalization is trademarked).
|
|
5066 |
A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
|
|
5067 |
found themselves supporting two incompatible systems on the same hardware--but
|
|
5068 |
then there were 6 on the PDP-11!
|
|
5069 |
.PP
|
|
5070 |
TENEX, and TOPS-20 to version 3, had command completion
|
|
5071 |
via a user-code-level subroutine library called ULTCMD. With version 3, DEC
|
|
5072 |
moved all that capability and more into the monitor (`kernel' for you Unix
|
|
5073 |
types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
|
|
5074 |
supervisor call mechanism [are my IBM roots also showing?]).
|
|
5075 |
.PP
|
|
5076 |
The creator of tcsh was impressed by this feature and several others of TENEX
|
|
5077 |
and TOPS-20, and created a version of csh which mimicked them.
|
|
5078 |
.SH LIMITATIONS
|
|
5079 |
The system limits argument lists to ARG_MAX characters.
|
|
5080 |
.PP
|
|
5081 |
The number of arguments to a command which involves filename expansion is
|
|
5082 |
limited to 1/6th the number of characters allowed in an argument list.
|
|
5083 |
.PP
|
|
5084 |
Command substitutions may substitute no more characters than are allowed in
|
|
5085 |
an argument list.
|
|
5086 |
.PP
|
|
5087 |
To detect looping, the shell restricts the number of \fIalias\fR
|
|
5088 |
substitutions on a single line to 20.
|
|
5089 |
.SH "SEE ALSO"
|
|
5090 |
csh(1), emacs(1), ls(1), newgrp(1), sh(1), stty(1), su(1M),
|
|
5091 |
tset(1B), vi(1), X(5), access(2), execve(2), fork(2), killpg(3C),
|
|
5092 |
pipe(2), setrlimit(2), sigvec(3UCB), stat(2), umask(2), vfork(2), wait(2),
|
|
5093 |
malloc(3C), setlocale(3C), tty(7D), a.out(4), terminfo(4), environ(5),
|
|
5094 |
termio(7I), Introduction to the C Shell
|
|
5095 |
.SH VERSION
|
|
5096 |
This manual documents tcsh 6.17.00 (Astron) 2009-07-10.
|
|
5097 |
.SH AUTHORS
|
|
5098 |
.PD 0
|
|
5099 |
.TP 2
|
|
5100 |
William Joy
|
|
5101 |
Original author of \fIcsh\fR(1)
|
|
5102 |
.TP 2
|
|
5103 |
J.E. Kulp, IIASA, Laxenburg, Austria
|
|
5104 |
Job control and directory stack features
|
|
5105 |
.TP 2
|
|
5106 |
Ken Greer, HP Labs, 1981
|
|
5107 |
File name completion
|
|
5108 |
.TP 2
|
|
5109 |
Mike Ellis, Fairchild, 1983
|
|
5110 |
Command name recognition/completion
|
|
5111 |
.TP 2
|
|
5112 |
Paul Placeway, Ohio State CIS Dept., 1983-1993
|
|
5113 |
Command line editor, prompt routines, new glob syntax and numerous fixes
|
|
5114 |
and speedups
|
|
5115 |
.TP 2
|
|
5116 |
Karl Kleinpaste, CCI 1983-4
|
|
5117 |
Special aliases, directory stack extraction stuff, login/logout watch,
|
|
5118 |
scheduled events, and the idea of the new prompt format
|
|
5119 |
.TP 2
|
|
5120 |
Rayan Zachariassen, University of Toronto, 1984
|
|
5121 |
\fIls\-F\fR and \fIwhich\fR builtins and numerous bug fixes, modifications
|
|
5122 |
and speedups
|
|
5123 |
.TP 2
|
|
5124 |
Chris Kingsley, Caltech
|
|
5125 |
Fast storage allocator routines
|
|
5126 |
.TP 2
|
|
5127 |
Chris Grevstad, TRW, 1987
|
|
5128 |
Incorporated 4.3BSD \fIcsh\fR into \fItcsh\fR
|
|
5129 |
.TP 2
|
|
5130 |
Christos S. Zoulas, Cornell U. EE Dept., 1987-94
|
|
5131 |
Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
|
|
5132 |
and a new version of sh.glob.c
|
|
5133 |
.TP 2
|
|
5134 |
James J Dempsey, BBN, and Paul Placeway, OSU, 1988
|
|
5135 |
A/UX port
|
|
5136 |
.TP 2
|
|
5137 |
Daniel Long, NNSC, 1988
|
|
5138 |
\fBwordchars\fR
|
|
5139 |
.TP 2
|
|
5140 |
Patrick Wolfe, Kuck and Associates, Inc., 1988
|
|
5141 |
\fIvi\fR mode cleanup
|
|
5142 |
.TP 2
|
|
5143 |
David C Lawrence, Rensselaer Polytechnic Institute, 1989
|
|
5144 |
\fBautolist\fR and ambiguous completion listing
|
|
5145 |
.TP 2
|
|
5146 |
Alec Wolman, DEC, 1989
|
|
5147 |
Newlines in the prompt
|
|
5148 |
.TP 2
|
|
5149 |
Matt Landau, BBN, 1989
|
|
5150 |
\fI~/.tcshrc\fR
|
|
5151 |
.TP 2
|
|
5152 |
Ray Moody, Purdue Physics, 1989
|
|
5153 |
Magic space bar history expansion
|
|
5154 |
.TP 2
|
|
5155 |
Mordechai ????, Intel, 1989
|
|
5156 |
printprompt() fixes and additions
|
|
5157 |
.TP 2
|
|
5158 |
Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
|
|
5159 |
Automatic spelling correction and \fBprompt3\fR
|
|
5160 |
.TP 2
|
|
5161 |
Per Hedeland, Ellemtel, Sweden, 1990-
|
|
5162 |
Various bugfixes, improvements and manual updates
|
|
5163 |
.TP 2
|
|
5164 |
Hans J. Albertsson (Sun Sweden)
|
|
5165 |
\fBampm\fR, \fIsettc\fR and \fItelltc\fR
|
|
5166 |
.TP 2
|
|
5167 |
Michael Bloom
|
|
5168 |
Interrupt handling fixes
|
|
5169 |
.TP 2
|
|
5170 |
Michael Fine, Digital Equipment Corp
|
|
5171 |
Extended key support
|
|
5172 |
.TP 2
|
|
5173 |
Eric Schnoebelen, Convex, 1990
|
|
5174 |
Convex support, lots of \fIcsh\fR bug fixes,
|
|
5175 |
save and restore of directory stack
|
|
5176 |
.TP 2
|
|
5177 |
Ron Flax, Apple, 1990
|
|
5178 |
A/UX 2.0 (re)port
|
|
5179 |
.TP 2
|
|
5180 |
Dan Oscarsson, LTH Sweden, 1990
|
|
5181 |
NLS support and simulated NLS support for non NLS sites, fixes
|
|
5182 |
.TP 2
|
|
5183 |
Johan Widen, SICS Sweden, 1990
|
|
5184 |
\fBshlvl\fR, Mach support, \fIcorrect-line\fR, 8-bit printing
|
|
5185 |
.TP 2
|
|
5186 |
Matt Day, Sanyo Icon, 1990
|
|
5187 |
POSIX termio support, SysV limit fixes
|
|
5188 |
.TP 2
|
|
5189 |
Jaap Vermeulen, Sequent, 1990-91
|
|
5190 |
Vi mode fixes, expand-line, window change fixes, Symmetry port
|
|
5191 |
.TP 2
|
|
5192 |
Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
|
|
5193 |
\fBautolist\fR beeping options, modified the history search to search for
|
|
5194 |
the whole string from the beginning of the line to the cursor.
|
|
5195 |
.TP 2
|
|
5196 |
Scott Krotz, Motorola, 1991
|
|
5197 |
Minix port
|
|
5198 |
.TP 2
|
|
5199 |
David Dawes, Sydney U. Australia, Physics Dept., 1991
|
|
5200 |
SVR4 job control fixes
|
|
5201 |
.TP 2
|
|
5202 |
Jose Sousa, Interactive Systems Corp., 1991
|
|
5203 |
Extended \fIvi\fR fixes and \fIvi\fR delete command
|
|
5204 |
.TP 2
|
|
5205 |
Marc Horowitz, MIT, 1991
|
|
5206 |
ANSIfication fixes, new exec hashing code, imake fixes, \fIwhere\fR
|
|
5207 |
.TP 2
|
|
5208 |
Bruce Sterling Woodcock, [email protected], 1991-1995
|
|
5209 |
ETA and Pyramid port, Makefile and lint fixes, \fBignoreeof\fR=n addition, and
|
|
5210 |
various other portability changes and bug fixes
|
|
5211 |
.TP 2
|
|
5212 |
Jeff Fink, 1992
|
|
5213 |
\fIcomplete-word-fwd\fR and \fIcomplete-word-back\fR
|
|
5214 |
.TP 2
|
|
5215 |
Harry C. Pulley, 1992
|
|
5216 |
Coherent port
|
|
5217 |
.TP 2
|
|
5218 |
Andy Phillips, Mullard Space Science Lab U.K., 1992
|
|
5219 |
VMS-POSIX port
|
|
5220 |
.TP 2
|
|
5221 |
Beto Appleton, IBM Corp., 1992
|
|
5222 |
Walking process group fixes, \fIcsh\fR bug fixes,
|
|
5223 |
POSIX file tests, POSIX SIGHUP
|
|
5224 |
.TP 2
|
|
5225 |
Scott Bolte, Cray Computer Corp., 1992
|
|
5226 |
CSOS port
|
|
5227 |
.TP 2
|
|
5228 |
Kaveh R. Ghazi, Rutgers University, 1992
|
|
5229 |
Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf support.
|
|
5230 |
.TP 2
|
|
5231 |
Mark Linderman, Cornell University, 1992
|
|
5232 |
OS/2 port
|
|
5233 |
.TP 2
|
|
5234 |
Mika Liljeberg, [email protected], 1992
|
|
5235 |
Linux port
|
|
5236 |
.TP 2
|
|
5237 |
Tim P. Starrin, NASA Langley Research Center Operations, 1993
|
|
5238 |
Read-only variables
|
|
5239 |
.TP 2
|
|
5240 |
Dave Schweisguth, Yale University, 1993-4
|
|
5241 |
New man page and tcsh.man2html
|
|
5242 |
.TP 2
|
|
5243 |
Larry Schwimmer, Stanford University, 1993
|
|
5244 |
AFS and HESIOD patches
|
|
5245 |
.TP 2
|
|
5246 |
Luke Mewburn, RMIT University, 1994-6
|
|
5247 |
Enhanced directory printing in prompt,
|
|
5248 |
added \fBellipsis\fR and \fBrprompt\fR.
|
|
5249 |
.TP 2
|
|
5250 |
Edward Hutchins, Silicon Graphics Inc., 1996
|
|
5251 |
Added implicit cd.
|
|
5252 |
.TP 2
|
|
5253 |
Martin Kraemer, 1997
|
|
5254 |
Ported to Siemens Nixdorf EBCDIC machine
|
|
5255 |
.TP 2
|
|
5256 |
Amol Deshpande, Microsoft, 1997
|
|
5257 |
Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
|
|
5258 |
and message catalog code to interface to Windows.
|
|
5259 |
.TP 2
|
|
5260 |
Taga Nayuta, 1998
|
|
5261 |
Color ls additions.
|
|
5262 |
.PD
|
|
5263 |
.PP
|
|
5264 |
.SH "THANKS TO"
|
|
5265 |
Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
|
|
5266 |
Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
|
|
5267 |
the other people at Ohio State for suggestions and encouragement
|
|
5268 |
.PP
|
|
5269 |
All the people on the net, for putting up with,
|
|
5270 |
reporting bugs in, and suggesting new additions to each and every version
|
|
5271 |
.PP
|
|
5272 |
Richard M. Alderson III, for writing the `T in tcsh' section
|
|
5273 |
|
|
5274 |
.SH ATTRIBUTES
|
|
5275 |
See
|
|
5276 |
.BR attributes (5)
|
|
5277 |
for descriptions of the following attributes:
|
|
5278 |
.sp
|
|
5279 |
.TS
|
|
5280 |
box;
|
|
5281 |
cbp-1 | cbp-1
|
|
5282 |
l | l .
|
|
5283 |
ATTRIBUTE TYPE ATTRIBUTE VALUE
|
|
5284 |
=
|
11
|
5285 |
Availability shell/tcsh
|
0
|
5286 |
=
|
|
5287 |
Interface Stability Volatile
|
|
5288 |
.TE
|
|
5289 |
|
|
5290 |
.SH "NOTES"
|
|
5291 |
Source for tcsh is available on http://opensolaris.org.
|
|
5292 |
.PP
|
|
5293 |
It is no longer possible for variables to have a '-' or a '=' within the
|
|
5294 |
name. Any variables of this form will generate a 'setenv: Syntax error'
|
|
5295 |
error message.
|