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