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