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