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