1TCSH(1) General Commands Manual TCSH(1)
2
3
4
6 tcsh - C shell with file name completion and command line editing
7
9 tcsh [-bcdefFimnqstvVxX] [-Dname[=value]] [arg ...]
10 tcsh -l
11
13 tcsh is an enhanced but completely compatible version of the Berkeley
14 UNIX C shell, csh(1). It is a command language interpreter usable both
15 as an interactive login shell and a shell script command processor. It
16 includes a command-line editor (see The command-line editor), program‐
17 mable word completion (see Completion and listing), spelling correction
18 (see Spelling correction), a history mechanism (see History substitu‐
19 tion), job control (see Jobs) and a C-like syntax. The NEW FEATURES
20 section describes major enhancements of tcsh over csh(1). Throughout
21 this manual, features of tcsh not found in most csh(1) implementations
22 (specifically, the 4.4BSD csh) are labeled with `(+)', and features
23 which are present in csh(1) but not usually documented are labeled with
24 `(u)'.
25
26 Argument list processing
27 If the first argument (argument 0) to the shell is `-' then it is a
28 login shell. A login shell can be also specified by invoking the shell
29 with the -l flag as the only argument.
30
31 The rest of the flag arguments are interpreted as follows:
32
33 -b Forces a ``break'' from option processing, causing any further
34 shell arguments to be treated as non-option arguments. The remain‐
35 ing arguments will not be interpreted as shell options. This may
36 be used to pass options to a shell script without confusion or pos‐
37 sible subterfuge. The shell will not run a set-user ID script
38 without this option.
39
40 -c Commands are read from the following argument (which must be
41 present, and must be a single argument), stored in the command
42 shell variable for reference, and executed. Any remaining argu‐
43 ments are placed in the argv shell variable.
44
45 -d The shell loads the directory stack from ~/.cshdirs as described
46 under Startup and shutdown, whether or not it is a login shell. (+)
47
48 -Dname[=value]
49 Sets the environment variable name to value. (Domain/OS only) (+)
50
51 -e The shell exits if any invoked command terminates abnormally or
52 yields a non-zero exit status.
53
54 -f The shell does not load any resource or startup files, or perform
55 any command hashing, and thus starts faster.
56
57 -F The shell uses fork(2) instead of vfork(2) to spawn processes. (+)
58
59 -i The shell is interactive and prompts for its top-level input, even
60 if it appears to not be a terminal. Shells are interactive without
61 this option if their inputs and outputs are terminals.
62
63 -l The shell is a login shell. Applicable only if -l is the only flag
64 specified.
65
66 -m The shell loads ~/.tcshrc even if it does not belong to the effec‐
67 tive user. Newer versions of su(1) can pass -m to the shell. (+)
68
69 -n The shell parses commands but does not execute them. This aids in
70 debugging shell scripts.
71
72 -q The shell accepts SIGQUIT (see Signal handling) and behaves when it
73 is used under a debugger. Job control is disabled. (u)
74
75 -s Command input is taken from the standard input.
76
77 -t The shell reads and executes a single line of input. A `\' may be
78 used to escape the newline at the end of this line and continue
79 onto another line.
80
81 -v Sets the verbose shell variable, so that command input is echoed
82 after history substitution.
83
84 -x Sets the echo shell variable, so that commands are echoed immedi‐
85 ately before execution.
86
87 -V Sets the verbose shell variable even before executing ~/.tcshrc.
88
89 -X Is to -x as -V is to -v.
90
91 --help
92 Print a help message on the standard output and exit. (+)
93
94 --version
95 Print the version/platform/compilation options on the standard out‐
96 put and exit. This information is also contained in the version
97 shell variable. (+)
98
99 After processing of flag arguments, if arguments remain but none of the
100 -c, -i, -s, or -t options were given, the first argument is taken as
101 the name of a file of commands, or ``script'', to be executed. The
102 shell opens this file and saves its name for possible resubstitution by
103 `$0'. Because many systems use either the standard version 6 or ver‐
104 sion 7 shells whose shell scripts are not compatible with this shell,
105 the shell uses such a `standard' shell to execute a script whose first
106 character is not a `#', i.e., that does not start with a comment.
107
108 Remaining arguments are placed in the argv shell variable.
109
110 Startup and shutdown
111 A login shell begins by executing commands from the system files
112 /etc/csh.cshrc and /etc/csh.login. It then executes commands from
113 files in the user's home directory: first ~/.tcshrc (+) or, if
114 ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the
115 histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the
116 value of the dirsfile shell variable) (+). The shell may read
117 /etc/csh.login before instead of after /etc/csh.cshrc, and ~/.login
118 before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so
119 compiled; see the version shell variable. (+)
120
121 Non-login shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on
122 startup.
123
124 For examples of startup files, please consult http://tcshrc.source‐
125 forge.net.
126
127 Commands like stty(1) and tset(1), which need be run only once per
128 login, usually go in one's ~/.login file. Users who need to use the
129 same set of files with both csh(1) and tcsh can have only a ~/.cshrc
130 which checks for the existence of the tcsh shell variable (q.v.) before
131 using tcsh-specific commands, or can have both a ~/.cshrc and a
132 ~/.tcshrc which sources (see the builtin command) ~/.cshrc. The rest
133 of this manual uses `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is
134 not found, ~/.cshrc'.
135
136 In the normal case, the shell begins reading commands from the termi‐
137 nal, prompting with `> '. (Processing of arguments and the use of the
138 shell to process files containing command scripts are described later.)
139 The shell repeatedly reads a line of command input, breaks it into
140 words, places it on the command history list, parses it and executes
141 each command in the line.
142
143 One can log out by typing `^D' on an empty line, `logout' or `login' or
144 via the shell's autologout mechanism (see the autologout shell vari‐
145 able). When a login shell terminates it sets the logout shell variable
146 to `normal' or `automatic' as appropriate, then executes commands from
147 the files /etc/csh.logout and ~/.logout. The shell may drop DTR on
148 logout if so compiled; see the version shell variable.
149
150 The names of the system login and logout files vary from system to sys‐
151 tem for compatibility with different csh(1) variants; see FILES.
152
153 Editing
154 We first describe The command-line editor. The Completion and listing
155 and Spelling correction sections describe two sets of functionality
156 that are implemented as editor commands but which deserve their own
157 treatment. Finally, Editor commands lists and describes the editor
158 commands specific to the shell and their default bindings.
159
160 The command-line editor (+)
161 Command-line input can be edited using key sequences much like those
162 used in GNU Emacs or vi(1). The editor is active only when the edit
163 shell variable is set, which it is by default in interactive shells.
164 The bindkey builtin can display and change key bindings. Emacs-style
165 key bindings are used by default (unless the shell was compiled other‐
166 wise; see the version shell variable), but bindkey can change the key
167 bindings to vi-style bindings en masse.
168
169 The shell always binds the arrow keys (as defined in the TERMCAP envi‐
170 ronment variable) to
171
172 down down-history
173 up up-history
174 left backward-char
175 right forward-char
176
177 unless doing so would alter another single-character binding. One can
178 set the arrow key escape sequences to the empty string with settc to
179 prevent these bindings. The ANSI/VT100 sequences for arrow keys are
180 always bound.
181
182 Other key bindings are, for the most part, what Emacs and vi(1) users
183 would expect and can easily be displayed by bindkey, so there is no
184 need to list them here. Likewise, bindkey can list the editor commands
185 with a short description of each.
186
187 Note that editor commands do not have the same notion of a ``word'' as
188 does the shell. The editor delimits words with any non-alphanumeric
189 characters not in the shell variable wordchars, while the shell recog‐
190 nizes only whitespace and some of the characters with special meanings
191 to it, listed under Lexical structure.
192
193 Completion and listing (+)
194 The shell is often able to complete words when given a unique abbrevia‐
195 tion. Type part of a word (for example `ls /usr/lost') and hit the tab
196 key to run the complete-word editor command. The shell completes the
197 filename `/usr/lost' to `/usr/lost+found/', replacing the incomplete
198 word with the complete word in the input buffer. (Note the terminal
199 `/'; completion adds a `/' to the end of completed directories and a
200 space to the end of other completed words, to speed typing and provide
201 a visual indicator of successful completion. The addsuffix shell vari‐
202 able can be unset to prevent this.) If no match is found (perhaps
203 `/usr/lost+found' doesn't exist), the terminal bell rings. If the word
204 is already complete (perhaps there is a `/usr/lost' on your system, or
205 perhaps you were thinking too far ahead and typed the whole thing) a
206 `/' or space is added to the end if it isn't already there.
207
208 Completion works anywhere in the line, not at just the end; completed
209 text pushes the rest of the line to the right. Completion in the mid‐
210 dle of a word often results in leftover characters to the right of the
211 cursor that need to be deleted.
212
213 Commands and variables can be completed in much the same way. For
214 example, typing `em[tab]' would complete `em' to `emacs' if emacs were
215 the only command on your system beginning with `em'. Completion can
216 find a command in any directory in path or if given a full pathname.
217 Typing `echo $ar[tab]' would complete `$ar' to `$argv' if no other
218 variable began with `ar'.
219
220 The shell parses the input buffer to determine whether the word you
221 want to complete should be completed as a filename, command or vari‐
222 able. The first word in the buffer and the first word following `;',
223 `|', `|&', `&&' or `||' is considered to be a command. A word begin‐
224 ning with `$' is considered to be a variable. Anything else is a file‐
225 name. An empty line is `completed' as a filename.
226
227 You can list the possible completions of a word at any time by typing
228 `^D' to run the delete-char-or-list-or-eof editor command. The shell
229 lists the possible completions using the ls-F builtin (q.v.) and re‐
230 prints the prompt and unfinished command line, for example:
231
232 > ls /usr/l[^D]
233 lbin/ lib/ local/ lost+found/
234 > ls /usr/l
235
236 If the autolist shell variable is set, the shell lists the remaining
237 choices (if any) whenever completion fails:
238
239 > set autolist
240 > nm /usr/lib/libt[tab]
241 libtermcap.a@ libtermlib.a@
242 > nm /usr/lib/libterm
243
244 If autolist is set to `ambiguous', choices are listed only when comple‐
245 tion fails and adds no new characters to the word being completed.
246
247 A filename to be completed can contain variables, your own or others'
248 home directories abbreviated with `~' (see Filename substitution) and
249 directory stack entries abbreviated with `=' (see Directory stack sub‐
250 stitution). For example,
251
252 > ls ~k[^D]
253 kahn kas kellogg
254 > ls ~ke[tab]
255 > ls ~kellogg/
256
257 or
258
259 > set local = /usr/local
260 > ls $lo[tab]
261 > ls $local/[^D]
262 bin/ etc/ lib/ man/ src/
263 > ls $local/
264
265 Note that variables can also be expanded explicitly with the expand-
266 variables editor command.
267
268 delete-char-or-list-or-eof lists at only the end of the line; in the
269 middle of a line it deletes the character under the cursor and on an
270 empty line it logs one out or, if ignoreeof is set, does nothing.
271 `M-^D', bound to the editor command list-choices, lists completion pos‐
272 sibilities anywhere on a line, and list-choices (or any one of the
273 related editor commands that do or don't delete, list and/or log out,
274 listed under delete-char-or-list-or-eof) can be bound to `^D' with the
275 bindkey builtin command if so desired.
276
277 The complete-word-fwd and complete-word-back editor commands (not bound
278 to any keys by default) can be used to cycle up and down through the
279 list of possible completions, replacing the current word with the next
280 or previous word in the list.
281
282 The shell variable fignore can be set to a list of suffixes to be
283 ignored by completion. Consider the following:
284
285 > ls
286 Makefile condiments.h~ main.o side.c
287 README main.c meal side.o
288 condiments.h main.c~
289 > set fignore = (.o \~)
290 > emacs ma[^D]
291 main.c main.c~ main.o
292 > emacs ma[tab]
293 > emacs main.c
294
295 `main.c~' and `main.o' are ignored by completion (but not listing),
296 because they end in suffixes in fignore. Note that a `\' was needed in
297 front of `~' to prevent it from being expanded to home as described
298 under Filename substitution. fignore is ignored if only one completion
299 is possible.
300
301 If the complete shell variable is set to `enhance', completion 1)
302 ignores case and 2) considers periods, hyphens and underscores (`.',
303 `-' and `_') to be word separators and hyphens and underscores to be
304 equivalent. If you had the following files
305
306 comp.lang.c comp.lang.perl comp.std.c++
307 comp.lang.c++ comp.std.c
308
309 and typed `mail -f c.l.c[tab]', it would be completed to `mail -f
310 comp.lang.c', and ^D would list `comp.lang.c' and `comp.lang.c++'.
311 `mail -f c..c++[^D]' would list `comp.lang.c++' and `comp.std.c++'.
312 Typing `rm a--file[^D]' in the following directory
313
314 A_silly_file a-hyphenated-file another_silly_file
315
316 would list all three files, because case is ignored and hyphens and
317 underscores are equivalent. Periods, however, are not equivalent to
318 hyphens or underscores.
319
320 If the complete shell variable is set to `Enhance', completion ignores
321 case and differences between a hyphen and an underscore word separator
322 only when the user types a lowercase character or a hyphen. Entering
323 an uppercase character or an underscore will not match the correspond‐
324 ing lowercase character or hyphen word separator. Typing `rm
325 a--file[^D]' in the directory of the previous example would still list
326 all three files, but typing `rm A--file' would match only
327 `A_silly_file' and typing `rm a__file[^D]' would match just
328 `A_silly_file' and `another_silly_file' because the user explicitly
329 used an uppercase or an underscore character.
330
331 Completion and listing are affected by several other shell variables:
332 recexact can be set to complete on the shortest possible unique match,
333 even if more typing might result in a longer match:
334
335 > ls
336 fodder foo food foonly
337 > set recexact
338 > rm fo[tab]
339
340 just beeps, because `fo' could expand to `fod' or `foo', but if we type
341 another `o',
342
343 > rm foo[tab]
344 > rm foo
345
346 the completion completes on `foo', even though `food' and `foonly' also
347 match. autoexpand can be set to run the expand-history editor command
348 before each completion attempt, autocorrect can be set to spelling-cor‐
349 rect the word to be completed (see Spelling correction) before each
350 completion attempt and correct can be set to complete commands automat‐
351 ically after one hits `return'. matchbeep can be set to make comple‐
352 tion beep or not beep in a variety of situations, and nobeep can be set
353 to never beep at all. nostat can be set to a list of directories
354 and/or patterns that match directories to prevent the completion mecha‐
355 nism from stat(2)ing those directories. listmax and listmaxrows can be
356 set to limit the number of items and rows (respectively) that are
357 listed without asking first. recognize_only_executables can be set to
358 make the shell list only executables when listing commands, but it is
359 quite slow.
360
361 Finally, the complete builtin command can be used to tell the shell how
362 to complete words other than filenames, commands and variables. Com‐
363 pletion and listing do not work on glob-patterns (see Filename substi‐
364 tution), but the list-glob and expand-glob editor commands perform
365 equivalent functions for glob-patterns.
366
367 Spelling correction (+)
368 The shell can sometimes correct the spelling of filenames, commands and
369 variable names as well as completing and listing them.
370
371 Individual words can be spelling-corrected with the spell-word editor
372 command (usually bound to M-s and M-S) and the entire input buffer with
373 spell-line (usually bound to M-$). The correct shell variable can be
374 set to `cmd' to correct the command name or `all' to correct the entire
375 line each time return is typed, and autocorrect can be set to correct
376 the word to be completed before each completion attempt.
377
378 When spelling correction is invoked in any of these ways and the shell
379 thinks that any part of the command line is misspelled, it prompts with
380 the corrected line:
381
382 > set correct = cmd
383 > lz /usr/bin
384 CORRECT>ls /usr/bin (y|n|e|a)?
385
386 One can answer `y' or space to execute the corrected line, `e' to leave
387 the uncorrected command in the input buffer, `a' to abort the command
388 as if `^C' had been hit, and anything else to execute the original line
389 unchanged.
390
391 Spelling correction recognizes user-defined completions (see the com‐
392 plete builtin command). If an input word in a position for which a
393 completion is defined resembles a word in the completion list, spelling
394 correction registers a misspelling and suggests the latter word as a
395 correction. However, if the input word does not match any of the pos‐
396 sible completions for that position, spelling correction does not reg‐
397 ister a misspelling.
398
399 Like completion, spelling correction works anywhere in the line, push‐
400 ing the rest of the line to the right and possibly leaving extra char‐
401 acters to the right of the cursor.
402
403 Beware: spelling correction is not guaranteed to work the way one
404 intends, and is provided mostly as an experimental feature. Sugges‐
405 tions and improvements are welcome.
406
407 Editor commands (+)
408 `bindkey' lists key bindings and `bindkey -l' lists and briefly
409 describes editor commands. Only new or especially interesting editor
410 commands are described here. See emacs(1) and vi(1) for descriptions
411 of each editor's key bindings.
412
413 The character or characters to which each command is bound by default
414 is given in parentheses. `^character' means a control character and
415 `M-character' a meta character, typed as escape-character on terminals
416 without a meta key. Case counts, but commands that are bound to let‐
417 ters by default are bound to both lower- and uppercase letters for con‐
418 venience.
419
420 complete-word (tab)
421 Completes a word as described under Completion and listing.
422
423 complete-word-back (not bound)
424 Like complete-word-fwd, but steps up from the end of the list.
425
426 complete-word-fwd (not bound)
427 Replaces the current word with the first word in the list of
428 possible completions. May be repeated to step down through the
429 list. At the end of the list, beeps and reverts to the incom‐
430 plete word.
431
432 complete-word-raw (^X-tab)
433 Like complete-word, but ignores user-defined completions.
434
435 copy-prev-word (M-^_)
436 Copies the previous word in the current line into the input
437 buffer. See also insert-last-word.
438
439 dabbrev-expand (M-/)
440 Expands the current word to the most recent preceding one for
441 which the current is a leading substring, wrapping around the
442 history list (once) if necessary. Repeating dabbrev-expand
443 without any intervening typing changes to the next previous
444 word etc., skipping identical matches much like history-search-
445 backward does.
446
447 delete-char (not bound)
448 Deletes the character under the cursor. See also delete-char-
449 or-list-or-eof.
450
451 delete-char-or-eof (not bound)
452 Does delete-char if there is a character under the cursor or
453 end-of-file on an empty line. See also delete-char-or-list-or-
454 eof.
455
456 delete-char-or-list (not bound)
457 Does delete-char if there is a character under the cursor or
458 list-choices at the end of the line. See also delete-char-or-
459 list-or-eof.
460
461 delete-char-or-list-or-eof (^D)
462 Does delete-char if there is a character under the cursor,
463 list-choices at the end of the line or end-of-file on an empty
464 line. See also those three commands, each of which does only a
465 single action, and delete-char-or-eof, delete-char-or-list and
466 list-or-eof, each of which does a different two out of the
467 three.
468
469 down-history (down-arrow, ^N)
470 Like up-history, but steps down, stopping at the original input
471 line.
472
473 end-of-file (not bound)
474 Signals an end of file, causing the shell to exit unless the
475 ignoreeof shell variable (q.v.) is set to prevent this. See
476 also delete-char-or-list-or-eof.
477
478 expand-history (M-space)
479 Expands history substitutions in the current word. See History
480 substitution. See also magic-space, toggle-literal-history and
481 the autoexpand shell variable.
482
483 expand-glob (^X-*)
484 Expands the glob-pattern to the left of the cursor. See File‐
485 name substitution.
486
487 expand-line (not bound)
488 Like expand-history, but expands history substitutions in each
489 word in the input buffer.
490
491 expand-variables (^X-$)
492 Expands the variable to the left of the cursor. See Variable
493 substitution.
494
495 history-search-backward (M-p, M-P)
496 Searches backwards through the history list for a command
497 beginning with the current contents of the input buffer up to
498 the cursor and copies it into the input buffer. The search
499 string may be a glob-pattern (see Filename substitution) con‐
500 taining `*', `?', `[]' or `{}'. up-history and down-history
501 will proceed from the appropriate point in the history list.
502 Emacs mode only. See also history-search-forward and i-search-
503 back.
504
505 history-search-forward (M-n, M-N)
506 Like history-search-backward, but searches forward.
507
508 i-search-back (not bound)
509 Searches backward like history-search-backward, copies the
510 first match into the input buffer with the cursor positioned at
511 the end of the pattern, and prompts with `bck: ' and the first
512 match. Additional characters may be typed to extend the
513 search, i-search-back may be typed to continue searching with
514 the same pattern, wrapping around the history list if neces‐
515 sary, (i-search-back must be bound to a single character for
516 this to work) or one of the following special characters may be
517 typed:
518
519 ^W Appends the rest of the word under the cursor to
520 the search pattern.
521 delete (or any character bound to backward-delete-char)
522 Undoes the effect of the last character typed and
523 deletes a character from the search pattern if
524 appropriate.
525 ^G If the previous search was successful, aborts the
526 entire search. If not, goes back to the last suc‐
527 cessful search.
528 escape Ends the search, leaving the current line in the
529 input buffer.
530
531 Any other character not bound to self-insert-command terminates
532 the search, leaving the current line in the input buffer, and
533 is then interpreted as normal input. In particular, a carriage
534 return causes the current line to be executed. Emacs mode
535 only. See also i-search-fwd and history-search-backward.
536
537 i-search-fwd (not bound)
538 Like i-search-back, but searches forward.
539
540 insert-last-word (M-_)
541 Inserts the last word of the previous input line (`!$') into
542 the input buffer. See also copy-prev-word.
543
544 list-choices (M-^D)
545 Lists completion possibilities as described under Completion
546 and listing. See also delete-char-or-list-or-eof and list-
547 choices-raw.
548
549 list-choices-raw (^X-^D)
550 Like list-choices, but ignores user-defined completions.
551
552 list-glob (^X-g, ^X-G)
553 Lists (via the ls-F builtin) matches to the glob-pattern (see
554 Filename substitution) to the left of the cursor.
555
556 list-or-eof (not bound)
557 Does list-choices or end-of-file on an empty line. See also
558 delete-char-or-list-or-eof.
559
560 magic-space (not bound)
561 Expands history substitutions in the current line, like expand-
562 history, and inserts a space. magic-space is designed to be
563 bound to the space bar, but is not bound by default.
564
565 normalize-command (^X-?)
566 Searches for the current word in PATH and, if it is found,
567 replaces it with the full path to the executable. Special
568 characters are quoted. Aliases are expanded and quoted but
569 commands within aliases are not. This command is useful with
570 commands that take commands as arguments, e.g., `dbx' and `sh
571 -x'.
572
573 normalize-path (^X-n, ^X-N)
574 Expands the current word as described under the `expand' set‐
575 ting of the symlinks shell variable.
576
577 overwrite-mode (unbound)
578 Toggles between input and overwrite modes.
579
580 run-fg-editor (M-^Z)
581 Saves the current input line and looks for a stopped job with a
582 name equal to the last component of the file name part of the
583 EDITOR or VISUAL environment variables, or, if neither is set,
584 `ed' or `vi'. If such a job is found, it is restarted as if
585 `fg %job' had been typed. This is used to toggle back and
586 forth between an editor and the shell easily. Some people bind
587 this command to `^Z' so they can do this even more easily.
588
589 run-help (M-h, M-H)
590 Searches for documentation on the current command, using the
591 same notion of `current command' as the completion routines,
592 and prints it. There is no way to use a pager; run-help is
593 designed for short help files. If the special alias helpcom‐
594 mand is defined, it is run with the command name as a sole
595 argument. Else, documentation should be in a file named com‐
596 mand.help, command.1, command.6, command.8 or command, which
597 should be in one of the directories listed in the HPATH envi‐
598 ronment variable. If there is more than one help file only the
599 first is printed.
600
601 self-insert-command (text characters)
602 In insert mode (the default), inserts the typed character into
603 the input line after the character under the cursor. In over‐
604 write mode, replaces the character under the cursor with the
605 typed character. The input mode is normally preserved between
606 lines, but the inputmode shell variable can be set to `insert'
607 or `overwrite' to put the editor in that mode at the beginning
608 of each line. See also overwrite-mode.
609
610 sequence-lead-in (arrow prefix, meta prefix, ^X)
611 Indicates that the following characters are part of a multi-key
612 sequence. Binding a command to a multi-key sequence really
613 creates two bindings: the first character to sequence-lead-in
614 and the whole sequence to the command. All sequences beginning
615 with a character bound to sequence-lead-in are effectively
616 bound to undefined-key unless bound to another command.
617
618 spell-line (M-$)
619 Attempts to correct the spelling of each word in the input buf‐
620 fer, like spell-word, but ignores words whose first character
621 is one of `-', `!', `^' or `%', or which contain `\', `*' or
622 `?', to avoid problems with switches, substitutions and the
623 like. See Spelling correction.
624
625 spell-word (M-s, M-S)
626 Attempts to correct the spelling of the current word as
627 described under Spelling correction. Checks each component of
628 a word which appears to be a pathname.
629
630 toggle-literal-history (M-r, M-R)
631 Expands or `unexpands' history substitutions in the input buf‐
632 fer. See also expand-history and the autoexpand shell vari‐
633 able.
634
635 undefined-key (any unbound key)
636 Beeps.
637
638 up-history (up-arrow, ^P)
639 Copies the previous entry in the history list into the input
640 buffer. If histlit is set, uses the literal form of the entry.
641 May be repeated to step up through the history list, stopping
642 at the top.
643
644 vi-search-back (?)
645 Prompts with `?' for a search string (which may be a glob-pat‐
646 tern, as with history-search-backward), searches for it and
647 copies it into the input buffer. The bell rings if no match is
648 found. Hitting return ends the search and leaves the last
649 match in the input buffer. Hitting escape ends the search and
650 executes the match. vi mode only.
651
652 vi-search-fwd (/)
653 Like vi-search-back, but searches forward.
654
655 which-command (M-?)
656 Does a which (see the description of the builtin command) on
657 the first word of the input buffer.
658
659 yank-pop (M-y)
660 When executed immediately after a yank or another yank-pop,
661 replaces the yanked string with the next previous string from
662 the killring. This also has the effect of rotating the kill‐
663 ring, such that this string will be considered the most
664 recently killed by a later yank command. Repeating yank-pop
665 will cycle through the killring any number of times.
666
667 Lexical structure
668 The shell splits input lines into words at blanks and tabs. The spe‐
669 cial characters `&', `|', `;', `<', `>', `(', and `)' and the doubled
670 characters `&&', `||', `<<' and `>>' are always separate words, whether
671 or not they are surrounded by whitespace.
672
673 When the shell's input is not a terminal, the character `#' is taken to
674 begin a comment. Each `#' and the rest of the input line on which it
675 appears is discarded before further parsing.
676
677 A special character (including a blank or tab) may be prevented from
678 having its special meaning, and possibly made part of another word, by
679 preceding it with a backslash (`\') or enclosing it in single (`''),
680 double (`"') or backward (``') quotes. When not otherwise quoted a
681 newline preceded by a `\' is equivalent to a blank, but inside quotes
682 this sequence results in a newline.
683
684 Furthermore, all Substitutions (see below) except History substitution
685 can be prevented by enclosing the strings (or parts of strings) in
686 which they appear with single quotes or by quoting the crucial charac‐
687 ter(s) (e.g., `$' or ``' for Variable substitution or Command substitu‐
688 tion respectively) with `\'. (Alias substitution is no exception:
689 quoting in any way any character of a word for which an alias has been
690 defined prevents substitution of the alias. The usual way of quoting
691 an alias is to precede it with a backslash.) History substitution is
692 prevented by backslashes but not by single quotes. Strings quoted with
693 double or backward quotes undergo Variable substitution and Command
694 substitution, but other substitutions are prevented.
695
696 Text inside single or double quotes becomes a single word (or part of
697 one). Metacharacters in these strings, including blanks and tabs, do
698 not form separate words. Only in one special case (see Command substi‐
699 tution below) can a double-quoted string yield parts of more than one
700 word; single-quoted strings never do. Backward quotes are special:
701 they signal Command substitution (q.v.), which may result in more than
702 one word.
703
704 Quoting complex strings, particularly strings which themselves contain
705 quoting characters, can be confusing. Remember that quotes need not be
706 used as they are in human writing! It may be easier to quote not an
707 entire string, but only those parts of the string which need quoting,
708 using different types of quoting to do so if appropriate.
709
710 The backslash_quote shell variable (q.v.) can be set to make back‐
711 slashes always quote `\', `'', and `"'. (+) This may make complex
712 quoting tasks easier, but it can cause syntax errors in csh(1) scripts.
713
714 Substitutions
715 We now describe the various transformations the shell performs on the
716 input in the order in which they occur. We note in passing the data
717 structures involved and the commands and variables which affect them.
718 Remember that substitutions can be prevented by quoting as described
719 under Lexical structure.
720
721 History substitution
722 Each command, or ``event'', input from the terminal is saved in the
723 history list. The previous command is always saved, and the history
724 shell variable can be set to a number to save that many commands. The
725 histdup shell variable can be set to not save duplicate events or con‐
726 secutive duplicate events.
727
728 Saved commands are numbered sequentially from 1 and stamped with the
729 time. It is not usually necessary to use event numbers, but the cur‐
730 rent event number can be made part of the prompt by placing an `!' in
731 the prompt shell variable.
732
733 The shell actually saves history in expanded and literal (unexpanded)
734 forms. If the histlit shell variable is set, commands that display and
735 store history use the literal form.
736
737 The history builtin command can print, store in a file, restore and
738 clear the history list at any time, and the savehist and histfile shell
739 variables can be set to store the history list automatically on logout
740 and restore it on login.
741
742 History substitutions introduce words from the history list into the
743 input stream, making it easy to repeat commands, repeat arguments of a
744 previous command in the current command, or fix spelling mistakes in
745 the previous command with little typing and a high degree of confi‐
746 dence.
747
748 History substitutions begin with the character `!'. They may begin
749 anywhere in the input stream, but they do not nest. The `!' may be
750 preceded by a `\' to prevent its special meaning; for convenience, a
751 `!' is passed unchanged when it is followed by a blank, tab, newline,
752 `=' or `('. History substitutions also occur when an input line begins
753 with `^'. This special abbreviation will be described later. The
754 characters used to signal history substitution (`!' and `^') can be
755 changed by setting the histchars shell variable. Any input line which
756 contains a history substitution is printed before it is executed.
757
758 A history substitution may have an ``event specification'', which indi‐
759 cates the event from which words are to be taken, a ``word designa‐
760 tor'', which selects particular words from the chosen event, and/or a
761 ``modifier'', which manipulates the selected words.
762
763 An event specification can be
764
765 n A number, referring to a particular event
766 -n An offset, referring to the event n before the current
767 event
768 # The current event. This should be used carefully in
769 csh(1), where there is no check for recursion. tcsh allows
770 10 levels of recursion. (+)
771 ! The previous event (equivalent to `-1')
772 s The most recent event whose first word begins with the
773 string s
774 ?s? The most recent event which contains the string s. The
775 second `?' can be omitted if it is immediately followed by
776 a newline.
777
778 For example, consider this bit of someone's history list:
779
780 9 8:30 nroff -man wumpus.man
781 10 8:31 cp wumpus.man wumpus.man.old
782 11 8:36 vi wumpus.man
783 12 8:37 diff wumpus.man.old wumpus.man
784
785 The commands are shown with their event numbers and time stamps. The
786 current event, which we haven't typed in yet, is event 13. `!11' and
787 `!-2' refer to event 11. `!!' refers to the previous event, 12. `!!'
788 can be abbreviated `!' if it is followed by `:' (`:' is described
789 below). `!n' refers to event 9, which begins with `n'. `!?old?' also
790 refers to event 12, which contains `old'. Without word designators or
791 modifiers history references simply expand to the entire event, so we
792 might type `!cp' to redo the copy command or `!!|more' if the `diff'
793 output scrolled off the top of the screen.
794
795 History references may be insulated from the surrounding text with
796 braces if necessary. For example, `!vdoc' would look for a command
797 beginning with `vdoc', and, in this example, not find one, but
798 `!{v}doc' would expand unambiguously to `vi wumpus.mandoc'. Even in
799 braces, history substitutions do not nest.
800
801 (+) While csh(1) expands, for example, `!3d' to event 3 with the letter
802 `d' appended to it, tcsh expands it to the last event beginning with
803 `3d'; only completely numeric arguments are treated as event numbers.
804 This makes it possible to recall events beginning with numbers. To
805 expand `!3d' as in csh(1) say `!{3}d'.
806
807 To select words from an event we can follow the event specification by
808 a `:' and a designator for the desired words. The words of an input
809 line are numbered from 0, the first (usually command) word being 0, the
810 second word (first argument) being 1, etc. The basic word designators
811 are:
812
813 0 The first (command) word
814 n The nth argument
815 ^ The first argument, equivalent to `1'
816 $ The last argument
817 % The word matched by an ?s? search
818 x-y A range of words
819 -y Equivalent to `0-y'
820 * Equivalent to `^-$', but returns nothing if the event con‐
821 tains only 1 word
822 x* Equivalent to `x-$'
823 x- Equivalent to `x*', but omitting the last word (`$')
824
825 Selected words are inserted into the command line separated by single
826 blanks. For example, the `diff' command in the previous example might
827 have been typed as `diff !!:1.old !!:1' (using `:1' to select the first
828 argument from the previous event) or `diff !-2:2 !-2:1' to select and
829 swap the arguments from the `cp' command. If we didn't care about the
830 order of the `diff' we might have said `diff !-2:1-2' or simply `diff
831 !-2:*'. The `cp' command might have been written `cp wumpus.man
832 !#:1.old', using `#' to refer to the current event. `!n:- hurkle.man'
833 would reuse the first two words from the `nroff' command to say `nroff
834 -man hurkle.man'.
835
836 The `:' separating the event specification from the word designator can
837 be omitted if the argument selector begins with a `^', `$', `*', `%' or
838 `-'. For example, our `diff' command might have been `diff !!^.old
839 !!^' or, equivalently, `diff !!$.old !!$'. However, if `!!' is abbre‐
840 viated `!', an argument selector beginning with `-' will be interpreted
841 as an event specification.
842
843 A history reference may have a word designator but no event specifica‐
844 tion. It then references the previous command. Continuing our `diff'
845 example, we could have said simply `diff !^.old !^' or, to get the
846 arguments in the opposite order, just `diff !*'.
847
848 The word or words in a history reference can be edited, or ``modi‐
849 fied'', by following it with one or more modifiers, each preceded by a
850 `:':
851
852 h Remove a trailing pathname component, leaving the head.
853 t Remove all leading pathname components, leaving the tail.
854 r Remove a filename extension `.xxx', leaving the root name.
855 e Remove all but the extension.
856 u Uppercase the first lowercase letter.
857 l Lowercase the first uppercase letter.
858 s/l/r/ Substitute l for r. l is simply a string like r, not a
859 regular expression as in the eponymous ed(1) command. Any
860 character may be used as the delimiter in place of `/'; a
861 `\' can be used to quote the delimiter expect `(', `)', `|'
862 and `>' inside l and r. The character `&' in the r is
863 replaced by l; `\' also quotes `&'. If l is empty (``''),
864 the l from a previous substitution or the s from a previous
865 search or event number in event specification is used. The
866 trailing delimiter may be omitted if it is immediately fol‐
867 lowed by a newline.
868 & Repeat the previous substitution.
869 g Apply the following modifier once to each word.
870 a (+) Apply the following modifier as many times as possible to a
871 single word. `a' and `g' can be used together to apply a
872 modifier globally. With the `s' modifier, only the pat‐
873 terns contained in the original word are substituted, not
874 patterns that contain any substitution result.
875 p Print the new command line but do not execute it.
876 q Quote the substituted words, preventing further substitu‐
877 tions.
878 x Like q, but break into words at blanks, tabs and newlines.
879
880 Modifiers are applied to only the first modifiable word (unless `g' is
881 used). It is an error for no word to be modifiable.
882
883 For example, the `diff' command might have been written as `diff wum‐
884 pus.man.old !#^:r', using `:r' to remove `.old' from the first argument
885 on the same line (`!#^'). We could say `echo hello out there', then
886 `echo !*:u' to capitalize `hello', `echo !*:au' to say it out loud, or
887 `echo !*:agu' to really shout. We might follow `mail -s "I forgot my
888 password" rot' with `!:s/rot/root' to correct the spelling of `root'
889 (but see Spelling correction for a different approach).
890
891 There is a special abbreviation for substitutions. `^', when it is the
892 first character on an input line, is equivalent to `!:s^'. Thus we
893 might have said `^rot^root' to make the spelling correction in the pre‐
894 vious example. This is the only history substitution which does not
895 explicitly begin with `!'.
896
897 (+) In csh as such, only one modifier may be applied to each history or
898 variable expansion. In tcsh, more than one may be used, for example
899
900 % mv wumpus.man /usr/man/man1/wumpus.1
901 % man !$:t:r
902 man wumpus
903
904 In csh, the result would be `wumpus.1:r'. A substitution followed by a
905 colon may need to be insulated from it with braces:
906
907 > mv a.out /usr/games/wumpus
908 > setenv PATH !$:h:$PATH
909 Bad ! modifier: $.
910 > setenv PATH !{-2$:h}:$PATH
911 setenv PATH /usr/games:/bin:/usr/bin:.
912
913 The first attempt would succeed in csh but fails in tcsh, because tcsh
914 expects another modifier after the second colon rather than `$'.
915
916 Finally, history can be accessed through the editor as well as through
917 the substitutions just described. The up- and down-history, history-
918 search-backward and -forward, i-search-back and -fwd, vi-search-back
919 and -fwd, copy-prev-word and insert-last-word editor commands search
920 for events in the history list and copy them into the input buffer.
921 The toggle-literal-history editor command switches between the expanded
922 and literal forms of history lines in the input buffer. expand-history
923 and expand-line expand history substitutions in the current word and in
924 the entire input buffer respectively.
925
926 Alias substitution
927 The shell maintains a list of aliases which can be set, unset and
928 printed by the alias and unalias commands. After a command line is
929 parsed into simple commands (see Commands) the first word of each com‐
930 mand, left-to-right, is checked to see if it has an alias. If so, the
931 first word is replaced by the alias. If the alias contains a history
932 reference, it undergoes History substitution (q.v.) as though the orig‐
933 inal command were the previous input line. If the alias does not con‐
934 tain a history reference, the argument list is left untouched.
935
936 Thus if the alias for `ls' were `ls -l' the command `ls /usr' would
937 become `ls -l /usr', the argument list here being undisturbed. If the
938 alias for `lookup' were `grep !^ /etc/passwd' then `lookup bill' would
939 become `grep bill /etc/passwd'. Aliases can be used to introduce
940 parser metasyntax. For example, `alias print 'pr \!* | lpr'' defines a
941 ``command'' (`print') which pr(1)s its arguments to the line printer.
942
943 Alias substitution is repeated until the first word of the command has
944 no alias. If an alias substitution does not change the first word (as
945 in the previous example) it is flagged to prevent a loop. Other loops
946 are detected and cause an error.
947
948 Some aliases are referred to by the shell; see Special aliases.
949
950 Variable substitution
951 The shell maintains a list of variables, each of which has as value a
952 list of zero or more words. The values of shell variables can be dis‐
953 played and changed with the set and unset commands. The system main‐
954 tains its own list of ``environment'' variables. These can be dis‐
955 played and changed with printenv, setenv and unsetenv.
956
957 (+) Variables may be made read-only with `set -r' (q.v.). Read-only
958 variables may not be modified or unset; attempting to do so will cause
959 an error. Once made read-only, a variable cannot be made writable, so
960 `set -r' should be used with caution. Environment variables cannot be
961 made read-only.
962
963 Some variables are set by the shell or referred to by it. For
964 instance, the argv variable is an image of the shell's argument list,
965 and words of this variable's value are referred to in special ways.
966 Some of the variables referred to by the shell are toggles; the shell
967 does not care what their value is, only whether they are set or not.
968 For instance, the verbose variable is a toggle which causes command
969 input to be echoed. The -v command line option sets this variable.
970 Special shell variables lists all variables which are referred to by
971 the shell.
972
973 Other operations treat variables numerically. The `@' command permits
974 numeric calculations to be performed and the result assigned to a vari‐
975 able. Variable values are, however, always represented as (zero or
976 more) strings. For the purposes of numeric operations, the null string
977 is considered to be zero, and the second and subsequent words of multi-
978 word values are ignored.
979
980 After the input line is aliased and parsed, and before each command is
981 executed, variable substitution is performed keyed by `$' characters.
982 This expansion can be prevented by preceding the `$' with a `\' except
983 within `"'s where it always occurs, and within `''s where it never
984 occurs. Strings quoted by ``' are interpreted later (see Command sub‐
985 stitution below) so `$' substitution does not occur there until later,
986 if at all. A `$' is passed unchanged if followed by a blank, tab, or
987 end-of-line.
988
989 Input/output redirections are recognized before variable expansion, and
990 are variable expanded separately. Otherwise, the command name and
991 entire argument list are expanded together. It is thus possible for
992 the first (command) word (to this point) to generate more than one
993 word, the first of which becomes the command name, and the rest of
994 which become arguments.
995
996 Unless enclosed in `"' or given the `:q' modifier the results of vari‐
997 able substitution may eventually be command and filename substituted.
998 Within `"', a variable whose value consists of multiple words expands
999 to a (portion of a) single word, with the words of the variable's value
1000 separated by blanks. When the `:q' modifier is applied to a substitu‐
1001 tion the variable will expand to multiple words with each word sepa‐
1002 rated by a blank and quoted to prevent later command or filename sub‐
1003 stitution.
1004
1005 The following metasequences are provided for introducing variable val‐
1006 ues into the shell input. Except as noted, it is an error to reference
1007 a variable which is not set.
1008
1009 $name
1010 ${name} Substitutes the words of the value of variable name, each sepa‐
1011 rated by a blank. Braces insulate name from following charac‐
1012 ters which would otherwise be part of it. Shell variables have
1013 names consisting of letters and digits starting with a letter.
1014 The underscore character is considered a letter. If name is
1015 not a shell variable, but is set in the environment, then that
1016 value is returned (but some of the other forms given below are
1017 not available in this case).
1018 $name[selector]
1019 ${name[selector]}
1020 Substitutes only the selected words from the value of name.
1021 The selector is subjected to `$' substitution and may consist
1022 of a single number or two numbers separated by a `-'. The
1023 first word of a variable's value is numbered `1'. If the first
1024 number of a range is omitted it defaults to `1'. If the last
1025 member of a range is omitted it defaults to `$#name'. The
1026 selector `*' selects all words. It is not an error for a range
1027 to be empty if the second argument is omitted or in range.
1028 $0 Substitutes the name of the file from which command input is
1029 being read. An error occurs if the name is not known.
1030 $number
1031 ${number}
1032 Equivalent to `$argv[number]'.
1033 $* Equivalent to `$argv', which is equivalent to `$argv[*]'.
1034
1035 The `:' modifiers described under History substitution, except for
1036 `:p', can be applied to the substitutions above. More than one may be
1037 used. (+) Braces may be needed to insulate a variable substitution
1038 from a literal colon just as with History substitution (q.v.); any mod‐
1039 ifiers must appear within the braces.
1040
1041 The following substitutions can not be modified with `:' modifiers.
1042
1043 $?name
1044 ${?name}
1045 Substitutes the string `1' if name is set, `0' if it is not.
1046 $?0 Substitutes `1' if the current input filename is known, `0' if
1047 it is not. Always `0' in interactive shells.
1048 $#name
1049 ${#name}
1050 Substitutes the number of words in name.
1051 $# Equivalent to `$#argv'. (+)
1052 $%name
1053 ${%name}
1054 Substitutes the number of characters in name. (+)
1055 $%number
1056 ${%number}
1057 Substitutes the number of characters in $argv[number]. (+)
1058 $? Equivalent to `$status'. (+)
1059 $$ Substitutes the (decimal) process number of the (parent) shell.
1060 $! Substitutes the (decimal) process number of the last background
1061 process started by this shell. (+)
1062 $_ Substitutes the command line of the last command executed. (+)
1063 $< Substitutes a line from the standard input, with no further
1064 interpretation thereafter. It can be used to read from the
1065 keyboard in a shell script. (+) While csh always quotes $<, as
1066 if it were equivalent to `$<:q', tcsh does not. Furthermore,
1067 when tcsh is waiting for a line to be typed the user may type
1068 an interrupt to interrupt the sequence into which the line is
1069 to be substituted, but csh does not allow this.
1070
1071 The editor command expand-variables, normally bound to `^X-$', can be
1072 used to interactively expand individual variables.
1073
1074 Command, filename and directory stack substitution
1075 The remaining substitutions are applied selectively to the arguments of
1076 builtin commands. This means that portions of expressions which are
1077 not evaluated are not subjected to these expansions. For commands
1078 which are not internal to the shell, the command name is substituted
1079 separately from the argument list. This occurs very late, after input-
1080 output redirection is performed, and in a child of the main shell.
1081
1082 Command substitution
1083 Command substitution is indicated by a command enclosed in ``'. The
1084 output from such a command is broken into separate words at blanks,
1085 tabs and newlines, and null words are discarded. The output is vari‐
1086 able and command substituted and put in place of the original string.
1087
1088 Command substitutions inside double quotes (`"') retain blanks and
1089 tabs; only newlines force new words. The single final newline does not
1090 force a new word in any case. It is thus possible for a command sub‐
1091 stitution to yield only part of a word, even if the command outputs a
1092 complete line.
1093
1094 By default, the shell since version 6.12 replaces all newline and car‐
1095 riage return characters in the command by spaces. If this is switched
1096 off by unsetting csubstnonl, newlines separate commands as usual.
1097
1098 Filename substitution
1099 If a word contains any of the characters `*', `?', `[' or `{' or begins
1100 with the character `~' it is a candidate for filename substitution,
1101 also known as ``globbing''. This word is then regarded as a pattern
1102 (``glob-pattern''), and replaced with an alphabetically sorted list of
1103 file names which match the pattern.
1104
1105 In matching filenames, the character `.' at the beginning of a filename
1106 or immediately following a `/', as well as the character `/' must be
1107 matched explicitly (unless either globdot or globstar or both are
1108 set(+)). The character `*' matches any string of characters, including
1109 the null string. The character `?' matches any single character. The
1110 sequence `[...]' matches any one of the characters enclosed. Within
1111 `[...]', a pair of characters separated by `-' matches any character
1112 lexically between the two.
1113
1114 (+) Some glob-patterns can be negated: The sequence `[^...]' matches
1115 any single character not specified by the characters and/or ranges of
1116 characters in the braces.
1117
1118 An entire glob-pattern can also be negated with `^':
1119
1120 > echo *
1121 bang crash crunch ouch
1122 > echo ^cr*
1123 bang ouch
1124
1125 Glob-patterns which do not use `?', `*', or `[]' or which use `{}' or
1126 `~' (below) are not negated correctly.
1127
1128 The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'. Left-
1129 to-right order is preserved: `/usr/source/s1/{oldls,ls}.c' expands to
1130 `/usr/source/s1/oldls.c /usr/source/s1/ls.c'. The results of matches
1131 are sorted separately at a low level to preserve this order:
1132 `../{memo,*box}' might expand to `../memo ../box ../mbox'. (Note that
1133 `memo' was not sorted with the results of matching `*box'.) It is not
1134 an error when this construct expands to files which do not exist, but
1135 it is possible to get an error from a command to which the expanded
1136 list is passed. This construct may be nested. As a special case the
1137 words `{', `}' and `{}' are passed undisturbed.
1138
1139 The character `~' at the beginning of a filename refers to home direc‐
1140 tories. Standing alone, i.e., `~', it expands to the invoker's home
1141 directory as reflected in the value of the home shell variable. When
1142 followed by a name consisting of letters, digits and `-' characters the
1143 shell searches for a user with that name and substitutes their home
1144 directory; thus `~ken' might expand to `/usr/ken' and `~ken/chmach' to
1145 `/usr/ken/chmach'. If the character `~' is followed by a character
1146 other than a letter or `/' or appears elsewhere than at the beginning
1147 of a word, it is left undisturbed. A command like `setenv MANPATH
1148 /usr/man:/usr/local/man:~/lib/man' does not, therefore, do home direc‐
1149 tory substitution as one might hope.
1150
1151 It is an error for a glob-pattern containing `*', `?', `[' or `~', with
1152 or without `^', not to match any files. However, only one pattern in a
1153 list of glob-patterns must match a file (so that, e.g., `rm *.a *.c
1154 *.o' would fail only if there were no files in the current directory
1155 ending in `.a', `.c', or `.o'), and if the nonomatch shell variable is
1156 set a pattern (or list of patterns) which matches nothing is left
1157 unchanged rather than causing an error.
1158
1159 The globstar shell variable can be set to allow `**' or `***' as a file
1160 glob pattern that matches any string of characters including `/',
1161 recursively traversing any existing sub-directories. For example, `ls
1162 **.c' will list all the .c files in the current directory tree. If
1163 used by itself, it will match zero or more sub-directories (e.g. `ls
1164 /usr/include/**/time.h' will list any file named `time.h' in the
1165 /usr/include directory tree; `ls /usr/include/**time.h' will match any
1166 file in the /usr/include directory tree ending in `time.h'; and `ls
1167 /usr/include/**time**.h' will match any .h file with `time' either in a
1168 subdirectory name or in the filename itself). To prevent problems with
1169 recursion, the `**' glob-pattern will not descend into a symbolic link
1170 containing a directory. To override this, use `***' (+)
1171
1172 The noglob shell variable can be set to prevent filename substitution,
1173 and the expand-glob editor command, normally bound to `^X-*', can be
1174 used to interactively expand individual filename substitutions.
1175
1176 Directory stack substitution (+)
1177 The directory stack is a list of directories, numbered from zero, used
1178 by the pushd, popd and dirs builtin commands (q.v.). dirs can print,
1179 store in a file, restore and clear the directory stack at any time, and
1180 the savedirs and dirsfile shell variables can be set to store the
1181 directory stack automatically on logout and restore it on login. The
1182 dirstack shell variable can be examined to see the directory stack and
1183 set to put arbitrary directories into the directory stack.
1184
1185 The character `=' followed by one or more digits expands to an entry in
1186 the directory stack. The special case `=-' expands to the last direc‐
1187 tory in the stack. For example,
1188
1189 > dirs -v
1190 0 /usr/bin
1191 1 /usr/spool/uucp
1192 2 /usr/accts/sys
1193 > echo =1
1194 /usr/spool/uucp
1195 > echo =0/calendar
1196 /usr/bin/calendar
1197 > echo =-
1198 /usr/accts/sys
1199
1200 The noglob and nonomatch shell variables and the expand-glob editor
1201 command apply to directory stack as well as filename substitutions.
1202
1203 Other substitutions (+)
1204 There are several more transformations involving filenames, not
1205 strictly related to the above but mentioned here for completeness. Any
1206 filename may be expanded to a full path when the symlinks variable
1207 (q.v.) is set to `expand'. Quoting prevents this expansion, and the
1208 normalize-path editor command does it on demand. The normalize-command
1209 editor command expands commands in PATH into full paths on demand.
1210 Finally, cd and pushd interpret `-' as the old working directory
1211 (equivalent to the shell variable owd). This is not a substitution at
1212 all, but an abbreviation recognized by only those commands. Nonethe‐
1213 less, it too can be prevented by quoting.
1214
1215 Commands
1216 The next three sections describe how the shell executes commands and
1217 deals with their input and output.
1218
1219 Simple commands, pipelines and sequences
1220 A simple command is a sequence of words, the first of which specifies
1221 the command to be executed. A series of simple commands joined by `|'
1222 characters forms a pipeline. The output of each command in a pipeline
1223 is connected to the input of the next.
1224
1225 Simple commands and pipelines may be joined into sequences with `;',
1226 and will be executed sequentially. Commands and pipelines can also be
1227 joined into sequences with `||' or `&&', indicating, as in the C lan‐
1228 guage, that the second is to be executed only if the first fails or
1229 succeeds respectively.
1230
1231 A simple command, pipeline or sequence may be placed in parentheses,
1232 `()', to form a simple command, which may in turn be a component of a
1233 pipeline or sequence. A command, pipeline or sequence can be executed
1234 without waiting for it to terminate by following it with an `&'.
1235
1236 Builtin and non-builtin command execution
1237 Builtin commands are executed within the shell. If any component of a
1238 pipeline except the last is a builtin command, the pipeline is executed
1239 in a subshell.
1240
1241 Parenthesized commands are always executed in a subshell.
1242
1243 (cd; pwd); pwd
1244
1245 thus prints the home directory, leaving you where you were (printing
1246 this after the home directory), while
1247
1248 cd; pwd
1249
1250 leaves you in the home directory. Parenthesized commands are most
1251 often used to prevent cd from affecting the current shell.
1252
1253 When a command to be executed is found not to be a builtin command the
1254 shell attempts to execute the command via execve(2). Each word in the
1255 variable path names a directory in which the shell will look for the
1256 command. If the shell is not given a -f option, the shell hashes the
1257 names in these directories into an internal table so that it will try
1258 an execve(2) in only a directory where there is a possibility that the
1259 command resides there. This greatly speeds command location when a
1260 large number of directories are present in the search path. This hash‐
1261 ing mechanism is not used:
1262
1263 1. If hashing is turned explicitly off via unhash.
1264
1265 2. If the shell was given a -f argument.
1266
1267 3. For each directory component of path which does not begin with a
1268 `/'.
1269
1270 4. If the command contains a `/'.
1271
1272 In the above four cases the shell concatenates each component of the
1273 path vector with the given command name to form a path name of a file
1274 which it then attempts to execute it. If execution is successful, the
1275 search stops.
1276
1277 If the file has execute permissions but is not an executable to the
1278 system (i.e., it is neither an executable binary nor a script that
1279 specifies its interpreter), then it is assumed to be a file containing
1280 shell commands and a new shell is spawned to read it. The shell spe‐
1281 cial alias may be set to specify an interpreter other than the shell
1282 itself.
1283
1284 On systems which do not understand the `#!' script interpreter conven‐
1285 tion the shell may be compiled to emulate it; see the version shell
1286 variable. If so, the shell checks the first line of the file to see if
1287 it is of the form `#!interpreter arg ...'. If it is, the shell starts
1288 interpreter with the given args and feeds the file to it on standard
1289 input.
1290
1291 Input/output
1292 The standard input and standard output of a command may be redirected
1293 with the following syntax:
1294
1295 < name Open file name (which is first variable, command and filename
1296 expanded) as the standard input.
1297 << word Read the shell input up to a line which is identical to word.
1298 word is not subjected to variable, filename or command substi‐
1299 tution, and each input line is compared to word before any sub‐
1300 stitutions are done on this input line. Unless a quoting `\',
1301 `"', `' or ``' appears in word variable and command substitu‐
1302 tion is performed on the intervening lines, allowing `\' to
1303 quote `$', `\' and ``'. Commands which are substituted have
1304 all blanks, tabs, and newlines preserved, except for the final
1305 newline which is dropped. The resultant text is placed in an
1306 anonymous temporary file which is given to the command as stan‐
1307 dard input.
1308 > name
1309 >! name
1310 >& name
1311 >&! name
1312 The file name is used as standard output. If the file does not
1313 exist then it is created; if the file exists, it is truncated,
1314 its previous contents being lost.
1315
1316 If the shell variable noclobber is set, then the file must not
1317 exist or be a character special file (e.g., a terminal or
1318 `/dev/null') or an error results. This helps prevent acciden‐
1319 tal destruction of files. In this case the `!' forms can be
1320 used to suppress this check.
1321
1322 The forms involving `&' route the diagnostic output into the
1323 specified file as well as the standard output. name is
1324 expanded in the same way as `<' input filenames are.
1325 >> name
1326 >>& name
1327 >>! name
1328 >>&! name
1329 Like `>', but appends output to the end of name. If the shell
1330 variable noclobber is set, then it is an error for the file not
1331 to exist, unless one of the `!' forms is given.
1332
1333 A command receives the environment in which the shell was invoked as
1334 modified by the input-output parameters and the presence of the command
1335 in a pipeline. Thus, unlike some previous shells, commands run from a
1336 file of shell commands have no access to the text of the commands by
1337 default; rather they receive the original standard input of the shell.
1338 The `<<' mechanism should be used to present inline data. This permits
1339 shell command scripts to function as components of pipelines and allows
1340 the shell to block read its input. Note that the default standard
1341 input for a command run detached is not the empty file /dev/null, but
1342 the original standard input of the shell. If this is a terminal and if
1343 the process attempts to read from the terminal, then the process will
1344 block and the user will be notified (see Jobs).
1345
1346 Diagnostic output may be directed through a pipe with the standard out‐
1347 put. Simply use the form `|&' rather than just `|'.
1348
1349 The shell cannot presently redirect diagnostic output without also
1350 redirecting standard output, but `(command > output-file) >& error-
1351 file' is often an acceptable workaround. Either output-file or error-
1352 file may be `/dev/tty' to send output to the terminal.
1353
1354 Features
1355 Having described how the shell accepts, parses and executes command
1356 lines, we now turn to a variety of its useful features.
1357
1358 Control flow
1359 The shell contains a number of commands which can be used to regulate
1360 the flow of control in command files (shell scripts) and (in limited
1361 but useful ways) from terminal input. These commands all operate by
1362 forcing the shell to reread or skip in its input and, due to the imple‐
1363 mentation, restrict the placement of some of the commands.
1364
1365 The foreach, switch, and while statements, as well as the if-then-else
1366 form of the if statement, require that the major keywords appear in a
1367 single simple command on an input line as shown below.
1368
1369 If the shell's input is not seekable, the shell buffers up input when‐
1370 ever a loop is being read and performs seeks in this internal buffer to
1371 accomplish the rereading implied by the loop. (To the extent that this
1372 allows, backward gotos will succeed on non-seekable inputs.)
1373
1374 Expressions
1375 The if, while and exit builtin commands use expressions with a common
1376 syntax. The expressions can include any of the operators described in
1377 the next three sections. Note that the @ builtin command (q.v.) has
1378 its own separate syntax.
1379
1380 Logical, arithmetical and comparison operators
1381 These operators are similar to those of C and have the same precedence.
1382 They include
1383
1384 || && | ^ & == != =~ !~ <= >=
1385 < > << >> + - * / % ! ~ ( )
1386
1387 Here the precedence increases to the right, `==' `!=' `=~' and `!~',
1388 `<=' `>=' `<' and `>', `<<' and `>>', `+' and `-', `*' `/' and `%'
1389 being, in groups, at the same level. When multiple operators which
1390 have same precedence are used in one expression, calculation must be
1391 done from operator of right side. The `==' `!=' `=~' and `!~' opera‐
1392 tors compare their arguments as strings; all others operate on numbers.
1393 The operators `=~' and `!~' are like `!=' and `==' except that the
1394 right hand side is a glob-pattern (see Filename substitution) against
1395 which the left hand operand is matched. This reduces the need for use
1396 of the switch builtin command in shell scripts when all that is really
1397 needed is pattern matching.
1398
1399 Null or missing arguments are considered `0'. The results of all
1400 expressions are strings, which represent decimal numbers. It is impor‐
1401 tant to note that no two components of an expression can appear in the
1402 same word; except when adjacent to components of expressions which are
1403 syntactically significant to the parser (`&' `|' `<' `>' `(' `)') they
1404 should be surrounded by spaces.
1405
1406 Command exit status
1407 Commands can be executed in expressions and their exit status returned
1408 by enclosing them in braces (`{}'). Remember that the braces should be
1409 separated from the words of the command by spaces. Command executions
1410 succeed, returning true, i.e., `1', if the command exits with status 0,
1411 otherwise they fail, returning false, i.e., `0'. If more detailed sta‐
1412 tus information is required then the command should be executed outside
1413 of an expression and the status shell variable examined.
1414
1415 File inquiry operators
1416 Some of these operators perform true/false tests on files and related
1417 objects. They are of the form -op file, where op is one of
1418
1419 r Read access
1420 w Write access
1421 x Execute access
1422 X Executable in the path or shell builtin, e.g., `-X ls' and `-X
1423 ls-F' are generally true, but `-X /bin/ls' is not (+)
1424 e Existence
1425 o Ownership
1426 z Zero size
1427 s Non-zero size (+)
1428 f Plain file
1429 d Directory
1430 l Symbolic link (+) *
1431 b Block special file (+)
1432 c Character special file (+)
1433 p Named pipe (fifo) (+) *
1434 S Socket special file (+) *
1435 u Set-user-ID bit is set (+)
1436 g Set-group-ID bit is set (+)
1437 k Sticky bit is set (+)
1438 t file (which must be a digit) is an open file descriptor for a
1439 terminal device (+)
1440 R Has been migrated (Convex only) (+)
1441 L Applies subsequent operators in a multiple-operator test to a
1442 symbolic link rather than to the file to which the link points
1443 (+) *
1444
1445 file is command and filename expanded and then tested to see if it has
1446 the specified relationship to the real user. If file does not exist or
1447 is inaccessible or, for the operators indicated by `*', if the speci‐
1448 fied file type does not exist on the current system, then all inquiries
1449 return false, i.e., `0'.
1450
1451 These operators may be combined for conciseness: `-xy file' is equiva‐
1452 lent to `-x file && -y file'. (+) For example, `-fx' is true (returns
1453 `1') for plain executable files, but not for directories.
1454
1455 L may be used in a multiple-operator test to apply subsequent operators
1456 to a symbolic link rather than to the file to which the link points.
1457 For example, `-lLo' is true for links owned by the invoking user. Lr,
1458 Lw and Lx are always true for links and false for non-links. L has a
1459 different meaning when it is the last operator in a multiple-operator
1460 test; see below.
1461
1462 It is possible but not useful, and sometimes misleading, to combine
1463 operators which expect file to be a file with operators which do not
1464 (e.g., X and t). Following L with a non-file operator can lead to par‐
1465 ticularly strange results.
1466
1467 Other operators return other information, i.e., not just `0' or `1'.
1468 (+) They have the same format as before; op may be one of
1469
1470 A Last file access time, as the number of seconds since the
1471 epoch
1472 A: Like A, but in timestamp format, e.g., `Fri May 14 16:36:10
1473 1993'
1474 M Last file modification time
1475 M: Like M, but in timestamp format
1476 C Last inode modification time
1477 C: Like C, but in timestamp format
1478 D Device number
1479 I Inode number
1480 F Composite file identifier, in the form device:inode
1481 L The name of the file pointed to by a symbolic link
1482 N Number of (hard) links
1483 P Permissions, in octal, without leading zero
1484 P: Like P, with leading zero
1485 Pmode Equivalent to `-P file & mode', e.g., `-P22 file' returns
1486 `22' if file is writable by group and other, `20' if by
1487 group only, and `0' if by neither
1488 Pmode: Like Pmode, with leading zero
1489 U Numeric userid
1490 U: Username, or the numeric userid if the username is unknown
1491 G Numeric groupid
1492 G: Groupname, or the numeric groupid if the groupname is
1493 unknown
1494 Z Size, in bytes
1495
1496 Only one of these operators may appear in a multiple-operator test, and
1497 it must be the last. Note that L has a different meaning at the end of
1498 and elsewhere in a multiple-operator test. Because `0' is a valid
1499 return value for many of these operators, they do not return `0' when
1500 they fail: most return `-1', and F returns `:'.
1501
1502 If the shell is compiled with POSIX defined (see the version shell
1503 variable), the result of a file inquiry is based on the permission bits
1504 of the file and not on the result of the access(2) system call. For
1505 example, if one tests a file with -w whose permissions would ordinarily
1506 allow writing but which is on a file system mounted read-only, the test
1507 will succeed in a POSIX shell but fail in a non-POSIX shell.
1508
1509 File inquiry operators can also be evaluated with the filetest builtin
1510 command (q.v.) (+).
1511
1512 Jobs
1513 The shell associates a job with each pipeline. It keeps a table of
1514 current jobs, printed by the jobs command, and assigns them small inte‐
1515 ger numbers. When a job is started asynchronously with `&', the shell
1516 prints a line which looks like
1517
1518 [1] 1234
1519
1520 indicating that the job which was started asynchronously was job number
1521 1 and had one (top-level) process, whose process id was 1234.
1522
1523 If you are running a job and wish to do something else you may hit the
1524 suspend key (usually `^Z'), which sends a STOP signal to the current
1525 job. The shell will then normally indicate that the job has been `Sus‐
1526 pended' and print another prompt. If the listjobs shell variable is
1527 set, all jobs will be listed like the jobs builtin command; if it is
1528 set to `long' the listing will be in long format, like `jobs -l'. You
1529 can then manipulate the state of the suspended job. You can put it in
1530 the ``background'' with the bg command or run some other commands and
1531 eventually bring the job back into the ``foreground'' with fg. (See
1532 also the run-fg-editor editor command.) A `^Z' takes effect immedi‐
1533 ately and is like an interrupt in that pending output and unread input
1534 are discarded when it is typed. The wait builtin command causes the
1535 shell to wait for all background jobs to complete.
1536
1537 The `^]' key sends a delayed suspend signal, which does not generate a
1538 STOP signal until a program attempts to read(2) it, to the current job.
1539 This can usefully be typed ahead when you have prepared some commands
1540 for a job which you wish to stop after it has read them. The `^Y' key
1541 performs this function in csh(1); in tcsh, `^Y' is an editing command.
1542 (+)
1543
1544 A job being run in the background stops if it tries to read from the
1545 terminal. Background jobs are normally allowed to produce output, but
1546 this can be disabled by giving the command `stty tostop'. If you set
1547 this tty option, then background jobs will stop when they try to pro‐
1548 duce output like they do when they try to read input.
1549
1550 There are several ways to refer to jobs in the shell. The character
1551 `%' introduces a job name. If you wish to refer to job number 1, you
1552 can name it as `%1'. Just naming a job brings it to the foreground;
1553 thus `%1' is a synonym for `fg %1', bringing job 1 back into the fore‐
1554 ground. Similarly, saying `%1 &' resumes job 1 in the background, just
1555 like `bg %1'. A job can also be named by an unambiguous prefix of the
1556 string typed in to start it: `%ex' would normally restart a suspended
1557 ex(1) job, if there were only one suspended job whose name began with
1558 the string `ex'. It is also possible to say `%?string' to specify a
1559 job whose text contains string, if there is only one such job.
1560
1561 The shell maintains a notion of the current and previous jobs. In out‐
1562 put pertaining to jobs, the current job is marked with a `+' and the
1563 previous job with a `-'. The abbreviations `%+', `%', and (by analogy
1564 with the syntax of the history mechanism) `%%' all refer to the current
1565 job, and `%-' refers to the previous job.
1566
1567 The job control mechanism requires that the stty(1) option `new' be set
1568 on some systems. It is an artifact from a `new' implementation of the
1569 tty driver which allows generation of interrupt characters from the
1570 keyboard to tell jobs to stop. See stty(1) and the setty builtin com‐
1571 mand for details on setting options in the new tty driver.
1572
1573 Status reporting
1574 The shell learns immediately whenever a process changes state. It nor‐
1575 mally informs you whenever a job becomes blocked so that no further
1576 progress is possible, but only right before it prints a prompt. This
1577 is done so that it does not otherwise disturb your work. If, however,
1578 you set the shell variable notify, the shell will notify you immedi‐
1579 ately of changes of status in background jobs. There is also a shell
1580 command notify which marks a single process so that its status changes
1581 will be immediately reported. By default notify marks the current
1582 process; simply say `notify' after starting a background job to mark
1583 it.
1584
1585 When you try to leave the shell while jobs are stopped, you will be
1586 warned that `There are suspended jobs.' You may use the jobs command to
1587 see what they are. If you do this or immediately try to exit again,
1588 the shell will not warn you a second time, and the suspended jobs will
1589 be terminated.
1590
1591 Automatic, periodic and timed events (+)
1592 There are various ways to run commands and take other actions automati‐
1593 cally at various times in the ``life cycle'' of the shell. They are
1594 summarized here, and described in detail under the appropriate Builtin
1595 commands, Special shell variables and Special aliases.
1596
1597 The sched builtin command puts commands in a scheduled-event list, to
1598 be executed by the shell at a given time.
1599
1600 The beepcmd, cwdcmd, periodic, precmd, postcmd, and jobcmd Special
1601 aliases can be set, respectively, to execute commands when the shell
1602 wants to ring the bell, when the working directory changes, every tpe‐
1603 riod minutes, before each prompt, before each command gets executed,
1604 after each command gets executed, and when a job is started or is
1605 brought into the foreground.
1606
1607 The autologout shell variable can be set to log out or lock the shell
1608 after a given number of minutes of inactivity.
1609
1610 The mail shell variable can be set to check for new mail periodically.
1611
1612 The printexitvalue shell variable can be set to print the exit status
1613 of commands which exit with a status other than zero.
1614
1615 The rmstar shell variable can be set to ask the user, when `rm *' is
1616 typed, if that is really what was meant.
1617
1618 The time shell variable can be set to execute the time builtin command
1619 after the completion of any process that takes more than a given number
1620 of CPU seconds.
1621
1622 The watch and who shell variables can be set to report when selected
1623 users log in or out, and the log builtin command reports on those users
1624 at any time.
1625
1626 Native Language System support (+)
1627 The shell is eight bit clean (if so compiled; see the version shell
1628 variable) and thus supports character sets needing this capability.
1629 NLS support differs depending on whether or not the shell was compiled
1630 to use the system's NLS (again, see version). In either case, 7-bit
1631 ASCII is the default character code (e.g., the classification of which
1632 characters are printable) and sorting, and changing the LANG or
1633 LC_CTYPE environment variables causes a check for possible changes in
1634 these respects.
1635
1636 When using the system's NLS, the setlocale(3) function is called to
1637 determine appropriate character code/classification and sorting (e.g.,
1638 a 'en_CA.UTF-8' would yield "UTF-8" as a character code). This func‐
1639 tion typically examines the LANG and LC_CTYPE environment variables;
1640 refer to the system documentation for further details. When not using
1641 the system's NLS, the shell simulates it by assuming that the ISO
1642 8859-1 character set is used whenever either of the LANG and LC_CTYPE
1643 variables are set, regardless of their values. Sorting is not affected
1644 for the simulated NLS.
1645
1646 In addition, with both real and simulated NLS, all printable characters
1647 in the range \200-\377, i.e., those that have M-char bindings, are
1648 automatically rebound to self-insert-command. The corresponding bind‐
1649 ing for the escape-char sequence, if any, is left alone. These charac‐
1650 ters are not rebound if the NOREBIND environment variable is set. This
1651 may be useful for the simulated NLS or a primitive real NLS which
1652 assumes full ISO 8859-1. Otherwise, all M-char bindings in the range
1653 \240-\377 are effectively undone. Explicitly rebinding the relevant
1654 keys with bindkey is of course still possible.
1655
1656 Unknown characters (i.e., those that are neither printable nor control
1657 characters) are printed in the format \nnn. If the tty is not in 8 bit
1658 mode, other 8 bit characters are printed by converting them to ASCII
1659 and using standout mode. The shell never changes the 7/8 bit mode of
1660 the tty and tracks user-initiated changes of 7/8 bit mode. NLS users
1661 (or, for that matter, those who want to use a meta key) may need to
1662 explicitly set the tty in 8 bit mode through the appropriate stty(1)
1663 command in, e.g., the ~/.login file.
1664
1665 OS variant support (+)
1666 A number of new builtin commands are provided to support features in
1667 particular operating systems. All are described in detail in the
1668 Builtin commands section.
1669
1670 On systems that support TCF (aix-ibm370, aix-ps2), getspath and
1671 setspath get and set the system execution path, getxvers and setxvers
1672 get and set the experimental version prefix and migrate migrates pro‐
1673 cesses between sites. The jobs builtin prints the site on which each
1674 job is executing.
1675
1676 Under BS2000, bs2cmd executes commands of the underlying BS2000/OSD
1677 operating system.
1678
1679 Under Domain/OS, inlib adds shared libraries to the current environ‐
1680 ment, rootnode changes the rootnode and ver changes the systype.
1681
1682 Under Mach, setpath is equivalent to Mach's setpath(1).
1683
1684 Under Masscomp/RTU and Harris CX/UX, universe sets the universe.
1685
1686 Under Harris CX/UX, ucb or att runs a command under the specified uni‐
1687 verse.
1688
1689 Under Convex/OS, warp prints or sets the universe.
1690
1691 The VENDOR, OSTYPE and MACHTYPE environment variables indicate respec‐
1692 tively the vendor, operating system and machine type (microprocessor
1693 class or machine model) of the system on which the shell thinks it is
1694 running. These are particularly useful when sharing one's home direc‐
1695 tory between several types of machines; one can, for example,
1696
1697 set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
1698
1699 in one's ~/.login and put executables compiled for each machine in the
1700 appropriate directory.
1701
1702 The version shell variable indicates what options were chosen when the
1703 shell was compiled.
1704
1705 Note also the newgrp builtin, the afsuser and echo_style shell vari‐
1706 ables and the system-dependent locations of the shell's input files
1707 (see FILES).
1708
1709 Signal handling
1710 Login shells ignore interrupts when reading the file ~/.logout. The
1711 shell ignores quit signals unless started with -q. Login shells catch
1712 the terminate signal, but non-login shells inherit the terminate behav‐
1713 ior from their parents. Other signals have the values which the shell
1714 inherited from its parent.
1715
1716 In shell scripts, the shell's handling of interrupt and terminate sig‐
1717 nals can be controlled with onintr, and its handling of hangups can be
1718 controlled with hup and nohup.
1719
1720 The shell exits on a hangup (see also the logout shell variable). By
1721 default, the shell's children do too, but the shell does not send them
1722 a hangup when it exits. hup arranges for the shell to send a hangup to
1723 a child when it exits, and nohup sets a child to ignore hangups.
1724
1725 Terminal management (+)
1726 The shell uses three different sets of terminal (``tty'') modes:
1727 `edit', used when editing, `quote', used when quoting literal charac‐
1728 ters, and `execute', used when executing commands. The shell holds
1729 some settings in each mode constant, so commands which leave the tty in
1730 a confused state do not interfere with the shell. The shell also
1731 matches changes in the speed and padding of the tty. The list of tty
1732 modes that are kept constant can be examined and modified with the
1733 setty builtin. Note that although the editor uses CBREAK mode (or its
1734 equivalent), it takes typed-ahead characters anyway.
1735
1736 The echotc, settc and telltc commands can be used to manipulate and
1737 debug terminal capabilities from the command line.
1738
1739 On systems that support SIGWINCH or SIGWINDOW, the shell adapts to win‐
1740 dow resizing automatically and adjusts the environment variables LINES
1741 and COLUMNS if set. If the environment variable TERMCAP contains li#
1742 and co# fields, the shell adjusts them to reflect the new window size.
1743
1745 The next sections of this manual describe all of the available Builtin
1746 commands, Special aliases and Special shell variables.
1747
1748 Builtin commands
1749 %job A synonym for the fg builtin command.
1750
1751 %job & A synonym for the bg builtin command.
1752
1753 : Does nothing, successfully.
1754
1755 @
1756 @ name = expr
1757 @ name[index] = expr
1758 @ name++|--
1759 @ name[index]++|--
1760 The first form prints the values of all shell variables.
1761
1762 The second form assigns the value of expr to name. The third
1763 form assigns the value of expr to the index'th component of
1764 name; both name and its index'th component must already exist.
1765
1766 expr may contain the operators `*', `+', etc., as in C. If
1767 expr contains `<', `>', `&' or `' then at least that part of
1768 expr must be placed within `()'. Note that the syntax of expr
1769 has nothing to do with that described under Expressions.
1770
1771 The fourth and fifth forms increment (`++') or decrement (`--')
1772 name or its index'th component.
1773
1774 The space between `@' and name is required. The spaces between
1775 name and `=' and between `=' and expr are optional. Components
1776 of expr must be separated by spaces.
1777
1778 alias [name [wordlist]]
1779 Without arguments, prints all aliases. With name, prints the
1780 alias for name. With name and wordlist, assigns wordlist as
1781 the alias of name. wordlist is command and filename substi‐
1782 tuted. name may not be `alias' or `unalias'. See also the
1783 unalias builtin command.
1784
1785 alloc Shows the amount of dynamic memory acquired, broken down into
1786 used and free memory. With an argument shows the number of
1787 free and used blocks in each size category. The categories
1788 start at size 8 and double at each step. This command's output
1789 may vary across system types, because systems other than the
1790 VAX may use a different memory allocator.
1791
1792 bg [%job ...]
1793 Puts the specified jobs (or, without arguments, the current
1794 job) into the background, continuing each if it is stopped.
1795 job may be a number, a string, `', `%', `+' or `-' as described
1796 under Jobs.
1797
1798 bindkey [-l|-d|-e|-v|-u] (+)
1799 bindkey [-a] [-b] [-k] [-r] [--] key (+)
1800 bindkey [-a] [-b] [-k] [-c|-s] [--] key command (+)
1801 Without options, the first form lists all bound keys and the
1802 editor command to which each is bound, the second form lists
1803 the editor command to which key is bound and the third form
1804 binds the editor command command to key. Options include:
1805
1806 -l Lists all editor commands and a short description of each.
1807 -d Binds all keys to the standard bindings for the default
1808 editor.
1809 -e Binds all keys to the standard GNU Emacs-like bindings.
1810 -v Binds all keys to the standard vi(1)-like bindings.
1811 -a Lists or changes key-bindings in the alternative key map.
1812 This is the key map used in vi command mode.
1813 -b key is interpreted as a control character written ^charac‐
1814 ter (e.g., `^A') or C-character (e.g., `C-A'), a meta char‐
1815 acter written M-character (e.g., `M-A'), a function key
1816 written F-string (e.g., `F-string'), or an extended prefix
1817 key written X-character (e.g., `X-A').
1818 -k key is interpreted as a symbolic arrow key name, which may
1819 be one of `down', `up', `left' or `right'.
1820 -r Removes key's binding. Be careful: `bindkey -r' does not
1821 bind key to self-insert-command (q.v.), it unbinds key com‐
1822 pletely.
1823 -c command is interpreted as a builtin or external command
1824 instead of an editor command.
1825 -s command is taken as a literal string and treated as termi‐
1826 nal input when key is typed. Bound keys in command are
1827 themselves reinterpreted, and this continues for ten levels
1828 of interpretation.
1829 -- Forces a break from option processing, so the next word is
1830 taken as key even if it begins with '-'.
1831 -u (or any invalid option)
1832 Prints a usage message.
1833
1834 key may be a single character or a string. If a command is
1835 bound to a string, the first character of the string is bound
1836 to sequence-lead-in and the entire string is bound to the com‐
1837 mand.
1838
1839 Control characters in key can be literal (they can be typed by
1840 preceding them with the editor command quoted-insert, normally
1841 bound to `^V') or written caret-character style, e.g., `^A'.
1842 Delete is written `^?' (caret-question mark). key and command
1843 can contain backslashed escape sequences (in the style of Sys‐
1844 tem V echo(1)) as follows:
1845
1846 \a Bell
1847 \b Backspace
1848 \e Escape
1849 \f Form feed
1850 \n Newline
1851 \r Carriage return
1852 \t Horizontal tab
1853 \v Vertical tab
1854 \nnn The ASCII character corresponding to the octal num‐
1855 ber nnn
1856
1857 `\' nullifies the special meaning of the following character,
1858 if it has any, notably `\' and `^'.
1859
1860 bs2cmd bs2000-command (+)
1861 Passes bs2000-command to the BS2000 command interpreter for
1862 execution. Only non-interactive commands can be executed, and
1863 it is not possible to execute any command that would overlay
1864 the image of the current process, like /EXECUTE or /CALL-PROCE‐
1865 DURE. (BS2000 only)
1866
1867 break Causes execution to resume after the end of the nearest enclos‐
1868 ing foreach or while. The remaining commands on the current
1869 line are executed. Multi-level breaks are thus possible by
1870 writing them all on one line.
1871
1872 breaksw Causes a break from a switch, resuming after the endsw.
1873
1874 builtins (+)
1875 Prints the names of all builtin commands.
1876
1877 bye (+) A synonym for the logout builtin command. Available only if
1878 the shell was so compiled; see the version shell variable.
1879
1880 case label:
1881 A label in a switch statement as discussed below.
1882
1883 cd [-p] [-l] [-n|-v] [I--] [name]
1884 If a directory name is given, changes the shell's working
1885 directory to name. If not, changes to home. If name is `-' it
1886 is interpreted as the previous working directory (see Other
1887 substitutions). (+) If name is not a subdirectory of the cur‐
1888 rent directory (and does not begin with `/', `./' or `../'),
1889 each component of the variable cdpath is checked to see if it
1890 has a subdirectory name. Finally, if all else fails but name
1891 is a shell variable whose value begins with `/', then this is
1892 tried to see if it is a directory.
1893
1894 With -p, prints the final directory stack, just like dirs. The
1895 -l, -n and -v flags have the same effect on cd as on dirs, and
1896 they imply -p. (+) Using -- forces a break from option pro‐
1897 cessing so the next word is taken as the directory name even if
1898 it begins with '-'. (+)
1899
1900 See also the implicitcd shell variable.
1901
1902 chdir A synonym for the cd builtin command.
1903
1904 complete [command [word/pattern/list[:select]/[[suffix]/] ...]] (+)
1905 Without arguments, lists all completions. With command, lists
1906 completions for command. With command and word etc., defines
1907 completions.
1908
1909 command may be a full command name or a glob-pattern (see File‐
1910 name substitution). It can begin with `-' to indicate that
1911 completion should be used only when command is ambiguous.
1912
1913 word specifies which word relative to the current word is to be
1914 completed, and may be one of the following:
1915
1916 c Current-word completion. pattern is a glob-pattern
1917 which must match the beginning of the current word on
1918 the command line. pattern is ignored when completing
1919 the current word.
1920 C Like c, but includes pattern when completing the cur‐
1921 rent word.
1922 n Next-word completion. pattern is a glob-pattern which
1923 must match the beginning of the previous word on the
1924 command line.
1925 N Like n, but must match the beginning of the word two
1926 before the current word.
1927 p Position-dependent completion. pattern is a numeric
1928 range, with the same syntax used to index shell vari‐
1929 ables, which must include the current word.
1930
1931 list, the list of possible completions, may be one of the fol‐
1932 lowing:
1933
1934 a Aliases
1935 b Bindings (editor commands)
1936 c Commands (builtin or external commands)
1937 C External commands which begin with the supplied
1938 path prefix
1939 d Directories
1940 D Directories which begin with the supplied path pre‐
1941 fix
1942 e Environment variables
1943 f Filenames
1944 F Filenames which begin with the supplied path prefix
1945 g Groupnames
1946 j Jobs
1947 l Limits
1948 n Nothing
1949 s Shell variables
1950 S Signals
1951 t Plain (``text'') files
1952 T Plain (``text'') files which begin with the sup‐
1953 plied path prefix
1954 v Any variables
1955 u Usernames
1956 x Like n, but prints select when list-choices is
1957 used.
1958 X Completions
1959 $var Words from the variable var
1960 (...) Words from the given list
1961 `...` Words from the output of command
1962
1963 select is an optional glob-pattern. If given, words from only
1964 list that match select are considered and the fignore shell
1965 variable is ignored. The last three types of completion may
1966 not have a select pattern, and x uses select as an explanatory
1967 message when the list-choices editor command is used.
1968
1969 suffix is a single character to be appended to a successful
1970 completion. If null, no character is appended. If omitted (in
1971 which case the fourth delimiter can also be omitted), a slash
1972 is appended to directories and a space to other words.
1973
1974 command invoked from `...` version has additional environment
1975 variable set, the variable name is COMMAND_LINE and contains
1976 (as its name indicates) contents of the current (already typed
1977 in) command line. One can examine and use contents of the
1978 COMMAND_LINE variable in her custom script to build more
1979 sophisticated completions (see completion for svn(1) included
1980 in this package).
1981
1982 Now for some examples. Some commands take only directories as
1983 arguments, so there's no point completing plain files.
1984
1985 > complete cd 'p/1/d/'
1986
1987 completes only the first word following `cd' (`p/1') with a
1988 directory. p-type completion can also be used to narrow down
1989 command completion:
1990
1991 > co[^D]
1992 complete compress
1993 > complete -co* 'p/0/(compress)/'
1994 > co[^D]
1995 > compress
1996
1997 This completion completes commands (words in position 0, `p/0')
1998 which begin with `co' (thus matching `co*') to `compress' (the
1999 only word in the list). The leading `-' indicates that this
2000 completion is to be used with only ambiguous commands.
2001
2002 > complete find 'n/-user/u/'
2003
2004 is an example of n-type completion. Any word following `find'
2005 and immediately following `-user' is completed from the list of
2006 users.
2007
2008 > complete cc 'c/-I/d/'
2009
2010 demonstrates c-type completion. Any word following `cc' and
2011 beginning with `-I' is completed as a directory. `-I' is not
2012 taken as part of the directory because we used lowercase c.
2013
2014 Different lists are useful with different commands.
2015
2016 > complete alias 'p/1/a/'
2017 > complete man 'p/*/c/'
2018 > complete set 'p/1/s/'
2019 > complete true 'p/1/x:Truth has no options./'
2020
2021 These complete words following `alias' with aliases, `man' with
2022 commands, and `set' with shell variables. `true' doesn't have
2023 any options, so x does nothing when completion is attempted and
2024 prints `Truth has no options.' when completion choices are
2025 listed.
2026
2027 Note that the man example, and several other examples below,
2028 could just as well have used 'c/*' or 'n/*' as 'p/*'.
2029
2030 Words can be completed from a variable evaluated at completion
2031 time,
2032
2033 > complete ftp 'p/1/$hostnames/'
2034 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
2035 > ftp [^D]
2036 rtfm.mit.edu tesla.ee.cornell.edu
2037 > ftp [^C]
2038 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu
2039 uunet.uu.net)
2040 > ftp [^D]
2041 rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
2042
2043 or from a command run at completion time:
2044
2045 > complete kill 'p/*/`ps | awk \{print\ \$1\}`/'
2046 > kill -9 [^D]
2047 23113 23377 23380 23406 23429 23529 23530 PID
2048
2049 Note that the complete command does not itself quote its argu‐
2050 ments, so the braces, space and `$' in `{print $1}' must be
2051 quoted explicitly.
2052
2053 One command can have multiple completions:
2054
2055 > complete dbx 'p/2/(core)/' 'p/*/c/'
2056
2057 completes the second argument to `dbx' with the word `core' and
2058 all other arguments with commands. Note that the positional
2059 completion is specified before the next-word completion.
2060 Because completions are evaluated from left to right, if the
2061 next-word completion were specified first it would always match
2062 and the positional completion would never be executed. This is
2063 a common mistake when defining a completion.
2064
2065 The select pattern is useful when a command takes files with
2066 only particular forms as arguments. For example,
2067
2068 > complete cc 'p/*/f:*.[cao]/'
2069
2070 completes `cc' arguments to files ending in only `.c', `.a', or
2071 `.o'. select can also exclude files, using negation of a glob-
2072 pattern as described under Filename substitution. One might
2073 use
2074
2075 > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
2076
2077 to exclude precious source code from `rm' completion. Of
2078 course, one could still type excluded names manually or over‐
2079 ride the completion mechanism using the complete-word-raw or
2080 list-choices-raw editor commands (q.v.).
2081
2082 The `C', `D', `F' and `T' lists are like `c', `d', `f' and `t'
2083 respectively, but they use the select argument in a different
2084 way: to restrict completion to files beginning with a particu‐
2085 lar path prefix. For example, the Elm mail program uses `=' as
2086 an abbreviation for one's mail directory. One might use
2087
2088 > complete elm c@=@F:$HOME/Mail/@
2089
2090 to complete `elm -f =' as if it were `elm -f ~/Mail/'. Note
2091 that we used `@' instead of `/' to avoid confusion with the
2092 select argument, and we used `$HOME' instead of `~' because
2093 home directory substitution works at only the beginning of a
2094 word.
2095
2096 suffix is used to add a nonstandard suffix (not space or `/'
2097 for directories) to completed words.
2098
2099 > complete finger 'c/*@/$hostnames/' 'p/1/u/@'
2100
2101 completes arguments to `finger' from the list of users, appends
2102 an `@', and then completes after the `@' from the `hostnames'
2103 variable. Note again the order in which the completions are
2104 specified.
2105
2106 Finally, here's a complex example for inspiration:
2107
2108 > complete find \
2109 'n/-name/f/' 'n/-newer/f/' 'n/-{,n}cpio/f/' \
2110 ´n/-exec/c/' 'n/-ok/c/' 'n/-user/u/' \
2111 'n/-group/g/' 'n/-fstype/(nfs 4.2)/' \
2112 'n/-type/(b c d f l p s)/' \
2113 ´c/-/(name newer cpio ncpio exec ok user \
2114 group fstype type atime ctime depth inum \
2115 ls mtime nogroup nouser perm print prune \
2116 size xdev)/' \
2117 'p/*/d/'
2118
2119 This completes words following `-name', `-newer', `-cpio' or
2120 `ncpio' (note the pattern which matches both) to files, words
2121 following `-exec' or `-ok' to commands, words following `user'
2122 and `group' to users and groups respectively and words follow‐
2123 ing `-fstype' or `-type' to members of the given lists. It
2124 also completes the switches themselves from the given list
2125 (note the use of c-type completion) and completes anything not
2126 otherwise completed to a directory. Whew.
2127
2128 Remember that programmed completions are ignored if the word
2129 being completed is a tilde substitution (beginning with `~') or
2130 a variable (beginning with `$'). complete is an experimental
2131 feature, and the syntax may change in future versions of the
2132 shell. See also the uncomplete builtin command.
2133
2134 continue
2135 Continues execution of the nearest enclosing while or foreach.
2136 The rest of the commands on the current line are executed.
2137
2138 default:
2139 Labels the default case in a switch statement. It should come
2140 after all case labels.
2141
2142 dirs [-l] [-n|-v]
2143 dirs -S|-L [filename] (+)
2144 dirs -c (+)
2145 The first form prints the directory stack. The top of the
2146 stack is at the left and the first directory in the stack is
2147 the current directory. With -l, `~' or `~name' in the output
2148 is expanded explicitly to home or the pathname of the home
2149 directory for user name. (+) With -n, entries are wrapped
2150 before they reach the edge of the screen. (+) With -v, entries
2151 are printed one per line, preceded by their stack positions.
2152 (+) If more than one of -n or -v is given, -v takes precedence.
2153 -p is accepted but does nothing.
2154
2155 With -S, the second form saves the directory stack to filename
2156 as a series of cd and pushd commands. With -L, the shell
2157 sources filename, which is presumably a directory stack file
2158 saved by the -S option or the savedirs mechanism. In either
2159 case, dirsfile is used if filename is not given and ~/.cshdirs
2160 is used if dirsfile is unset.
2161
2162 Note that login shells do the equivalent of `dirs -L' on
2163 startup and, if savedirs is set, `dirs -S' before exiting.
2164 Because only ~/.tcshrc is normally sourced before ~/.cshdirs,
2165 dirsfile should be set in ~/.tcshrc rather than ~/.login.
2166
2167 The last form clears the directory stack.
2168
2169 echo [-n] word ...
2170 Writes each word to the shell's standard output, separated by
2171 spaces and terminated with a newline. The echo_style shell
2172 variable may be set to emulate (or not) the flags and escape
2173 sequences of the BSD and/or System V versions of echo; see
2174 echo(1).
2175
2176 echotc [-sv] arg ... (+)
2177 Exercises the terminal capabilities (see termcap(5)) in args.
2178 For example, 'echotc home' sends the cursor to the home posi‐
2179 tion, 'echotc cm 3 10' sends it to column 3 and row 10, and
2180 'echotc ts 0; echo "This is a test."; echotc fs' prints "This
2181 is a test." in the status line.
2182
2183 If arg is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
2184 value of that capability ("yes" or "no" indicating that the
2185 terminal does or does not have that capability). One might use
2186 this to make the output from a shell script less verbose on
2187 slow terminals, or limit command output to the number of lines
2188 on the screen:
2189
2190 > set history=`echotc lines`
2191 > @ history--
2192
2193 Termcap strings may contain wildcards which will not echo cor‐
2194 rectly. One should use double quotes when setting a shell
2195 variable to a terminal capability string, as in the following
2196 example that places the date in the status line:
2197
2198 > set tosl="`echotc ts 0`"
2199 > set frsl="`echotc fs`"
2200 > echo -n "$tosl";date; echo -n "$frsl"
2201
2202 With -s, nonexistent capabilities return the empty string
2203 rather than causing an error. With -v, messages are verbose.
2204
2205 else
2206 end
2207 endif
2208 endsw See the description of the foreach, if, switch, and while
2209 statements below.
2210
2211 eval arg ...
2212 Treats the arguments as input to the shell and executes the
2213 resulting command(s) in the context of the current shell. This
2214 is usually used to execute commands generated as the result of
2215 command or variable substitution, because parsing occurs before
2216 these substitutions. See tset(1) for a sample use of eval.
2217
2218 exec command
2219 Executes the specified command in place of the current shell.
2220
2221 exit [expr]
2222 The shell exits either with the value of the specified expr (an
2223 expression, as described under Expressions) or, without expr,
2224 with the value 0.
2225
2226 fg [%job ...]
2227 Brings the specified jobs (or, without arguments, the current
2228 job) into the foreground, continuing each if it is stopped.
2229 job may be a number, a string, `', `%', `+' or `-' as described
2230 under Jobs. See also the run-fg-editor editor command.
2231
2232 filetest -op file ... (+)
2233 Applies op (which is a file inquiry operator as described under
2234 File inquiry operators) to each file and returns the results as
2235 a space-separated list.
2236
2237 foreach name (wordlist)
2238 ...
2239 end Successively sets the variable name to each member of wordlist
2240 and executes the sequence of commands between this command and
2241 the matching end. (Both foreach and end must appear alone on
2242 separate lines.) The builtin command continue may be used to
2243 continue the loop prematurely and the builtin command break to
2244 terminate it prematurely. When this command is read from the
2245 terminal, the loop is read once prompting with `foreach? ' (or
2246 prompt2) before any statements in the loop are executed. If
2247 you make a mistake typing in a loop at the terminal you can rub
2248 it out.
2249
2250 getspath (+)
2251 Prints the system execution path. (TCF only)
2252
2253 getxvers (+)
2254 Prints the experimental version prefix. (TCF only)
2255
2256 glob wordlist
2257 Like echo, but the `-n' parameter is not recognized and words
2258 are delimited by null characters in the output. Useful for
2259 programs which wish to use the shell to filename expand a list
2260 of words.
2261
2262 goto word
2263 word is filename and command-substituted to yield a string of
2264 the form `label'. The shell rewinds its input as much as pos‐
2265 sible, searches for a line of the form `label:', possibly pre‐
2266 ceded by blanks or tabs, and continues execution after that
2267 line.
2268
2269 hashstat
2270 Prints a statistics line indicating how effective the internal
2271 hash table has been at locating commands (and avoiding exec's).
2272 An exec is attempted for each component of the path where the
2273 hash function indicates a possible hit, and in each component
2274 which does not begin with a `/'.
2275
2276 On machines without vfork(2), prints only the number and size
2277 of hash buckets.
2278
2279 history [-hTr] [n]
2280 history -S|-L|-M [filename] (+)
2281 history -c (+)
2282 The first form prints the history event list. If n is given
2283 only the n most recent events are printed or saved. With -h,
2284 the history list is printed without leading numbers. If -T is
2285 specified, timestamps are printed also in comment form. (This
2286 can be used to produce files suitable for loading with 'history
2287 -L' or 'source -h'.) With -r, the order of printing is most
2288 recent first rather than oldest first.
2289
2290 With -S, the second form saves the history list to filename.
2291 If the first word of the savehist shell variable is set to a
2292 number, at most that many lines are saved. If the second word
2293 of savehist is set to `merge', the history list is merged with
2294 the existing history file instead of replacing it (if there is
2295 one) and sorted by time stamp. (+) Merging is intended for an
2296 environment like the X Window System with several shells in
2297 simultaneous use. Currently it succeeds only when the shells
2298 quit nicely one after another.
2299
2300 With -L, the shell appends filename, which is presumably a his‐
2301 tory list saved by the -S option or the savehist mechanism, to
2302 the history list. -M is like -L, but the contents of filename
2303 are merged into the history list and sorted by timestamp. In
2304 either case, histfile is used if filename is not given and
2305 ~/.history is used if histfile is unset. `history -L' is
2306 exactly like 'source -h' except that it does not require a
2307 filename.
2308
2309 Note that login shells do the equivalent of `history -L' on
2310 startup and, if savehist is set, `history -S' before exiting.
2311 Because only ~/.tcshrc is normally sourced before ~/.history,
2312 histfile should be set in ~/.tcshrc rather than ~/.login.
2313
2314 If histlit is set, the first and second forms print and save
2315 the literal (unexpanded) form of the history list.
2316
2317 The last form clears the history list.
2318
2319 hup [command] (+)
2320 With command, runs command such that it will exit on a hangup
2321 signal and arranges for the shell to send it a hangup signal
2322 when the shell exits. Note that commands may set their own
2323 response to hangups, overriding hup. Without an argument,
2324 causes the non-interactive shell only to exit on a hangup for
2325 the remainder of the script. See also Signal handling and the
2326 nohup builtin command.
2327
2328 if (expr) command
2329 If expr (an expression, as described under Expressions) evalu‐
2330 ates true, then command is executed. Variable substitution on
2331 command happens early, at the same time it does for the rest of
2332 the if command. command must be a simple command, not an
2333 alias, a pipeline, a command list or a parenthesized command
2334 list, but it may have arguments. Input/output redirection
2335 occurs even if expr is false and command is thus not executed;
2336 this is a bug.
2337
2338 if (expr) then
2339 ...
2340 else if (expr2) then
2341 ...
2342 else
2343 ...
2344 endif If the specified expr is true then the commands to the first
2345 else are executed; otherwise if expr2 is true then the commands
2346 to the second else are executed, etc. Any number of else-if
2347 pairs are possible; only one endif is needed. The else part is
2348 likewise optional. (The words else and endif must appear at
2349 the beginning of input lines; the if must appear alone on its
2350 input line or after an else.)
2351
2352 inlib shared-library ... (+)
2353 Adds each shared-library to the current environment. There is
2354 no way to remove a shared library. (Domain/OS only)
2355
2356 jobs [-l]
2357 Lists the active jobs. With -l, lists process IDs in addition
2358 to the normal information. On TCF systems, prints the site on
2359 which each job is executing.
2360
2361 kill [-s signal] %job|pid ...
2362 kill -l The first and second forms sends the specified signal (or, if
2363 none is given, the TERM (terminate) signal) to the specified
2364 jobs or processes. job may be a number, a string, `', `%', `+'
2365 or `-' as described under Jobs. Signals are either given by
2366 number or by name (as given in /usr/include/signal.h, stripped
2367 of the prefix `SIG'). There is no default job; saying just
2368 `kill' does not send a signal to the current job. If the sig‐
2369 nal being sent is TERM (terminate) or HUP (hangup), then the
2370 job or process is sent a CONT (continue) signal as well. The
2371 third form lists the signal names.
2372
2373 limit [-h] [resource [maximum-use]]
2374 Limits the consumption by the current process and each process
2375 it creates to not individually exceed maximum-use on the speci‐
2376 fied resource. If no maximum-use is given, then the current
2377 limit is printed; if no resource is given, then all limitations
2378 are given. If the -h flag is given, the hard limits are used
2379 instead of the current limits. The hard limits impose a ceil‐
2380 ing on the values of the current limits. Only the super-user
2381 may raise the hard limits, but a user may lower or raise the
2382 current limits within the legal range.
2383
2384 Controllable resources currently include (if supported by the
2385 OS):
2386
2387 cputime
2388 the maximum number of cpu-seconds to be used by each
2389 process
2390
2391 filesize
2392 the largest single file which can be created
2393
2394 datasize
2395 the maximum growth of the data+stack region via sbrk(2)
2396 beyond the end of the program text
2397
2398 stacksize
2399 the maximum size of the automatically-extended stack
2400 region
2401
2402 coredumpsize
2403 the size of the largest core dump that will be created
2404
2405 memoryuse
2406 the maximum amount of physical memory a process may have
2407 allocated to it at a given time (this is not implemented
2408 in the 2.6+ kernel, so there is no effect introduced by
2409 changing this value)
2410
2411 vmemoryuse
2412 the maximum amount of virtual memory a process may have
2413 allocated to it at a given time (address space)
2414
2415 vmemoryuse
2416 the maximum amount of virtual memory a process may have
2417 allocated to it at a given time
2418
2419 heapsize
2420 the maximum amount of memory a process may allocate per
2421 brk() system call
2422
2423 descriptors or openfiles
2424 the maximum number of open files for this process
2425
2426 concurrency
2427 the maximum number of threads for this process
2428
2429 memorylocked
2430 the maximum size which a process may lock into memory
2431 using mlock(2)
2432
2433 maxproc
2434 the maximum number of simultaneous processes for this
2435 user id
2436
2437 sbsize the maximum size of socket buffer usage for this user
2438
2439 swapsize
2440 the maximum amount of swap space reserved or used for
2441 this user
2442
2443 maxlocks
2444 the maximum number of locks for this user
2445
2446 maxsignal
2447 the maximum number of pending signals for this user
2448
2449 maxmessage
2450 the maximum number of bytes in POSIX mqueues for this
2451 user
2452
2453 maxnice
2454 the maximum nice priority the user is allowed to raise
2455 mapped from [19...-20] to [0...39] for this user
2456
2457 maxrtprio
2458 the maximum realtime priority for this user maxrttime
2459 the timeout for RT tasks in microseconds for this user.
2460
2461 maximum-use may be given as a (floating point or integer) num‐
2462 ber followed by a scale factor. For all limits other than
2463 cputime the default scale is `k' or `kilobytes' (1024 bytes); a
2464 scale factor of `m' or `megabytes' or `g' or `gigabytes' may
2465 also be used. For cputime the default scaling is `seconds',
2466 while `m' for minutes or `h' for hours, or a time of the form
2467 `mm:ss' giving minutes and seconds may be used.
2468
2469 If maximum-use is `unlimited', then the limitation on the
2470 specified resource is removed (this is equivalent to the
2471 unlimit builtin command).
2472
2473 For both resource names and scale factors, unambiguous prefixes
2474 of the names suffice.
2475
2476 log (+) Prints the watch shell variable and reports on each user indi‐
2477 cated in watch who is logged in, regardless of when they last
2478 logged in. See also watchlog.
2479
2480 login Terminates a login shell, replacing it with an instance of
2481 /bin/login. This is one way to log off, included for compati‐
2482 bility with sh(1).
2483
2484 logout Terminates a login shell. Especially useful if ignoreeof is
2485 set.
2486
2487 ls-F [-switch ...] [file ...] (+)
2488 Lists files like `ls -F', but much faster. It identifies each
2489 type of special file in the listing with a special character:
2490
2491 / Directory
2492 * Executable
2493 # Block device
2494 % Character device
2495 | Named pipe (systems with named pipes only)
2496 = Socket (systems with sockets only)
2497 @ Symbolic link (systems with symbolic links only)
2498 + Hidden directory (AIX only) or context dependent (HP/UX
2499 only)
2500 : Network special (HP/UX only)
2501
2502 If the listlinks shell variable is set, symbolic links are
2503 identified in more detail (on only systems that have them, of
2504 course):
2505
2506 @ Symbolic link to a non-directory
2507 > Symbolic link to a directory
2508 & Symbolic link to nowhere
2509
2510 listlinks also slows down ls-F and causes partitions holding
2511 files pointed to by symbolic links to be mounted.
2512
2513 If the listflags shell variable is set to `x', `a' or `A', or
2514 any combination thereof (e.g., `xA'), they are used as flags to
2515 ls-F, making it act like `ls -xF', `ls -Fa', `ls -FA' or a com‐
2516 bination (e.g., `ls -FxA'). On machines where `ls -C' is not
2517 the default, ls-F acts like `ls -CF', unless listflags contains
2518 an `x', in which case it acts like `ls -xF'. ls-F passes its
2519 arguments to ls(1) if it is given any switches, so `alias ls
2520 ls-F' generally does the right thing.
2521
2522 The ls-F builtin can list files using different colors depend‐
2523 ing on the filetype or extension. See the color shell variable
2524 and the LS_COLORS environment variable.
2525
2526 migrate [-site] pid|%jobid ... (+)
2527 migrate -site (+)
2528 The first form migrates the process or job to the site speci‐
2529 fied or the default site determined by the system path. The
2530 second form is equivalent to `migrate -site $$': it migrates
2531 the current process to the specified site. Migrating the shell
2532 itself can cause unexpected behavior, because the shell does
2533 not like to lose its tty. (TCF only)
2534
2535 newgrp [-] [group] (+)
2536 Equivalent to `exec newgrp'; see newgrp(1). Available only if
2537 the shell was so compiled; see the version shell variable.
2538
2539 nice [+number] [command]
2540 Sets the scheduling priority for the shell to number, or, with‐
2541 out number, to 4. With command, runs command at the appropri‐
2542 ate priority. The greater the number, the less cpu the process
2543 gets. The super-user may specify negative priority by using
2544 `nice -number ...'. Command is always executed in a sub-shell,
2545 and the restrictions placed on commands in simple if statements
2546 apply.
2547
2548 nohup [command]
2549 With command, runs command such that it will ignore hangup sig‐
2550 nals. Note that commands may set their own response to
2551 hangups, overriding nohup. Without an argument, causes the
2552 non-interactive shell only to ignore hangups for the remainder
2553 of the script. See also Signal handling and the hup builtin
2554 command.
2555
2556 notify [%job ...]
2557 Causes the shell to notify the user asynchronously when the
2558 status of any of the specified jobs (or, without %job, the cur‐
2559 rent job) changes, instead of waiting until the next prompt as
2560 is usual. job may be a number, a string, `', `%', `+' or `-'
2561 as described under Jobs. See also the notify shell variable.
2562
2563 onintr [-|label]
2564 Controls the action of the shell on interrupts. Without argu‐
2565 ments, restores the default action of the shell on interrupts,
2566 which is to terminate shell scripts or to return to the termi‐
2567 nal command input level. With `-', causes all interrupts to be
2568 ignored. With label, causes the shell to execute a `goto
2569 label' when an interrupt is received or a child process termi‐
2570 nates because it was interrupted.
2571
2572 onintr is ignored if the shell is running detached and in sys‐
2573 tem startup files (see FILES), where interrupts are disabled
2574 anyway.
2575
2576 popd [-p] [-l] [-n|-v] [+n]
2577 Without arguments, pops the directory stack and returns to the
2578 new top directory. With a number `+n', discards the n'th entry
2579 in the stack.
2580
2581 Finally, all forms of popd print the final directory stack,
2582 just like dirs. The pushdsilent shell variable can be set to
2583 prevent this and the -p flag can be given to override pushdsi‐
2584 lent. The -l, -n and -v flags have the same effect on popd as
2585 on dirs. (+)
2586
2587 printenv [name] (+)
2588 Prints the names and values of all environment variables or,
2589 with name, the value of the environment variable name.
2590
2591 pushd [-p] [-l] [-n|-v] [name|+n]
2592 Without arguments, exchanges the top two elements of the direc‐
2593 tory stack. If pushdtohome is set, pushd without arguments
2594 does `pushd ~', like cd. (+) With name, pushes the current
2595 working directory onto the directory stack and changes to name.
2596 If name is `-' it is interpreted as the previous working direc‐
2597 tory (see Filename substitution). (+) If dunique is set, pushd
2598 removes any instances of name from the stack before pushing it
2599 onto the stack. (+) With a number `+n', rotates the nth ele‐
2600 ment of the directory stack around to be the top element and
2601 changes to it. If dextract is set, however, `pushd +n'
2602 extracts the nth directory, pushes it onto the top of the stack
2603 and changes to it. (+)
2604
2605 Finally, all forms of pushd print the final directory stack,
2606 just like dirs. The pushdsilent shell variable can be set to
2607 prevent this and the -p flag can be given to override pushdsi‐
2608 lent. The -l, -n and -v flags have the same effect on pushd as
2609 on dirs. (+)
2610
2611 rehash Causes the internal hash table of the contents of the directo‐
2612 ries in the path variable to be recomputed. This is needed if
2613 the autorehash shell variable is not set and new commands are
2614 added to directories in path while you are logged in. With
2615 autorehash, a new command will be found automatically, except
2616 in the special case where another command of the same name
2617 which is located in a different directory already exists in the
2618 hash table. Also flushes the cache of home directories built
2619 by tilde expansion.
2620
2621 repeat count command
2622 The specified command, which is subject to the same restric‐
2623 tions as the command in the one line if statement above, is
2624 executed count times. I/O redirections occur exactly once,
2625 even if count is 0.
2626
2627 rootnode //nodename (+)
2628 Changes the rootnode to //nodename, so that `/' will be inter‐
2629 preted as `//nodename'. (Domain/OS only)
2630
2631 sched (+)
2632 sched [+]hh:mm command (+)
2633 sched -n (+)
2634 The first form prints the scheduled-event list. The sched
2635 shell variable may be set to define the format in which the
2636 scheduled-event list is printed. The second form adds command
2637 to the scheduled-event list. For example,
2638
2639 > sched 11:00 echo It\'s eleven o\'clock.
2640
2641 causes the shell to echo `It's eleven o'clock.' at 11 AM. The
2642 time may be in 12-hour AM/PM format
2643
2644 > sched 5pm set prompt='[%h] It\'s after 5; go home: >'
2645
2646 or may be relative to the current time:
2647
2648 > sched +2:15 /usr/lib/uucp/uucico -r1 -sother
2649
2650 A relative time specification may not use AM/PM format. The
2651 third form removes item n from the event list:
2652
2653 > sched
2654 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother
2655 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go
2656 home: >
2657 > sched -2
2658 > sched
2659 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother
2660
2661 A command in the scheduled-event list is executed just before
2662 the first prompt is printed after the time when the command is
2663 scheduled. It is possible to miss the exact time when the com‐
2664 mand is to be run, but an overdue command will execute at the
2665 next prompt. A command which comes due while the shell is
2666 waiting for user input is executed immediately. However, nor‐
2667 mal operation of an already-running command will not be inter‐
2668 rupted so that a scheduled-event list element may be run.
2669
2670 This mechanism is similar to, but not the same as, the at(1)
2671 command on some Unix systems. Its major disadvantage is that
2672 it may not run a command at exactly the specified time. Its
2673 major advantage is that because sched runs directly from the
2674 shell, it has access to shell variables and other structures.
2675 This provides a mechanism for changing one's working environ‐
2676 ment based on the time of day.
2677
2678 set
2679 set name ...
2680 set name=word ...
2681 set [-r] [-f|-l] name=(wordlist) ... (+)
2682 set name[index]=word ...
2683 set -r (+)
2684 set -r name ... (+)
2685 set -r name=word ... (+)
2686 The first form of the command prints the value of all shell
2687 variables. Variables which contain more than a single word
2688 print as a parenthesized word list. The second form sets name
2689 to the null string. The third form sets name to the single
2690 word. The fourth form sets name to the list of words in
2691 wordlist. In all cases the value is command and filename
2692 expanded. If -r is specified, the value is set read-only. If
2693 -f or -l are specified, set only unique words keeping their
2694 order. -f prefers the first occurrence of a word, and -l the
2695 last. The fifth form sets the index'th component of name to
2696 word; this component must already exist. The sixth form lists
2697 only the names of all shell variables that are read-only. The
2698 seventh form makes name read-only, whether or not it has a
2699 value. The eighth form is the same as the third form, but make
2700 name read-only at the same time.
2701
2702 These arguments can be repeated to set and/or make read-only
2703 multiple variables in a single set command. Note, however,
2704 that variable expansion happens for all arguments before any
2705 setting occurs. Note also that `=' can be adjacent to both
2706 name and word or separated from both by whitespace, but cannot
2707 be adjacent to only one or the other. See also the unset
2708 builtin command.
2709
2710 setenv [name [value]]
2711 Without arguments, prints the names and values of all environ‐
2712 ment variables. Given name, sets the environment variable name
2713 to value or, without value, to the null string.
2714
2715 setpath path (+)
2716 Equivalent to setpath(1). (Mach only)
2717
2718 setspath LOCAL|site|cpu ... (+)
2719 Sets the system execution path. (TCF only)
2720
2721 settc cap value (+)
2722 Tells the shell to believe that the terminal capability cap (as
2723 defined in termcap(5)) has the value value. No sanity checking
2724 is done. Concept terminal users may have to `settc xn no' to
2725 get proper wrapping at the rightmost column.
2726
2727 setty [-d|-q|-x] [-a] [[+|-]mode] (+)
2728 Controls which tty modes (see Terminal management) the shell
2729 does not allow to change. -d, -q or -x tells setty to act on
2730 the `edit', `quote' or `execute' set of tty modes respectively;
2731 without -d, -q or -x, `execute' is used.
2732
2733 Without other arguments, setty lists the modes in the chosen
2734 set which are fixed on (`+mode') or off (`-mode'). The avail‐
2735 able modes, and thus the display, vary from system to system.
2736 With -a, lists all tty modes in the chosen set whether or not
2737 they are fixed. With +mode, -mode or mode, fixes mode on or
2738 off or removes control from mode in the chosen set. For exam‐
2739 ple, `setty +echok echoe' fixes `echok' mode on and allows com‐
2740 mands to turn `echoe' mode on or off, both when the shell is
2741 executing commands.
2742
2743 setxvers [string] (+)
2744 Set the experimental version prefix to string, or removes it if
2745 string is omitted. (TCF only)
2746
2747 shift [variable]
2748 Without arguments, discards argv[1] and shifts the members of
2749 argv to the left. It is an error for argv not to be set or to
2750 have less than one word as value. With variable, performs the
2751 same function on variable.
2752
2753 source [-h] name [args ...]
2754 The shell reads and executes commands from name. The commands
2755 are not placed on the history list. If any args are given,
2756 they are placed in argv. (+) source commands may be nested; if
2757 they are nested too deeply the shell may run out of file
2758 descriptors. An error in a source at any level terminates all
2759 nested source commands. With -h, commands are placed on the
2760 history list instead of being executed, much like `history -L'.
2761
2762 stop %job|pid ...
2763 Stops the specified jobs or processes which are executing in
2764 the background. job may be a number, a string, `', `%', `+' or
2765 `-' as described under Jobs. There is no default job; saying
2766 just `stop' does not stop the current job.
2767
2768 suspend Causes the shell to stop in its tracks, much as if it had been
2769 sent a stop signal with ^Z. This is most often used to stop
2770 shells started by su(1).
2771
2772 switch (string)
2773 case str1:
2774 ...
2775 breaksw
2776 ...
2777 default:
2778 ...
2779 breaksw
2780 endsw Each case label is successively matched, against the specified
2781 string which is first command and filename expanded. The file
2782 metacharacters `*', `?' and `[...]' may be used in the case
2783 labels, which are variable expanded. If none of the labels
2784 match before a `default' label is found, then the execution
2785 begins after the default label. Each case label and the
2786 default label must appear at the beginning of a line. The com‐
2787 mand breaksw causes execution to continue after the endsw.
2788 Otherwise control may fall through case labels and default
2789 labels as in C. If no label matches and there is no default,
2790 execution continues after the endsw.
2791
2792 telltc (+)
2793 Lists the values of all terminal capabilities (see termcap(5)).
2794
2795 termname [terminal type] (+)
2796 Tests if terminal type (or the current value of TERM if no ter‐
2797 minal type is given) has an entry in the hosts termcap(5) or
2798 terminfo(5) database. Prints the terminal type to stdout and
2799 returns 0 if an entry is present otherwise returns 1.
2800
2801 time [command]
2802 Executes command (which must be a simple command, not an alias,
2803 a pipeline, a command list or a parenthesized command list) and
2804 prints a time summary as described under the time variable. If
2805 necessary, an extra shell is created to print the time statis‐
2806 tic when the command completes. Without command, prints a time
2807 summary for the current shell and its children.
2808
2809 umask [value]
2810 Sets the file creation mask to value, which is given in octal.
2811 Common values for the mask are 002, giving all access to the
2812 group and read and execute access to others, and 022, giving
2813 read and execute access to the group and others. Without
2814 value, prints the current file creation mask.
2815
2816 unalias pattern
2817 Removes all aliases whose names match pattern. `unalias *'
2818 thus removes all aliases. It is not an error for nothing to be
2819 unaliased.
2820
2821 uncomplete pattern (+)
2822 Removes all completions whose names match pattern. `uncomplete
2823 *' thus removes all completions. It is not an error for noth‐
2824 ing to be uncompleted.
2825
2826 unhash Disables use of the internal hash table to speed location of
2827 executed programs.
2828
2829 universe universe (+)
2830 Sets the universe to universe. (Masscomp/RTU only)
2831
2832 unlimit [-hf] [resource]
2833 Removes the limitation on resource or, if no resource is speci‐
2834 fied, all resource limitations. With -h, the corresponding
2835 hard limits are removed. Only the super-user may do this.
2836 Note that unlimit may not exit successful, since most systems
2837 do not allow descriptors to be unlimited. With -f errors are
2838 ignored.
2839
2840 unset pattern
2841 Removes all variables whose names match pattern, unless they
2842 are read-only. `unset *' thus removes all variables unless
2843 they are read-only; this is a bad idea. It is not an error for
2844 nothing to be unset.
2845
2846 unsetenv pattern
2847 Removes all environment variables whose names match pattern.
2848 `unsetenv *' thus removes all environment variables; this is a
2849 bad idea. It is not an error for nothing to be unsetenved.
2850
2851 ver [systype [command]] (+)
2852 Without arguments, prints SYSTYPE. With systype, sets SYSTYPE
2853 to systype. With systype and command, executes command under
2854 systype. systype may be `bsd4.3' or `sys5.3'. (Domain/OS
2855 only)
2856
2857 wait The shell waits for all background jobs. If the shell is
2858 interactive, an interrupt will disrupt the wait and cause the
2859 shell to print the names and job numbers of all outstanding
2860 jobs.
2861
2862 warp universe (+)
2863 Sets the universe to universe. (Convex/OS only)
2864
2865 watchlog (+)
2866 An alternate name for the log builtin command (q.v.). Avail‐
2867 able only if the shell was so compiled; see the version shell
2868 variable.
2869
2870 where command (+)
2871 Reports all known instances of command, including aliases,
2872 builtins and executables in path.
2873
2874 which command (+)
2875 Displays the command that will be executed by the shell after
2876 substitutions, path searching, etc. The builtin command is
2877 just like which(1), but it correctly reports tcsh aliases and
2878 builtins and is 10 to 100 times faster. See also the which-
2879 command editor command.
2880
2881 while (expr)
2882 ...
2883 end Executes the commands between the while and the matching end
2884 while expr (an expression, as described under Expressions)
2885 evaluates non-zero. while and end must appear alone on their
2886 input lines. break and continue may be used to terminate or
2887 continue the loop prematurely. If the input is a terminal, the
2888 user is prompted the first time through the loop as with fore‐
2889 ach.
2890
2891 Special aliases (+)
2892 If set, each of these aliases executes automatically at the indicated
2893 time. They are all initially undefined.
2894
2895 beepcmd Runs when the shell wants to ring the terminal bell.
2896
2897 cwdcmd Runs after every change of working directory. For example, if
2898 the user is working on an X window system using xterm(1) and a
2899 re-parenting window manager that supports title bars such as
2900 twm(1) and does
2901
2902 > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"'
2903
2904 then the shell will change the title of the running xterm(1) to
2905 be the name of the host, a colon, and the full current working
2906 directory. A fancier way to do that is
2907
2908 > alias cwdcmd 'echo -n
2909 "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
2910
2911 This will put the hostname and working directory on the title
2912 bar but only the hostname in the icon manager menu.
2913
2914 Note that putting a cd, pushd or popd in cwdcmd may cause an
2915 infinite loop. It is the author's opinion that anyone doing so
2916 will get what they deserve.
2917
2918 jobcmd Runs before each command gets executed, or when the command
2919 changes state. This is similar to postcmd, but it does not
2920 print builtins.
2921
2922 > alias jobcmd 'echo -n "^[]2\;\!#:q^G"'
2923
2924 then executing vi foo.c will put the command string in the
2925 xterm title bar.
2926
2927 helpcommand
2928 Invoked by the run-help editor command. The command name for
2929 which help is sought is passed as sole argument. For example,
2930 if one does
2931
2932 > alias helpcommand '\!:1 --help'
2933
2934 then the help display of the command itself will be invoked,
2935 using the GNU help calling convention. Currently there is no
2936 easy way to account for various calling conventions (e.g., the
2937 customary Unix `-h'), except by using a table of many commands.
2938
2939 periodic
2940 Runs every tperiod minutes. This provides a convenient means
2941 for checking on common but infrequent changes such as new mail.
2942 For example, if one does
2943
2944 > set tperiod = 30
2945 > alias periodic checknews
2946
2947 then the checknews(1) program runs every 30 minutes. If peri‐
2948 odic is set but tperiod is unset or set to 0, periodic behaves
2949 like precmd.
2950
2951 precmd Runs just before each prompt is printed. For example, if one
2952 does
2953
2954 > alias precmd date
2955
2956 then date(1) runs just before the shell prompts for each com‐
2957 mand. There are no limits on what precmd can be set to do, but
2958 discretion should be used.
2959
2960 postcmd Runs before each command gets executed.
2961
2962 > alias postcmd 'echo -n "^[]2\;\!#:q^G"'
2963
2964 then executing vi foo.c will put the command string in the
2965 xterm title bar.
2966
2967 shell Specifies the interpreter for executable scripts which do not
2968 themselves specify an interpreter. The first word should be a
2969 full path name to the desired interpreter (e.g., `/bin/csh' or
2970 `/usr/local/bin/tcsh').
2971
2972 Special shell variables
2973 The variables described in this section have special meaning to the
2974 shell.
2975
2976 The shell sets addsuffix, argv, autologout, csubstnonl, command,
2977 echo_style, edit, gid, group, home, loginsh, oid, path, prompt,
2978 prompt2, prompt3, shell, shlvl, tcsh, term, tty, uid, user and version
2979 at startup; they do not change thereafter unless changed by the user.
2980 The shell updates cwd, dirstack, owd and status when necessary, and
2981 sets logout on logout.
2982
2983 The shell synchronizes group, home, path, shlvl, term and user with the
2984 environment variables of the same names: whenever the environment vari‐
2985 able changes the shell changes the corresponding shell variable to
2986 match (unless the shell variable is read-only) and vice versa. Note
2987 that although cwd and PWD have identical meanings, they are not syn‐
2988 chronized in this manner, and that the shell automatically converts
2989 between the different formats of path and PATH.
2990
2991 addsuffix (+)
2992 If set, filename completion adds `/' to the end of directories
2993 and a space to the end of normal files when they are matched
2994 exactly. Set by default.
2995
2996 afsuser (+)
2997 If set, autologout's autolock feature uses its value instead of
2998 the local username for kerberos authentication.
2999
3000 ampm (+)
3001 If set, all times are shown in 12-hour AM/PM format.
3002
3003 argv The arguments to the shell. Positional parameters are taken
3004 from argv, i.e., `$1' is replaced by `$argv[1]', etc. Set by
3005 default, but usually empty in interactive shells.
3006
3007 autocorrect (+)
3008 If set, the spell-word editor command is invoked automatically
3009 before each completion attempt.
3010
3011 autoexpand (+)
3012 If set, the expand-history editor command is invoked automati‐
3013 cally before each completion attempt. If this is set to only‐
3014 history, then only history will be expanded and a second com‐
3015 pletion will expand filenames.
3016
3017 autolist (+)
3018 If set, possibilities are listed after an ambiguous completion.
3019 If set to `ambiguous', possibilities are listed only when no
3020 new characters are added by completion.
3021
3022 autologout (+)
3023 The first word is the number of minutes of inactivity before
3024 automatic logout. The optional second word is the number of
3025 minutes of inactivity before automatic locking. When the shell
3026 automatically logs out, it prints `auto-logout', sets the vari‐
3027 able logout to `automatic' and exits. When the shell automati‐
3028 cally locks, the user is required to enter his password to con‐
3029 tinue working. Five incorrect attempts result in automatic
3030 logout. Set to `60' (automatic logout after 60 minutes, and no
3031 locking) by default in login and superuser shells, but not if
3032 the shell thinks it is running under a window system (i.e., the
3033 DISPLAY environment variable is set), the tty is a pseudo-tty
3034 (pty) or the shell was not so compiled (see the version shell
3035 variable). See also the afsuser and logout shell variables.
3036
3037 autorehash (+)
3038 If set, the internal hash table of the contents of the directo‐
3039 ries in the path variable will be recomputed if a command is
3040 not found in the hash table. In addition, the list of avail‐
3041 able commands will be rebuilt for each command completion or
3042 spelling correction attempt if set to `complete' or `correct'
3043 respectively; if set to `always', this will be done for both
3044 cases.
3045
3046 backslash_quote (+)
3047 If set, backslashes (`\') always quote `\', `'', and `"'. This
3048 may make complex quoting tasks easier, but it can cause syntax
3049 errors in csh(1) scripts.
3050
3051 catalog The file name of the message catalog. If set, tcsh use
3052 `tcsh.${catalog}' as a message catalog instead of default
3053 `tcsh'.
3054
3055 cdpath A list of directories in which cd should search for subdirecto‐
3056 ries if they aren't found in the current directory.
3057
3058 color If set, it enables color display for the builtin ls-F and it
3059 passes --color=auto to ls. Alternatively, it can be set to
3060 only ls-F or only ls to enable color to only one command. Set‐
3061 ting it to nothing is equivalent to setting it to (ls-F ls).
3062
3063 colorcat
3064 If set, it enables color escape sequence for NLS message files.
3065 And display colorful NLS messages.
3066
3067 command (+)
3068 If set, the command which was passed to the shell with the -c
3069 flag (q.v.).
3070
3071 compat_expr (+)
3072 If set, the shell will evaluate expressions right to left, like
3073 the original csh.
3074
3075 complete (+)
3076 If set to `igncase', the completion becomes case insensitive.
3077 If set to `enhance', completion ignores case and considers
3078 hyphens and underscores to be equivalent; it will also treat
3079 periods, hyphens and underscores (`.', `-' and `_') as word
3080 separators. If set to `Enhance', completion matches uppercase
3081 and underscore characters explicitly and matches lowercase and
3082 hyphens in a case-insensivite manner; it will treat periods,
3083 hypens and underscores as word separators.
3084
3085 continue (+)
3086 If set to a list of commands, the shell will continue the
3087 listed commands, instead of starting a new one.
3088
3089 continue_args (+)
3090 Same as continue, but the shell will execute:
3091
3092 echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
3093
3094 correct (+)
3095 If set to `cmd', commands are automatically spelling-corrected.
3096 If set to `complete', commands are automatically completed. If
3097 set to `all', the entire command line is corrected.
3098
3099 csubstnonl (+)
3100 If set, newlines and carriage returns in command substitution
3101 are replaced by spaces. Set by default.
3102
3103 cwd The full pathname of the current directory. See also the
3104 dirstack and owd shell variables.
3105
3106 dextract (+)
3107 If set, `pushd +n' extracts the nth directory from the direc‐
3108 tory stack rather than rotating it to the top.
3109
3110 dirsfile (+)
3111 The default location in which `dirs -S' and `dirs -L' look for
3112 a history file. If unset, ~/.cshdirs is used. Because only
3113 ~/.tcshrc is normally sourced before ~/.cshdirs, dirsfile
3114 should be set in ~/.tcshrc rather than ~/.login.
3115
3116 dirstack (+)
3117 An array of all the directories on the directory stack.
3118 `$dirstack[1]' is the current working directory, `$dirstack[2]'
3119 the first directory on the stack, etc. Note that the current
3120 working directory is `$dirstack[1]' but `=0' in directory stack
3121 substitutions, etc. One can change the stack arbitrarily by
3122 setting dirstack, but the first element (the current working
3123 directory) is always correct. See also the cwd and owd shell
3124 variables.
3125
3126 dspmbyte (+)
3127 Has an effect iff 'dspm' is listed as part of the version shell
3128 variable. If set to `euc', it enables display and editing EUC-
3129 kanji(Japanese) code. If set to `sjis', it enables display and
3130 editing Shift-JIS(Japanese) code. If set to `big5', it enables
3131 display and editing Big5(Chinese) code. If set to `utf8', it
3132 enables display and editing Utf8(Unicode) code. If set to the
3133 following format, it enables display and editing of original
3134 multi-byte code format:
3135
3136 > set dspmbyte = 0000....(256 bytes)....0000
3137
3138 The table requires just 256 bytes. Each character of 256 char‐
3139 acters corresponds (from left to right) to the ASCII codes
3140 0x00, 0x01, ... 0xff. Each character is set to number 0,1,2
3141 and 3. Each number has the following meaning:
3142 0 ... not used for multi-byte characters.
3143 1 ... used for the first byte of a multi-byte character.
3144 2 ... used for the second byte of a multi-byte character.
3145 3 ... used for both the first byte and second byte of a
3146 multi-byte character.
3147
3148 Example:
3149 If set to `001322', the first character (means 0x00 of the
3150 ASCII code) and second character (means 0x01 of ASCII code) are
3151 set to `0'. Then, it is not used for multi-byte characters.
3152 The 3rd character (0x02) is set to '1', indicating that it is
3153 used for the first byte of a multi-byte character. The 4th
3154 character(0x03) is set '3'. It is used for both the first byte
3155 and the second byte of a multi-byte character. The 5th and 6th
3156 characters (0x04,0x05) are set to '2', indicating that they are
3157 used for the second byte of a multi-byte character.
3158
3159 The GNU fileutils version of ls cannot display multi-byte file‐
3160 names without the -N ( --literal ) option. If you are using
3161 this version, set the second word of dspmbyte to "ls". If not,
3162 for example, "ls-F -l" cannot display multi-byte filenames.
3163
3164 Note:
3165 This variable can only be used if KANJI and DSPMBYTE has been
3166 defined at compile time.
3167
3168 dunique (+)
3169 If set, pushd removes any instances of name from the stack
3170 before pushing it onto the stack.
3171
3172 echo If set, each command with its arguments is echoed just before
3173 it is executed. For non-builtin commands all expansions occur
3174 before echoing. Builtin commands are echoed before command and
3175 filename substitution, because these substitutions are then
3176 done selectively. Set by the -x command line option.
3177
3178 echo_style (+)
3179 The style of the echo builtin. May be set to
3180
3181 bsd Don't echo a newline if the first argument is `-n'.
3182 sysv Recognize backslashed escape sequences in echo strings.
3183 both Recognize both the `-n' flag and backslashed escape
3184 sequences; the default.
3185 none Recognize neither.
3186
3187 Set by default to the local system default. The BSD and System
3188 V options are described in the echo(1) man pages on the appro‐
3189 priate systems.
3190
3191 edit (+)
3192 If set, the command-line editor is used. Set by default in
3193 interactive shells.
3194
3195 ellipsis (+)
3196 If set, the `%c'/`%.' and `%C' prompt sequences (see the prompt
3197 shell variable) indicate skipped directories with an ellipsis
3198 (`...') instead of `/<skipped>'.
3199
3200 euid (+)
3201 The user's effective user ID.
3202
3203 euser (+)
3204 The first matching passwd entry name corresponding to the
3205 effective user ID.
3206
3207 fignore (+)
3208 Lists file name suffixes to be ignored by completion.
3209
3210 filec In tcsh, completion is always used and this variable is ignored
3211 by default. If edit is unset, then the traditional csh comple‐
3212 tion is used. If set in csh, filename completion is used.
3213
3214 gid (+) The user's real group ID.
3215
3216 globdot (+)
3217 If set, wild-card glob patterns will match files and directo‐
3218 ries beginning with `.' except for `.' and `..'
3219
3220 globstar (+)
3221 If set, the `**' and `***' file glob patterns will match any
3222 string of characters including `/' traversing any existing sub-
3223 directories. (e.g. `ls **.c' will list all the .c files in
3224 the current directory tree). If used by itself, it will match
3225 zero or more sub-directories (e.g. `ls /usr/include/**/time.h'
3226 will list any file named `time.h' in the /usr/include directory
3227 tree; whereas `ls /usr/include/**time.h' will match any file in
3228 the /usr/include directory tree ending in `time.h'). To pre‐
3229 vent problems with recursion, the `**' glob-pattern will not
3230 descend into a symbolic link containing a directory. To over‐
3231 ride this, use `***'
3232
3233 group (+)
3234 The user's group name.
3235
3236 highlight
3237 If set, the incremental search match (in i-search-back and i-
3238 search-fwd) and the region between the mark and the cursor are
3239 highlighted in reverse video.
3240
3241 Highlighting requires more frequent terminal writes, which
3242 introduces extra overhead. If you care about terminal perfor‐
3243 mance, you may want to leave this unset.
3244
3245 histchars
3246 A string value determining the characters used in History sub‐
3247 stitution (q.v.). The first character of its value is used as
3248 the history substitution character, replacing the default char‐
3249 acter `!'. The second character of its value replaces the
3250 character `^' in quick substitutions.
3251
3252 histdup (+)
3253 Controls handling of duplicate entries in the history list. If
3254 set to `all' only unique history events are entered in the his‐
3255 tory list. If set to `prev' and the last history event is the
3256 same as the current command, then the current command is not
3257 entered in the history. If set to `erase' and the same event
3258 is found in the history list, that old event gets erased and
3259 the current one gets inserted. Note that the `prev' and `all'
3260 options renumber history events so there are no gaps.
3261
3262 histfile (+)
3263 The default location in which `history -S' and `history -L'
3264 look for a history file. If unset, ~/.history is used. hist‐
3265 file is useful when sharing the same home directory between
3266 different machines, or when saving separate histories on dif‐
3267 ferent terminals. Because only ~/.tcshrc is normally sourced
3268 before ~/.history, histfile should be set in ~/.tcshrc rather
3269 than ~/.login.
3270
3271 histlit (+)
3272 If set, builtin and editor commands and the savehist mechanism
3273 use the literal (unexpanded) form of lines in the history list.
3274 See also the toggle-literal-history editor command.
3275
3276 history The first word indicates the number of history events to save.
3277 The optional second word (+) indicates the format in which his‐
3278 tory is printed; if not given, `%h\t%T\t%R\n' is used. The
3279 format sequences are described below under prompt; note the
3280 variable meaning of `%R'. Set to `100' by default.
3281
3282 home Initialized to the home directory of the invoker. The filename
3283 expansion of `~' refers to this variable.
3284
3285 ignoreeof
3286 If set to the empty string or `0' and the input device is a
3287 terminal, the end-of-file command (usually generated by the
3288 user by typing `^D' on an empty line) causes the shell to print
3289 `Use "exit" to leave tcsh.' instead of exiting. This prevents
3290 the shell from accidentally being killed. Historically this
3291 setting exited after 26 successive EOF's to avoid infinite
3292 loops. If set to a number n, the shell ignores n - 1 consecu‐
3293 tive end-of-files and exits on the nth. (+) If unset, `1' is
3294 used, i.e., the shell exits on a single `^D'.
3295
3296 implicitcd (+)
3297 If set, the shell treats a directory name typed as a command as
3298 though it were a request to change to that directory. If set
3299 to verbose, the change of directory is echoed to the standard
3300 output. This behavior is inhibited in non-interactive shell
3301 scripts, or for command strings with more than one word.
3302 Changing directory takes precedence over executing a like-named
3303 command, but it is done after alias substitutions. Tilde and
3304 variable expansions work as expected.
3305
3306 inputmode (+)
3307 If set to `insert' or `overwrite', puts the editor into that
3308 input mode at the beginning of each line.
3309
3310 killdup (+)
3311 Controls handling of duplicate entries in the kill ring. If
3312 set to `all' only unique strings are entered in the kill ring.
3313 If set to `prev' and the last killed string is the same as the
3314 current killed string, then the current string is not entered
3315 in the ring. If set to `erase' and the same string is found in
3316 the kill ring, the old string is erased and the current one is
3317 inserted.
3318
3319 killring (+)
3320 Indicates the number of killed strings to keep in memory. Set
3321 to `30' by default. If unset or set to less than `2', the
3322 shell will only keep the most recently killed string. Strings
3323 are put in the killring by the editor commands that delete
3324 (kill) strings of text, e.g. backward-delete-word, kill-line,
3325 etc, as well as the copy-region-as-kill command. The yank edi‐
3326 tor command will yank the most recently killed string into the
3327 command-line, while yank-pop (see Editor commands) can be used
3328 to yank earlier killed strings.
3329
3330 listflags (+)
3331 If set to `x', `a' or `A', or any combination thereof (e.g.,
3332 `xA'), they are used as flags to ls-F, making it act like `ls
3333 -xF', `ls -Fa', `ls -FA' or a combination (e.g., `ls -FxA'):
3334 `a' shows all files (even if they start with a `.'), `A' shows
3335 all files but `.' and `..', and `x' sorts across instead of
3336 down. If the second word of listflags is set, it is used as
3337 the path to `ls(1)'.
3338
3339 listjobs (+)
3340 If set, all jobs are listed when a job is suspended. If set to
3341 `long', the listing is in long format.
3342
3343 listlinks (+)
3344 If set, the ls-F builtin command shows the type of file to
3345 which each symbolic link points.
3346
3347 listmax (+)
3348 The maximum number of items which the list-choices editor com‐
3349 mand will list without asking first.
3350
3351 listmaxrows (+)
3352 The maximum number of rows of items which the list-choices edi‐
3353 tor command will list without asking first.
3354
3355 loginsh (+)
3356 Set by the shell if it is a login shell. Setting or unsetting
3357 it within a shell has no effect. See also shlvl.
3358
3359 logout (+)
3360 Set by the shell to `normal' before a normal logout, `auto‐
3361 matic' before an automatic logout, and `hangup' if the shell
3362 was killed by a hangup signal (see Signal handling). See also
3363 the autologout shell variable.
3364
3365 mail A list of files and directories to check for incoming mail,
3366 optionally preceded by a numeric word. Before each prompt, if
3367 10 minutes have passed since the last check, the shell checks
3368 each file and says `You have new mail.' (or, if mail contains
3369 multiple files, `You have new mail in name.') if the filesize
3370 is greater than zero in size and has a modification time
3371 greater than its access time.
3372
3373 If you are in a login shell, then no mail file is reported
3374 unless it has been modified after the time the shell has
3375 started up, to prevent redundant notifications. Most login
3376 programs will tell you whether or not you have mail when you
3377 log in.
3378
3379 If a file specified in mail is a directory, the shell will
3380 count each file within that directory as a separate message,
3381 and will report `You have n mails.' or `You have n mails in
3382 name.' as appropriate. This functionality is provided primar‐
3383 ily for those systems which store mail in this manner, such as
3384 the Andrew Mail System.
3385
3386 If the first word of mail is numeric it is taken as a different
3387 mail checking interval, in seconds.
3388
3389 Under very rare circumstances, the shell may report `You have
3390 mail.' instead of `You have new mail.'
3391
3392 matchbeep (+)
3393 If set to `never', completion never beeps. If set to
3394 `nomatch', it beeps only when there is no match. If set to
3395 `ambiguous', it beeps when there are multiple matches. If set
3396 to `notunique', it beeps when there is one exact and other
3397 longer matches. If unset, `ambiguous' is used.
3398
3399 nobeep (+)
3400 If set, beeping is completely disabled. See also visiblebell.
3401
3402 noclobber
3403 If set, restrictions are placed on output redirection to insure
3404 that files are not accidentally destroyed and that `>>' redi‐
3405 rections refer to existing files, as described in the
3406 Input/output section.
3407
3408 noding If set, disable the printing of `DING!' in the prompt time
3409 specifiers at the change of hour.
3410
3411 noglob If set, Filename substitution and Directory stack substitution
3412 (q.v.) are inhibited. This is most useful in shell scripts
3413 which do not deal with filenames, or after a list of filenames
3414 has been obtained and further expansions are not desirable.
3415
3416 nokanji (+)
3417 If set and the shell supports Kanji (see the version shell
3418 variable), it is disabled so that the meta key can be used.
3419
3420 nonomatch
3421 If set, a Filename substitution or Directory stack substitution
3422 (q.v.) which does not match any existing files is left
3423 untouched rather than causing an error. It is still an error
3424 for the substitution to be malformed, e.g., `echo [' still
3425 gives an error.
3426
3427 nostat (+)
3428 A list of directories (or glob-patterns which match directo‐
3429 ries; see Filename substitution) that should not be stat(2)ed
3430 during a completion operation. This is usually used to exclude
3431 directories which take too much time to stat(2), for example
3432 /afs.
3433
3434 notify If set, the shell announces job completions asynchronously.
3435 The default is to present job completions just before printing
3436 a prompt.
3437
3438 oid (+) The user's real organization ID. (Domain/OS only)
3439
3440 owd (+) The old working directory, equivalent to the `-' used by cd and
3441 pushd. See also the cwd and dirstack shell variables.
3442
3443 padhour If set, enable the printing of padding '0' for hours, in 24 and
3444 12 hour formats. E.G.: 07:45:42 vs. 7:45:42.
3445
3446 parseoctal
3447 To retain compatibily with older versions numeric variables
3448 starting with 0 are not interpreted as octal. Setting this
3449 variable enables proper octal parsing.
3450
3451 path A list of directories in which to look for executable commands.
3452 A null word specifies the current directory. If there is no
3453 path variable then only full path names will execute. path is
3454 set by the shell at startup from the PATH environment variable
3455 or, if PATH does not exist, to a system-dependent default some‐
3456 thing like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'. The
3457 shell may put `.' first or last in path or omit it entirely
3458 depending on how it was compiled; see the version shell vari‐
3459 able. A shell which is given neither the -c nor the -t option
3460 hashes the contents of the directories in path after reading
3461 ~/.tcshrc and each time path is reset. If one adds a new com‐
3462 mand to a directory in path while the shell is active, one may
3463 need to do a rehash for the shell to find it.
3464
3465 printexitvalue (+)
3466 If set and an interactive program exits with a non-zero status,
3467 the shell prints `Exit status'.
3468
3469 prompt The string which is printed before reading each command from
3470 the terminal. prompt may include any of the following format‐
3471 ting sequences (+), which are replaced by the given informa‐
3472 tion:
3473
3474 %/ The current working directory.
3475 %~ The current working directory, but with one's home direc‐
3476 tory represented by `~' and other users' home directories
3477 represented by `~user' as per Filename substitution.
3478 `~user' substitution happens only if the shell has already
3479 used `~user' in a pathname in the current session.
3480 %c[[0]n], %.[[0]n]
3481 The trailing component of the current working directory, or
3482 n trailing components if a digit n is given. If n begins
3483 with `0', the number of skipped components precede the
3484 trailing component(s) in the format `/<skipped>trailing'.
3485 If the ellipsis shell variable is set, skipped components
3486 are represented by an ellipsis so the whole becomes
3487 `...trailing'. `~' substitution is done as in `%~' above,
3488 but the `~' component is ignored when counting trailing
3489 components.
3490 %C Like %c, but without `~' substitution.
3491 %h, %!, !
3492 The current history event number.
3493 %M The full hostname.
3494 %m The hostname up to the first `.'.
3495 %S (%s)
3496 Start (stop) standout mode.
3497 %B (%b)
3498 Start (stop) boldfacing mode.
3499 %U (%u)
3500 Start (stop) underline mode.
3501 %t, %@
3502 The time of day in 12-hour AM/PM format.
3503 %T Like `%t', but in 24-hour format (but see the ampm shell
3504 variable).
3505 %p The `precise' time of day in 12-hour AM/PM format, with
3506 seconds.
3507 %P Like `%p', but in 24-hour format (but see the ampm shell
3508 variable).
3509 \c c is parsed as in bindkey.
3510 ^c c is parsed as in bindkey.
3511 %% A single `%'.
3512 %n The user name.
3513 %N The effective user name.
3514 %j The number of jobs.
3515 %d The weekday in `Day' format.
3516 %D The day in `dd' format.
3517 %w The month in `Mon' format.
3518 %W The month in `mm' format.
3519 %y The year in `yy' format.
3520 %Y The year in `yyyy' format.
3521 %l The shell's tty.
3522 %L Clears from the end of the prompt to end of the display or
3523 the end of the line.
3524 %$ Expands the shell or environment variable name immediately
3525 after the `$'.
3526 %# `>' (or the first character of the promptchars shell vari‐
3527 able) for normal users, `#' (or the second character of
3528 promptchars) for the superuser.
3529 %{string%}
3530 Includes string as a literal escape sequence. It should be
3531 used only to change terminal attributes and should not move
3532 the cursor location. This cannot be the last sequence in
3533 prompt.
3534 %? The return code of the command executed just before the
3535 prompt.
3536 %R In prompt2, the status of the parser. In prompt3, the cor‐
3537 rected string. In history, the history string.
3538
3539 `%B', `%S', `%U' and `%{string%}' are available in only eight-
3540 bit-clean shells; see the version shell variable.
3541
3542 The bold, standout and underline sequences are often used to
3543 distinguish a superuser shell. For example,
3544
3545 > set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
3546 tut [37] [2:54pm] [/usr/accts/sys] you rang? _
3547
3548 If `%t', `%@', `%T', `%p', or `%P' is used, and noding is not
3549 set, then print `DING!' on the change of hour (i.e, `:00' min‐
3550 utes) instead of the actual time.
3551
3552 Set by default to `%# ' in interactive shells.
3553
3554 prompt2 (+)
3555 The string with which to prompt in while and foreach loops and
3556 after lines ending in `\'. The same format sequences may be
3557 used as in prompt (q.v.); note the variable meaning of `%R'.
3558 Set by default to `%R? ' in interactive shells.
3559
3560 prompt3 (+)
3561 The string with which to prompt when confirming automatic
3562 spelling correction. The same format sequences may be used as
3563 in prompt (q.v.); note the variable meaning of `%R'. Set by
3564 default to `CORRECT>%R (y|n|e|a)? ' in interactive shells.
3565
3566 promptchars (+)
3567 If set (to a two-character string), the `%#' formatting
3568 sequence in the prompt shell variable is replaced with the
3569 first character for normal users and the second character for
3570 the superuser.
3571
3572 pushdtohome (+)
3573 If set, pushd without arguments does `pushd ~', like cd.
3574
3575 pushdsilent (+)
3576 If set, pushd and popd do not print the directory stack.
3577
3578 recexact (+)
3579 If set, completion completes on an exact match even if a longer
3580 match is possible.
3581
3582 recognize_only_executables (+)
3583 If set, command listing displays only files in the path that
3584 are executable. Slow.
3585
3586 rmstar (+)
3587 If set, the user is prompted before `rm *' is executed.
3588
3589 rprompt (+)
3590 The string to print on the right-hand side of the screen (after
3591 the command input) when the prompt is being displayed on the
3592 left. It recognizes the same formatting characters as prompt.
3593 It will automatically disappear and reappear as necessary, to
3594 ensure that command input isn't obscured, and will appear only
3595 if the prompt, command input, and itself will fit together on
3596 the first line. If edit isn't set, then rprompt will be
3597 printed after the prompt and before the command input.
3598
3599 savedirs (+)
3600 If set, the shell does `dirs -S' before exiting. If the first
3601 word is set to a number, at most that many directory stack
3602 entries are saved.
3603
3604 savehist
3605 If set, the shell does `history -S' before exiting. If the
3606 first word is set to a number, at most that many lines are
3607 saved. (The number must be less than or equal to history.) If
3608 the second word is set to `merge', the history list is merged
3609 with the existing history file instead of replacing it (if
3610 there is one) and sorted by time stamp and the most recent
3611 events are retained. (+)
3612
3613 sched (+)
3614 The format in which the sched builtin command prints scheduled
3615 events; if not given, `%h\t%T\t%R\n' is used. The format
3616 sequences are described above under prompt; note the variable
3617 meaning of `%R'.
3618
3619 shell The file in which the shell resides. This is used in forking
3620 shells to interpret files which have execute bits set, but
3621 which are not executable by the system. (See the description
3622 of Builtin and non-builtin command execution.) Initialized to
3623 the (system-dependent) home of the shell.
3624
3625 shlvl (+)
3626 The number of nested shells. Reset to 1 in login shells. See
3627 also loginsh.
3628
3629 status The exit status from the last command or backquote expansion,
3630 or any command in a pipeline is propagated to status. (This is
3631 also the default csh behavior.) This default does not match
3632 what POSIX mandates (to return the status of the last command
3633 only). To match the POSIX behavior, you need to unset anyerror.
3634
3635 If the anyerror variable is unset, the exit status of a pipe‐
3636 line is determined only from the last command in the pipeline,
3637 and the exit status of a backquote expansion is not propagated
3638 to status.
3639
3640 If a command terminated abnormally, then 0200 is added to the
3641 status. Builtin commands which fail return exit status `1',
3642 all other builtin commands return status `0'.
3643
3644 symlinks (+)
3645 Can be set to several different values to control symbolic link
3646 (`symlink') resolution:
3647
3648 If set to `chase', whenever the current directory changes to a
3649 directory containing a symbolic link, it is expanded to the
3650 real name of the directory to which the link points. This does
3651 not work for the user's home directory; this is a bug.
3652
3653 If set to `ignore', the shell tries to construct a current
3654 directory relative to the current directory before the link was
3655 crossed. This means that cding through a symbolic link and
3656 then `cd ..'ing returns one to the original directory. This
3657 affects only builtin commands and filename completion.
3658
3659 If set to `expand', the shell tries to fix symbolic links by
3660 actually expanding arguments which look like path names. This
3661 affects any command, not just builtins. Unfortunately, this
3662 does not work for hard-to-recognize filenames, such as those
3663 embedded in command options. Expansion may be prevented by
3664 quoting. While this setting is usually the most convenient, it
3665 is sometimes misleading and sometimes confusing when it fails
3666 to recognize an argument which should be expanded. A compro‐
3667 mise is to use `ignore' and use the editor command normalize-
3668 path (bound by default to ^X-n) when necessary.
3669
3670 Some examples are in order. First, let's set up some play
3671 directories:
3672
3673 > cd /tmp
3674 > mkdir from from/src to
3675 > ln -s from/src to/dst
3676
3677 Here's the behavior with symlinks unset,
3678
3679 > cd /tmp/to/dst; echo $cwd
3680 /tmp/to/dst
3681 > cd ..; echo $cwd
3682 /tmp/from
3683
3684 here's the behavior with symlinks set to `chase',
3685
3686 > cd /tmp/to/dst; echo $cwd
3687 /tmp/from/src
3688 > cd ..; echo $cwd
3689 /tmp/from
3690
3691 here's the behavior with symlinks set to `ignore',
3692
3693 > cd /tmp/to/dst; echo $cwd
3694 /tmp/to/dst
3695 > cd ..; echo $cwd
3696 /tmp/to
3697
3698 and here's the behavior with symlinks set to `expand'.
3699
3700 > cd /tmp/to/dst; echo $cwd
3701 /tmp/to/dst
3702 > cd ..; echo $cwd
3703 /tmp/to
3704 > cd /tmp/to/dst; echo $cwd
3705 /tmp/to/dst
3706 > cd ".."; echo $cwd
3707 /tmp/from
3708 > /bin/echo ..
3709 /tmp/to
3710 > /bin/echo ".."
3711 ..
3712
3713 Note that `expand' expansion 1) works just like `ignore' for
3714 builtins like cd, 2) is prevented by quoting, and 3) happens
3715 before filenames are passed to non-builtin commands.
3716
3717 tcsh (+)
3718 The version number of the shell in the format `R.VV.PP', where
3719 `R' is the major release number, `VV' the current version and
3720 `PP' the patchlevel.
3721
3722 term The terminal type. Usually set in ~/.login as described under
3723 Startup and shutdown.
3724
3725 time If set to a number, then the time builtin (q.v.) executes auto‐
3726 matically after each command which takes more than that many
3727 CPU seconds. If there is a second word, it is used as a format
3728 string for the output of the time builtin. (u) The following
3729 sequences may be used in the format string:
3730
3731 %U The time the process spent in user mode in cpu seconds.
3732 %S The time the process spent in kernel mode in cpu seconds.
3733 %E The elapsed (wall clock) time in seconds.
3734 %P The CPU percentage computed as (%U + %S) / %E.
3735 %W Number of times the process was swapped.
3736 %X The average amount in (shared) text space used in Kbytes.
3737 %D The average amount in (unshared) data/stack space used in
3738 Kbytes.
3739 %K The total space used (%X + %D) in Kbytes.
3740 %M The maximum memory the process had in use at any time in
3741 Kbytes.
3742 %F The number of major page faults (page needed to be brought
3743 from disk).
3744 %R The number of minor page faults.
3745 %I The number of input operations.
3746 %O The number of output operations.
3747 %r The number of socket messages received.
3748 %s The number of socket messages sent.
3749 %k The number of signals received.
3750 %w The number of voluntary context switches (waits).
3751 %c The number of involuntary context switches.
3752
3753 Only the first four sequences are supported on systems without
3754 BSD resource limit functions. The default time format is `%Uu
3755 %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww' for systems that support
3756 resource usage reporting and `%Uu %Ss %E %P' for systems that
3757 do not.
3758
3759 Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not avail‐
3760 able, but the following additional sequences are:
3761
3762 %Y The number of system calls performed.
3763 %Z The number of pages which are zero-filled on demand.
3764 %i The number of times a process's resident set size was
3765 increased by the kernel.
3766 %d The number of times a process's resident set size was
3767 decreased by the kernel.
3768 %l The number of read system calls performed.
3769 %m The number of write system calls performed.
3770 %p The number of reads from raw disk devices.
3771 %q The number of writes to raw disk devices.
3772
3773 and the default time format is `%Uu %Ss %E %P %I+%Oio
3774 %Fpf+%Ww'. Note that the CPU percentage can be higher than
3775 100% on multi-processors.
3776
3777 tperiod (+)
3778 The period, in minutes, between executions of the periodic spe‐
3779 cial alias.
3780
3781 tty (+) The name of the tty, or empty if not attached to one.
3782
3783 uid (+) The user's real user ID.
3784
3785 user The user's login name.
3786
3787 verbose If set, causes the words of each command to be printed, after
3788 history substitution (if any). Set by the -v command line
3789 option.
3790
3791 version (+)
3792 The version ID stamp. It contains the shell's version number
3793 (see tcsh), origin, release date, vendor, operating system and
3794 machine (see VENDOR, OSTYPE and MACHTYPE) and a comma-separated
3795 list of options which were set at compile time. Options which
3796 are set by default in the distribution are noted.
3797
3798 8b The shell is eight bit clean; default
3799 7b The shell is not eight bit clean
3800 wide The shell is multibyte encoding clean (like UTF-8)
3801 nls The system's NLS is used; default for systems with NLS
3802 lf Login shells execute /etc/csh.login before instead of
3803 after /etc/csh.cshrc and ~/.login before instead of after
3804 ~/.tcshrc and ~/.history.
3805 dl `.' is put last in path for security; default
3806 nd `.' is omitted from path for security
3807 vi vi-style editing is the default rather than emacs
3808 dtr Login shells drop DTR when exiting
3809 bye bye is a synonym for logout and log is an alternate name
3810 for watchlog
3811 al autologout is enabled; default
3812 kan Kanji is used if appropriate according to locale set‐
3813 tings, unless the nokanji shell variable is set
3814 sm The system's malloc(3) is used
3815 hb The `#!<program> <args>' convention is emulated when exe‐
3816 cuting shell scripts
3817 ng The newgrp builtin is available
3818 rh The shell attempts to set the REMOTEHOST environment
3819 variable
3820 afs The shell verifies your password with the kerberos server
3821 if local authentication fails. The afsuser shell vari‐
3822 able or the AFSUSER environment variable override your
3823 local username if set.
3824
3825 An administrator may enter additional strings to indicate dif‐
3826 ferences in the local version.
3827
3828 visiblebell (+)
3829 If set, a screen flash is used rather than the audible bell.
3830 See also nobeep.
3831
3832 watch (+)
3833 A list of user/terminal pairs to watch for logins and logouts.
3834 If either the user is `any' all terminals are watched for the
3835 given user and vice versa. Setting watch to `(any any)'
3836 watches all users and terminals. For example,
3837
3838 set watch = (george ttyd1 any console $user any)
3839
3840 reports activity of the user `george' on ttyd1, any user on the
3841 console, and oneself (or a trespasser) on any terminal.
3842
3843 Logins and logouts are checked every 10 minutes by default, but
3844 the first word of watch can be set to a number to check every
3845 so many minutes. For example,
3846
3847 set watch = (1 any any)
3848
3849 reports any login/logout once every minute. For the impatient,
3850 the log builtin command triggers a watch report at any time.
3851 All current logins are reported (as with the log builtin) when
3852 watch is first set.
3853
3854 The who shell variable controls the format of watch reports.
3855
3856 who (+) The format string for watch messages. The following sequences
3857 are replaced by the given information:
3858
3859 %n The name of the user who logged in/out.
3860 %a The observed action, i.e., `logged on', `logged off' or
3861 `replaced olduser on'.
3862 %l The terminal (tty) on which the user logged in/out.
3863 %M The full hostname of the remote host, or `local' if the
3864 login/logout was from the local host.
3865 %m The hostname of the remote host up to the first `.'. The
3866 full name is printed if it is an IP address or an X Window
3867 System display.
3868
3869 %M and %m are available on only systems that store the remote
3870 hostname in /etc/utmp. If unset, `%n has %a %l from %m.' is
3871 used, or `%n has %a %l.' on systems which don't store the
3872 remote hostname.
3873
3874 wordchars (+)
3875 A list of non-alphanumeric characters to be considered part of
3876 a word by the forward-word, backward-word etc., editor com‐
3877 mands. If unset, `*?_-.[]~=' is used.
3878
3880 AFSUSER (+)
3881 Equivalent to the afsuser shell variable.
3882
3883 COLUMNS The number of columns in the terminal. See Terminal manage‐
3884 ment.
3885
3886 DISPLAY Used by X Window System (see X(1)). If set, the shell does not
3887 set autologout (q.v.).
3888
3889 EDITOR The pathname to a default editor. See also the VISUAL environ‐
3890 ment variable and the run-fg-editor editor command.
3891
3892 GROUP (+)
3893 Equivalent to the group shell variable.
3894
3895 HOME Equivalent to the home shell variable.
3896
3897 HOST (+)
3898 Initialized to the name of the machine on which the shell is
3899 running, as determined by the gethostname(2) system call.
3900
3901 HOSTTYPE (+)
3902 Initialized to the type of machine on which the shell is run‐
3903 ning, as determined at compile time. This variable is obsolete
3904 and will be removed in a future version.
3905
3906 HPATH (+)
3907 A colon-separated list of directories in which the run-help
3908 editor command looks for command documentation.
3909
3910 LANG Gives the preferred character environment. See Native Language
3911 System support.
3912
3913 LC_CTYPE
3914 If set, only ctype character handling is changed. See Native
3915 Language System support.
3916
3917 LINES The number of lines in the terminal. See Terminal management.
3918
3919 LS_COLORS
3920 The format of this variable is reminiscent of the termcap(5)
3921 file format; a colon-separated list of expressions of the form
3922 "xx=string", where "xx" is a two-character variable name. The
3923 variables with their associated defaults are:
3924
3925 no 0 Normal (non-filename) text
3926 fi 0 Regular file
3927 di 01;34 Directory
3928 ln 01;36 Symbolic link
3929 pi 33 Named pipe (FIFO)
3930 so 01;35 Socket
3931 do 01;35 Door
3932 bd 01;33 Block device
3933 cd 01;32 Character device
3934 ex 01;32 Executable file
3935 mi (none) Missing file (defaults to fi)
3936 or (none) Orphaned symbolic link (defaults to ln)
3937 lc ^[[ Left code
3938 rc m Right code
3939 ec (none) End code (replaces lc+no+rc)
3940
3941 You need to include only the variables you want to change from
3942 the default.
3943
3944 File names can also be colorized based on filename extension.
3945 This is specified in the LS_COLORS variable using the syntax
3946 "*ext=string". For example, using ISO 6429 codes, to color all
3947 C-language source files blue you would specify "*.c=34". This
3948 would color all files ending in .c in blue (34) color.
3949
3950 Control characters can be written either in C-style-escaped
3951 notation, or in stty-like ^-notation. The C-style notation
3952 adds ^[ for Escape, _ for a normal space character, and ? for
3953 Delete. In addition, the ^[ escape character can be used to
3954 override the default interpretation of ^[, ^, : and =.
3955
3956 Each file will be written as <lc> <color-code> <rc> <filename>
3957 <ec>. If the <ec> code is undefined, the sequence <lc> <no>
3958 <rc> will be used instead. This is generally more convenient
3959 to use, but less general. The left, right and end codes are
3960 provided so you don't have to type common parts over and over
3961 again and to support weird terminals; you will generally not
3962 need to change them at all unless your terminal does not use
3963 ISO 6429 color sequences but a different system.
3964
3965 If your terminal does use ISO 6429 color codes, you can compose
3966 the type codes (i.e., all except the lc, rc, and ec codes) from
3967 numerical commands separated by semicolons. The most common
3968 commands are:
3969
3970 0 to restore default color
3971 1 for brighter colors
3972 4 for underlined text
3973 5 for flashing text
3974 30 for black foreground
3975 31 for red foreground
3976 32 for green foreground
3977 33 for yellow (or brown) foreground
3978 34 for blue foreground
3979 35 for purple foreground
3980 36 for cyan foreground
3981 37 for white (or gray) foreground
3982 40 for black background
3983 41 for red background
3984 42 for green background
3985 43 for yellow (or brown) background
3986 44 for blue background
3987 45 for purple background
3988 46 for cyan background
3989 47 for white (or gray) background
3990
3991 Not all commands will work on all systems or display devices.
3992
3993 A few terminal programs do not recognize the default end code
3994 properly. If all text gets colorized after you do a directory
3995 listing, try changing the no and fi codes from 0 to the numeri‐
3996 cal codes for your standard fore- and background colors.
3997
3998 MACHTYPE (+)
3999 The machine type (microprocessor class or machine model), as
4000 determined at compile time.
4001
4002 NOREBIND (+)
4003 If set, printable characters are not rebound to self-insert-
4004 command. See Native Language System support.
4005
4006 OSTYPE (+)
4007 The operating system, as determined at compile time.
4008
4009 PATH A colon-separated list of directories in which to look for exe‐
4010 cutables. Equivalent to the path shell variable, but in a dif‐
4011 ferent format.
4012
4013 PWD (+) Equivalent to the cwd shell variable, but not synchronized to
4014 it; updated only after an actual directory change.
4015
4016 REMOTEHOST (+)
4017 The host from which the user has logged in remotely, if this is
4018 the case and the shell is able to determine it. Set only if
4019 the shell was so compiled; see the version shell variable.
4020
4021 SHLVL (+)
4022 Equivalent to the shlvl shell variable.
4023
4024 SYSTYPE (+)
4025 The current system type. (Domain/OS only)
4026
4027 TERM Equivalent to the term shell variable.
4028
4029 TERMCAP The terminal capability string. See Terminal management.
4030
4031 USER Equivalent to the user shell variable.
4032
4033 VENDOR (+)
4034 The vendor, as determined at compile time.
4035
4036 VISUAL The pathname to a default full-screen editor. See also the
4037 EDITOR environment variable and the run-fg-editor editor com‐
4038 mand.
4039
4041 /etc/csh.cshrc Read first by every shell. ConvexOS, Stellix and Intel
4042 use /etc/cshrc and NeXTs use /etc/cshrc.std. A/UX,
4043 AMIX, Cray and IRIX have no equivalent in csh(1), but
4044 read this file in tcsh anyway. Solaris 2.x does not
4045 have it either, but tcsh reads /etc/.cshrc. (+)
4046 /etc/csh.login Read by login shells after /etc/csh.cshrc. ConvexOS,
4047 Stellix and Intel use /etc/login, NeXTs use
4048 /etc/login.std, Solaris 2.x uses /etc/.login and A/UX,
4049 AMIX, Cray and IRIX use /etc/cshrc.
4050 ~/.tcshrc (+) Read by every shell after /etc/csh.cshrc or its equiva‐
4051 lent.
4052 ~/.cshrc Read by every shell, if ~/.tcshrc doesn't exist, after
4053 /etc/csh.cshrc or its equivalent. This manual uses
4054 `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is not
4055 found, ~/.cshrc'.
4056 ~/.history Read by login shells after ~/.tcshrc if savehist is
4057 set, but see also histfile.
4058 ~/.login Read by login shells after ~/.tcshrc or ~/.history.
4059 The shell may be compiled to read ~/.login before
4060 instead of after ~/.tcshrc and ~/.history; see the ver‐
4061 sion shell variable.
4062 ~/.cshdirs (+) Read by login shells after ~/.login if savedirs is set,
4063 but see also dirsfile.
4064 /etc/csh.logout Read by login shells at logout. ConvexOS, Stellix and
4065 Intel use /etc/logout and NeXTs use /etc/logout.std.
4066 A/UX, AMIX, Cray and IRIX have no equivalent in csh(1),
4067 but read this file in tcsh anyway. Solaris 2.x does
4068 not have it either, but tcsh reads /etc/.logout. (+)
4069 ~/.logout Read by login shells at logout after /etc/csh.logout or
4070 its equivalent.
4071 /bin/sh Used to interpret shell scripts not starting with a
4072 `#'.
4073 /tmp/sh* Temporary file for `<<'.
4074 /etc/passwd Source of home directories for `~name' substitutions.
4075
4076 The order in which startup files are read may differ if the shell was
4077 so compiled; see Startup and shutdown and the version shell variable.
4078
4080 This manual describes tcsh as a single entity, but experienced csh(1)
4081 users will want to pay special attention to tcsh's new features.
4082
4083 A command-line editor, which supports GNU Emacs or vi(1)-style key
4084 bindings. See The command-line editor and Editor commands.
4085
4086 Programmable, interactive word completion and listing. See Completion
4087 and listing and the complete and uncomplete builtin commands.
4088
4089 Spelling correction (q.v.) of filenames, commands and variables.
4090
4091 Editor commands (q.v.) which perform other useful functions in the mid‐
4092 dle of typed commands, including documentation lookup (run-help), quick
4093 editor restarting (run-fg-editor) and command resolution (which-com‐
4094 mand).
4095
4096 An enhanced history mechanism. Events in the history list are time-
4097 stamped. See also the history command and its associated shell vari‐
4098 ables, the previously undocumented `#' event specifier and new modi‐
4099 fiers under History substitution, the *-history, history-search-*, i-
4100 search-*, vi-search-* and toggle-literal-history editor commands and
4101 the histlit shell variable.
4102
4103 Enhanced directory parsing and directory stack handling. See the cd,
4104 pushd, popd and dirs commands and their associated shell variables, the
4105 description of Directory stack substitution, the dirstack, owd and sym‐
4106 links shell variables and the normalize-command and normalize-path edi‐
4107 tor commands.
4108
4109 Negation in glob-patterns. See Filename substitution.
4110
4111 New File inquiry operators (q.v.) and a filetest builtin which uses
4112 them.
4113
4114 A variety of Automatic, periodic and timed events (q.v.) including
4115 scheduled events, special aliases, automatic logout and terminal lock‐
4116 ing, command timing and watching for logins and logouts.
4117
4118 Support for the Native Language System (see Native Language System sup‐
4119 port), OS variant features (see OS variant support and the echo_style
4120 shell variable) and system-dependent file locations (see FILES).
4121
4122 Extensive terminal-management capabilities. See Terminal management.
4123
4124 New builtin commands including builtins, hup, ls-F, newgrp, printenv,
4125 which and where (q.v.).
4126
4127 New variables that make useful information easily available to the
4128 shell. See the gid, loginsh, oid, shlvl, tcsh, tty, uid and version
4129 shell variables and the HOST, REMOTEHOST, VENDOR, OSTYPE and MACHTYPE
4130 environment variables.
4131
4132 A new syntax for including useful information in the prompt string (see
4133 prompt), and special prompts for loops and spelling correction (see
4134 prompt2 and prompt3).
4135
4136 Read-only variables. See Variable substitution.
4137
4139 When a suspended command is restarted, the shell prints the directory
4140 it started in if this is different from the current directory. This
4141 can be misleading (i.e., wrong) as the job may have changed directories
4142 internally.
4143
4144 Shell builtin functions are not stoppable/restartable. Command
4145 sequences of the form `a ; b ; c' are also not handled gracefully when
4146 stopping is attempted. If you suspend `b', the shell will then immedi‐
4147 ately execute `c'. This is especially noticeable if this expansion
4148 results from an alias. It suffices to place the sequence of commands
4149 in ()'s to force it to a subshell, i.e., `( a ; b ; c )'.
4150
4151 Control over tty output after processes are started is primitive; per‐
4152 haps this will inspire someone to work on a good virtual terminal
4153 interface. In a virtual terminal interface much more interesting
4154 things could be done with output control.
4155
4156 Alias substitution is most often used to clumsily simulate shell proce‐
4157 dures; shell procedures should be provided rather than aliases.
4158
4159 Control structures should be parsed rather than being recognized as
4160 built-in commands. This would allow control commands to be placed any‐
4161 where, to be combined with `|', and to be used with `&' and `;' meta‐
4162 syntax.
4163
4164 foreach doesn't ignore here documents when looking for its end.
4165
4166 It should be possible to use the `:' modifiers on the output of command
4167 substitutions.
4168
4169 The screen update for lines longer than the screen width is very poor
4170 if the terminal cannot move the cursor up (i.e., terminal type `dumb').
4171
4172 HPATH and NOREBIND don't need to be environment variables.
4173
4174 Glob-patterns which do not use `?', `*' or `[]' or which use `{}' or
4175 `~' are not negated correctly.
4176
4177 The single-command form of if does output redirection even if the
4178 expression is false and the command is not executed.
4179
4180 ls-F includes file identification characters when sorting filenames and
4181 does not handle control characters in filenames well. It cannot be
4182 interrupted.
4183
4184 Command substitution supports multiple commands and conditions, but not
4185 cycles or backward gotos.
4186
4187 Report bugs at http://bugs.gw.com/, preferably with fixes. If you want
4188 to help maintain and test tcsh, send mail to tcsh-request@mx.gw.com
4189 with the text `subscribe tcsh' on a line by itself in the body.
4190
4192 In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementa‐
4193 tion. It was re-christened the DECsystem-10 in 1970 or so when DEC
4194 brought out the second model, the KI10.
4195
4196 TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
4197 think tank) in 1972 as an experiment in demand-paged virtual memory
4198 operating systems. They built a new pager for the DEC PDP-10 and cre‐
4199 ated the OS to go with it. It was extremely successful in academia.
4200
4201 In 1975, DEC brought out a new model of the PDP-10, the KL10; they
4202 intended to have only a version of TENEX, which they had licensed from
4203 BBN, for the new box. They called their version TOPS-20 (their capi‐
4204 talization is trademarked). A lot of TOPS-10 users (`The OPerating
4205 System for PDP-10') objected; thus DEC found themselves supporting two
4206 incompatible systems on the same hardware--but then there were 6 on the
4207 PDP-11!
4208
4209 TENEX, and TOPS-20 to version 3, had command completion via a user-
4210 code-level subroutine library called ULTCMD. With version 3, DEC moved
4211 all that capability and more into the monitor (`kernel' for you Unix
4212 types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
4213 supervisor call mechanism [are my IBM roots also showing?]).
4214
4215 The creator of tcsh was impressed by this feature and several others of
4216 TENEX and TOPS-20, and created a version of csh which mimicked them.
4217
4219 The system limits argument lists to ARG_MAX characters.
4220
4221 The number of arguments to a command which involves filename expansion
4222 is limited to 1/6th the number of characters allowed in an argument
4223 list.
4224
4225 Command substitutions may substitute no more characters than are
4226 allowed in an argument list.
4227
4228 To detect looping, the shell restricts the number of alias substitu‐
4229 tions on a single line to 20.
4230
4232 csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
4233 tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
4234 pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
4235 malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
4236 termio(7), Introduction to the C Shell
4237
4239 This manual documents tcsh 6.18.01 (Astron) 2012-02-14.
4240
4242 William Joy
4243 Original author of csh(1)
4244 J.E. Kulp, IIASA, Laxenburg, Austria
4245 Job control and directory stack features
4246 Ken Greer, HP Labs, 1981
4247 File name completion
4248 Mike Ellis, Fairchild, 1983
4249 Command name recognition/completion
4250 Paul Placeway, Ohio State CIS Dept., 1983-1993
4251 Command line editor, prompt routines, new glob syntax and numerous
4252 fixes and speedups
4253 Karl Kleinpaste, CCI 1983-4
4254 Special aliases, directory stack extraction stuff, login/logout
4255 watch, scheduled events, and the idea of the new prompt format
4256 Rayan Zachariassen, University of Toronto, 1984
4257 ls-F and which builtins and numerous bug fixes, modifications and
4258 speedups
4259 Chris Kingsley, Caltech
4260 Fast storage allocator routines
4261 Chris Grevstad, TRW, 1987
4262 Incorporated 4.3BSD csh into tcsh
4263 Christos S. Zoulas, Cornell U. EE Dept., 1987-94
4264 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c,
4265 SHORT_STRINGS support and a new version of sh.glob.c
4266 James J Dempsey, BBN, and Paul Placeway, OSU, 1988
4267 A/UX port
4268 Daniel Long, NNSC, 1988
4269 wordchars
4270 Patrick Wolfe, Kuck and Associates, Inc., 1988
4271 vi mode cleanup
4272 David C Lawrence, Rensselaer Polytechnic Institute, 1989
4273 autolist and ambiguous completion listing
4274 Alec Wolman, DEC, 1989
4275 Newlines in the prompt
4276 Matt Landau, BBN, 1989
4277 ~/.tcshrc
4278 Ray Moody, Purdue Physics, 1989
4279 Magic space bar history expansion
4280 Mordechai ????, Intel, 1989
4281 printprompt() fixes and additions
4282 Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
4283 Automatic spelling correction and prompt3
4284 Per Hedeland, Ellemtel, Sweden, 1990-
4285 Various bugfixes, improvements and manual updates
4286 Hans J. Albertsson (Sun Sweden)
4287 ampm, settc and telltc
4288 Michael Bloom
4289 Interrupt handling fixes
4290 Michael Fine, Digital Equipment Corp
4291 Extended key support
4292 Eric Schnoebelen, Convex, 1990
4293 Convex support, lots of csh bug fixes, save and restore of directory
4294 stack
4295 Ron Flax, Apple, 1990
4296 A/UX 2.0 (re)port
4297 Dan Oscarsson, LTH Sweden, 1990
4298 NLS support and simulated NLS support for non NLS sites, fixes
4299 Johan Widen, SICS Sweden, 1990
4300 shlvl, Mach support, correct-line, 8-bit printing
4301 Matt Day, Sanyo Icon, 1990
4302 POSIX termio support, SysV limit fixes
4303 Jaap Vermeulen, Sequent, 1990-91
4304 Vi mode fixes, expand-line, window change fixes, Symmetry port
4305 Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
4306 autolist beeping options, modified the history search to search for
4307 the whole string from the beginning of the line to the cursor.
4308 Scott Krotz, Motorola, 1991
4309 Minix port
4310 David Dawes, Sydney U. Australia, Physics Dept., 1991
4311 SVR4 job control fixes
4312 Jose Sousa, Interactive Systems Corp., 1991
4313 Extended vi fixes and vi delete command
4314 Marc Horowitz, MIT, 1991
4315 ANSIfication fixes, new exec hashing code, imake fixes, where
4316 Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995
4317 ETA and Pyramid port, Makefile and lint fixes, ignoreeof=n addition,
4318 and various other portability changes and bug fixes
4319 Jeff Fink, 1992
4320 complete-word-fwd and complete-word-back
4321 Harry C. Pulley, 1992
4322 Coherent port
4323 Andy Phillips, Mullard Space Science Lab U.K., 1992
4324 VMS-POSIX port
4325 Beto Appleton, IBM Corp., 1992
4326 Walking process group fixes, csh bug fixes, POSIX file tests, POSIX
4327 SIGHUP
4328 Scott Bolte, Cray Computer Corp., 1992
4329 CSOS port
4330 Kaveh R. Ghazi, Rutgers University, 1992
4331 Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf sup‐
4332 port.
4333 Mark Linderman, Cornell University, 1992
4334 OS/2 port
4335 Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
4336 Linux port
4337 Tim P. Starrin, NASA Langley Research Center Operations, 1993
4338 Read-only variables
4339 Dave Schweisguth, Yale University, 1993-4
4340 New man page and tcsh.man2html
4341 Larry Schwimmer, Stanford University, 1993
4342 AFS and HESIOD patches
4343 Luke Mewburn, RMIT University, 1994-6
4344 Enhanced directory printing in prompt, added ellipsis and rprompt.
4345 Edward Hutchins, Silicon Graphics Inc., 1996
4346 Added implicit cd.
4347 Martin Kraemer, 1997
4348 Ported to Siemens Nixdorf EBCDIC machine
4349 Amol Deshpande, Microsoft, 1997
4350 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing
4351 library and message catalog code to interface to Windows.
4352 Taga Nayuta, 1998
4353 Color ls additions.
4354
4356 Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
4357 Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
4358 the other people at Ohio State for suggestions and encouragement
4359
4360 All the people on the net, for putting up with, reporting bugs in, and
4361 suggesting new additions to each and every version
4362
4363 Richard M. Alderson III, for writing the `T in tcsh' section
4364
4365
4366
4367Astron 6.18.01 14 February 2012 TCSH(1)