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 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 colon 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 colon 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 colon just as with History word modifiers; any modifiers must
1331 appear 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 ‘()’, 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 (‘{}’). Remember that the braces should be sep‐
1742 arated from the words of the command by spaces. Command executions suc‐
1743 ceed, returning true, i.e., ‘1’, if the command exits with status 0, oth‐
1744 erwise 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 & Symbolic link to nowhere.
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 filetype or extension. See the color shell variable and
3014 the LS_COLORS environment variable.
3015
3016 migrate [-site] pid|%jobid ... (+)
3017 migrate -site (+)
3018 The first form migrates the process or job to the site specified
3019 or the default site determined by the system path. (TCF only)
3020
3021 The second form is equivalent to
3022 migrate -site $$
3023 in that it migrates the current process to the specified site.
3024 Migrating the shell itself can cause unexpected behavior, because
3025 the shell does not like to lose its tty. (TCF only)
3026
3027 newgrp [-] [group] (+)
3028 Equivalent to
3029 exec newgrp
3030 as per newgrp(1). Available only if the shell was so compiled;
3031 see the version shell variable.
3032
3033 nice [+number] [command]
3034 Sets the scheduling priority for the shell to number, or, without
3035 number, to 4. With command, runs command at the appropriate pri‐
3036 ority. The greater the number, the less cpu the process gets.
3037 The super-user may specify negative priority by using
3038 nice -number ...
3039
3040 command is always executed in a sub-shell, and the restrictions
3041 placed on commands in simple if statements apply.
3042
3043 nohup [command]
3044 With command, runs command such that it will ignore hangup sig‐
3045 nals. Note that commands may set their own response to hangups,
3046 overriding nohup.
3047
3048 Without an argument, causes the non-interactive shell only to ig‐
3049 nore hangups for the remainder of the script. See also Signal
3050 handling and the hup builtin command.
3051
3052 notify [%job ...]
3053 Causes the shell to notify the user asynchronously when the sta‐
3054 tus of any of the specified jobs (or, without %job, the current
3055 job) changes, instead of waiting until the next prompt as is
3056 usual. job may be a number, a string, ‘’, ‘%’, ‘+’, or ‘-’ as
3057 described under Jobs. See also the notify shell variable.
3058
3059 onintr [-|label]
3060 Controls the action of the shell on interrupts. Without argu‐
3061 ments, restores the default action of the shell on interrupts,
3062 which is to terminate shell scripts or to return to the terminal
3063 command input level.
3064
3065 With ‘-’, causes all interrupts to be ignored.
3066
3067 With label, causes the shell to execute a
3068 goto label
3069 when an interrupt is received or a child process terminates be‐
3070 cause it was interrupted.
3071
3072 onintr is ignored if the shell is running detached and in system
3073 startup files (see FILES), where interrupts are disabled anyway.
3074
3075 popd [-p] [-l] [-n|-v] [+n]
3076 Without arguments, pops the directory stack and returns to the
3077 new top directory.
3078
3079 With a number ‘+n’, discards the nth entry in the stack.
3080
3081 Finally, all forms of popd print the final directory stack, just
3082 like dirs. The pushdsilent shell variable can be set to prevent
3083 this and the -p flag can be given to override pushdsilent. The
3084 -l, -n, and -v flags have the same effect on popd as on dirs.
3085 (+)
3086
3087 printenv [name] (+)
3088 Prints the names and values of all environment variables or, with
3089 name, the value of the environment variable name.
3090
3091 pushd [-p] [-l] [-n|-v] [name|+n]
3092 Without arguments, exchanges the top two elements of the direc‐
3093 tory stack. If pushdtohome is set, pushd without arguments acts
3094 as
3095 pushd ~
3096 like cd. (+)
3097
3098 With name, pushes the current working directory onto the direc‐
3099 tory stack and changes to name. If name is ‘-’ it is interpreted
3100 as the previous working directory (see Filename substitution).
3101 (+) If dunique is set, pushd removes any instances of name from
3102 the stack before pushing it onto the stack. (+)
3103
3104 With a number ‘+n’, rotates the nth element of the directory
3105 stack around to be the top element and changes to it. If
3106 dextract is set, however,
3107 pushd +n
3108 extracts the nth directory, pushes it onto the top of the stack
3109 and changes to it. (+)
3110
3111 Finally, all forms of pushd print the final directory stack, just
3112 like dirs. The pushdsilent shell variable can be set to prevent
3113 this and the -p flag can be given to override pushdsilent. The
3114 -l, -n, and -v flags have the same effect on pushd as on dirs.
3115 (+)
3116
3117 rehash Causes the internal hash table of the contents of the directories
3118 in the path variable to be recomputed. This is needed if the
3119 autorehash shell variable is not set and new commands are added
3120 to directories in path while you are logged in. With autorehash,
3121 a new command will be found automatically, except in the special
3122 case where another command of the same name which is located in a
3123 different directory already exists in the hash table. Also
3124 flushes the cache of home directories built by tilde expansion.
3125
3126 repeat count command
3127 The specified command, which is subject to the same restrictions
3128 as the command in the one line if statement above, is executed
3129 count times. I/O redirections occur exactly once, even if count
3130 is 0.
3131
3132 rootnode //nodename (+)
3133 Changes the rootnode to //nodename, so that ‘/’ will be inter‐
3134 preted as ‘//nodename’. (Domain/OS only)
3135
3136 sched (+)
3137 sched [+]hh:mm command (+)
3138 sched -n (+)
3139 The first form prints the scheduled-event list. The sched shell
3140 variable may be set to define the format in which the scheduled-
3141 event list is printed.
3142
3143 The second form adds command to the scheduled-event list. For
3144 example,
3145
3146 > sched 11:00 echo It\'s eleven o\'clock.
3147
3148 causes the shell to echo
3149 It's eleven o'clock.
3150 at 11 AM.
3151
3152 The time may be in 12-hour AM/PM format
3153
3154 > sched 5pm set prompt='[%h] It\'s after 5; go home: >'
3155
3156 or may be relative to the current time:
3157
3158 > sched +2:15 /usr/lib/uucp/uucico -r1 -sother
3159
3160 A relative time specification may not use AM/PM format.
3161
3162 The third form removes item n from the event list:
3163
3164 > sched
3165 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother
3166 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: >
3167 > sched -2
3168 > sched
3169 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother
3170
3171 A command in the scheduled-event list is executed just before the
3172 first prompt is printed after the time when the command is sched‐
3173 uled. It is possible to miss the exact time when the command is
3174 to be run, but an overdue command will execute at the next
3175 prompt. A command which comes due while the shell is waiting for
3176 user input is executed immediately. However, normal operation of
3177 an already-running command will not be interrupted so that a
3178 scheduled-event list element may be run.
3179
3180 This mechanism is similar to, but not the same as, the at(1) com‐
3181 mand on some Unix systems. Its major disadvantage is that it may
3182 not run a command at exactly the specified time. Its major ad‐
3183 vantage is that because sched runs directly from the shell, it
3184 has access to shell variables and other structures. This pro‐
3185 vides a mechanism for changing one's working environment based on
3186 the time of day.
3187
3188 set
3189 set name ...
3190 set name=word ...
3191 set [-r] [-f|-l] name=(wordlist) ... (+)
3192 set name[index]=word ...
3193 set -r (+)
3194 set -r name ... (+)
3195 set -r name=word ... (+)
3196 The first form of the command prints the value of all shell vari‐
3197 ables. Variables which contain more than a single word print as
3198 a parenthesized word list.
3199
3200 The second form sets name to the null string.
3201
3202 The third form sets name to the single word.
3203
3204 The fourth form sets name to the list of words in wordlist.
3205
3206 In all cases the value is command and filename expanded. If -r
3207 is specified, the value is set read-only. If -f or -l are speci‐
3208 fied, set only unique words keeping their order. -f prefers the
3209 first occurrence of a word, and -l the last.
3210
3211 The fifth form sets the index'th component of name to word; this
3212 component must already exist.
3213
3214 The sixth form lists only the names of all shell variables that
3215 are read-only.
3216
3217 The seventh form makes name read-only, whether or not it has a
3218 value.
3219
3220 The eighth form is the same as the third form, but make name
3221 read-only at the same time.
3222
3223 These arguments can be repeated to set and/or make read-only mul‐
3224 tiple variables in a single set command. Note, however, that
3225 variable expansion happens for all arguments before any setting
3226 occurs. Note also that ‘=’ can be adjacent to both name and word
3227 or separated from both by whitespace, but cannot be adjacent to
3228 only one or the other. See also the unset builtin command.
3229
3230 setenv [name [value]]
3231 Without arguments, prints the names and values of all environment
3232 variables.
3233
3234 With name, sets the environment variable name to value or, with‐
3235 out value, to the null string.
3236
3237 setpath path (+)
3238 Equivalent to setpath(1). (Mach only)
3239
3240 setspath LOCAL|site|cpu ... (+)
3241 Sets the system execution path. (TCF only)
3242
3243 settc cap value (+)
3244 Tells the shell to believe that the terminal capability cap (as
3245 defined in termcap(5)) has the value value. No sanity checking
3246 is done. Concept terminal users may have to
3247 settc xn no
3248 to get proper wrapping at the rightmost column.
3249
3250 setty [-d|-q|-x] [-a] [[+|-]mode] (+)
3251 Controls which tty modes (see Terminal management (+)) the shell
3252 does not allow to change. -d, -q, or -x tells setty to act on
3253 the ‘edit’, ‘quote’, or ‘execute’ set of tty modes respectively;
3254 without -d, -q, or -x, ‘execute’ is used.
3255
3256 Without other arguments, setty lists the modes in the chosen set
3257 which are fixed on (‘+mode’) or off (‘-mode’). The available
3258 modes, and thus the display, vary from system to system. With
3259 -a, lists all tty modes in the chosen set whether or not they are
3260 fixed. With +mode, -mode, or mode, fixes mode on or off or re‐
3261 moves control from mode in the chosen set. For example,
3262 setty +echok echoe
3263 fixes ‘echok’ mode on and allows commands to turn ‘echoe’ mode on
3264 or off, both when the shell is executing commands.
3265
3266 setxvers [string] (+)
3267 Set the experimental version prefix to string, or removes it if
3268 string is omitted. (TCF only)
3269
3270 shift [variable]
3271 Without arguments, discards argv[1] and shifts the members of
3272 argv to the left. It is an error for argv not to be set or to
3273 have less than one word as value.
3274
3275 With variable, performs the same function on variable.
3276
3277 source [-h] name [args ...]
3278 The shell reads and executes commands from name. The commands
3279 are not placed on the history list. If any args are given, they
3280 are placed in argv. (+) source commands may be nested; if they
3281 are nested too deeply the shell may run out of file descriptors.
3282 An error in a source at any level terminates all nested source
3283 commands.
3284
3285 With -h, commands are placed on the history list instead of being
3286 executed, much like
3287 history -L
3288
3289 stop %job|pid ...
3290 Stops the specified jobs or processes which are executing in the
3291 background. job may be a number, a string, ‘’, ‘%’, ‘+’, or ‘-’
3292 as described under Jobs.
3293
3294 There is no default job; entering just
3295 stop
3296 does not stop the current job.
3297
3298 suspend
3299 Causes the shell to stop in its tracks, much as if it had been
3300 sent a stop signal with ^Z. This is most often used to stop
3301 shells started by su(1).
3302
3303 switch (string)
3304 case str1:
3305 ...
3306 breaksw
3307 ...
3308 default:
3309 ...
3310 breaksw
3311 endsw Each case label is successively matched, against the specified
3312 string which is first command and filename expanded. The file
3313 metacharacters ‘*’, ‘?’, and ‘[...]’ may be used in the case la‐
3314 bels, which are variable expanded. If none of the labels match
3315 before a default label is found, then the execution begins after
3316 the default label. Each case label and the default label must
3317 appear at the beginning of a line. The command breaksw causes
3318 execution to continue after the endsw. Otherwise control may
3319 fall through case labels and default labels as in C. If no label
3320 matches and there is no default, execution continues after the
3321 endsw.
3322
3323 telltc (+)
3324 Lists the values of all terminal capabilities (see termcap(5)).
3325
3326 termname [termtype] (+)
3327 Tests if termtype (or the current value of TERM if no termtype is
3328 given) has an entry in the hosts termcap(5) or terminfo(5) data‐
3329 base. Prints the terminal type to stdout and returns 0 if an en‐
3330 try is present otherwise returns 1.
3331
3332 time [command]
3333 Executes command (which must be a simple command, not an alias, a
3334 pipeline, a command list or a parenthesized command list) and
3335 prints a time summary as described under the time variable. If
3336 necessary, an extra shell is created to print the time statistic
3337 when the command completes.
3338
3339 Without command, prints a time summary for the current shell and
3340 its children.
3341
3342 umask [value]
3343 Sets the file creation mask to value, which is given in octal.
3344 Common values for the mask are 002, giving all access to the
3345 group and read and execute access to others, and 022, giving read
3346 and execute access to the group and others.
3347
3348 Without value, prints the current file creation mask.
3349
3350 unalias pattern
3351 Removes all aliases whose names match pattern. Thus
3352 unalias *
3353 removes all aliases. It is not an error for nothing to be
3354 unaliased.
3355
3356 uncomplete pattern (+)
3357 Removes all completions whose names match pattern. Thus
3358 uncomplete *
3359 removes all completions. It is not an error for nothing to be
3360 uncompleted.
3361
3362 unhash Disables use of the internal hash table to speed location of exe‐
3363 cuted programs.
3364
3365 universe universe (+)
3366 Sets the universe to universe. (Masscomp/RTU only)
3367
3368 unlimit [-hf] [resource]
3369 Removes the limitation on resource or, if no resource is speci‐
3370 fied, all resource limitations.
3371
3372 With -h, the corresponding hard limits are removed. Only the su‐
3373 per-user may do this.
3374
3375 Note that unlimit may not exit successful, since most systems do
3376 not allow descriptors to be unlimited.
3377
3378 With -f errors are ignored.
3379
3380 unset pattern
3381 Removes all variables whose names match pattern, unless they are
3382 read-only. Thus
3383 unset *
3384 removes all variables unless they are read-only; this is a bad
3385 idea.
3386
3387 It is not an error for nothing to be unset.
3388
3389 unsetenv pattern
3390 Removes all environment variables whose names match pattern.
3391 Thus
3392 unsetenv *
3393 removes all environment variables; this is a bad idea.
3394
3395 It is not an error for nothing to be unsetenved.
3396
3397 ver [systype [command]] (+)
3398 Without arguments, prints SYSTYPE.
3399
3400 With systype, sets SYSTYPE to systype.
3401
3402 With systype and command, executes command under systype.
3403 systype may be ‘bsd4.3’ or ‘sys5.3’.
3404
3405 (Domain/OS only)
3406
3407 wait The shell waits for all background jobs. If the shell is inter‐
3408 active, an interrupt will disrupt the wait and cause the shell to
3409 print the names and job numbers of all outstanding jobs.
3410
3411 warp universe (+)
3412 Sets the universe to universe. (Convex/OS only)
3413
3414 watchlog (+)
3415 An alternate name for the log builtin command. Available only if
3416 the shell was so compiled; see the version shell variable.
3417
3418 where command (+)
3419 Reports all known instances of command, including aliases,
3420 builtins and executables in path.
3421
3422 which command (+)
3423 Displays the command that will be executed by the shell after
3424 substitutions, path searching, etc. The builtin command is just
3425 like which(1), but it correctly reports tcsh aliases and builtins
3426 and is 10 to 100 times faster. See also the which-command editor
3427 command.
3428
3429 while (expr)
3430 ...
3431 end Executes the commands between the while and the matching end
3432 while expr (an expression, as described under Expressions) evalu‐
3433 ates non-zero. while and end must appear alone on their input
3434 lines. break and continue may be used to terminate or continue
3435 the loop prematurely. If the input is a terminal, the user is
3436 prompted the first time through the loop as with foreach.
3437
3438 Special aliases (+)
3439 If set, each of these aliases executes automatically at the indicated
3440 time. They are all initially undefined.
3441
3442 Supported special aliases are:
3443
3444 beepcmd
3445 Runs when the shell wants to ring the terminal bell.
3446
3447 cwdcmd Runs after every change of working directory. For example, if
3448 the user is working on an X window system using xterm(1) and a
3449 re-parenting window manager that supports title bars such as
3450 twm(1) and does
3451
3452 > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"'
3453
3454 then the shell will change the title of the running xterm(1) to
3455 be the name of the host, a colon, and the full current working
3456 directory. A fancier way to do that is
3457
3458 > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
3459
3460 This will put the hostname and working directory on the title bar
3461 but only the hostname in the icon manager menu.
3462
3463 Note that putting a cd, pushd, or popd in cwdcmd may cause an in‐
3464 finite loop. It is the author's opinion that anyone doing so
3465 will get what they deserve.
3466
3467 jobcmd Runs before each command gets executed, or when the command
3468 changes state. This is similar to postcmd, but it does not print
3469 builtins.
3470
3471 > alias jobcmd 'echo -n "^[]2\;\!#:q^G"'
3472
3473 then executing
3474 vi foo.c
3475 will put the command string in the xterm title bar.
3476
3477 helpcommand
3478 Invoked by the run-help editor command. The command name for
3479 which help is sought is passed as sole argument. For example, if
3480 one does
3481
3482 > alias helpcommand '\!:1 --help'
3483
3484 then the help display of the command itself will be invoked, us‐
3485 ing the GNU help calling convention.
3486
3487 Currently there is no easy way to account for various calling
3488 conventions (e.g., the customary Unix ‘-h’), except by using a
3489 table of many commands.
3490
3491 periodic
3492 Runs every tperiod minutes. This provides a convenient means for
3493 checking on common but infrequent changes such as new mail. For
3494 example, if one does
3495
3496 > set tperiod = 30
3497 > alias periodic checknews
3498
3499 then the checknews(1) program runs every 30 minutes.
3500
3501 If periodic is set but tperiod is unset or set to 0, periodic be‐
3502 haves like precmd.
3503
3504 precmd Runs just before each prompt is printed. For example, if one
3505 does
3506
3507 > alias precmd date
3508
3509 then date(1) runs just before the shell prompts for each command.
3510
3511 There are no limits on what precmd can be set to do, but discre‐
3512 tion should be used.
3513
3514 postcmd
3515 Runs before each command gets executed.
3516
3517 > alias postcmd 'echo -n "^[]2\;\!#:q^G"'
3518
3519 then executing
3520 vi foo.c
3521 will put the command string in the xterm title bar.
3522
3523 shell Specifies the interpreter for executable scripts which do not
3524 themselves specify an interpreter. The first word should be a
3525 full path name to the desired interpreter (e.g., ‘/bin/csh’ or
3526 ‘/usr/local/bin/tcsh’).
3527
3528 Special shell variables
3529 The variables described in this section have special meaning to the
3530 shell.
3531
3532 The shell sets addsuffix, argv, autologout, csubstnonl, command,
3533 echo_style, edit, gid, group, home, loginsh, oid, path, prompt, prompt2,
3534 prompt3, shell, shlvl, tcsh, term, tty, uid, user, and version at
3535 startup; they do not change thereafter unless changed by the user. The
3536 shell updates cwd, dirstack, owd, and status when necessary, and sets
3537 logout on logout.
3538
3539 The shell synchronizes group, home, path, shlvl, term, and user with the
3540 environment variables of the same names: whenever the environment vari‐
3541 able changes the shell changes the corresponding shell variable to match
3542 (unless the shell variable is read-only) and vice versa. Note that al‐
3543 though cwd and PWD have identical meanings, they are not synchronized in
3544 this manner, and that the shell automatically converts between the dif‐
3545 ferent formats of path and PATH.
3546
3547 Supported special shell variables are:
3548
3549 addsuffix (+)
3550 If set, filename completion adds ‘/’ to the end of directories
3551 and a space to the end of normal files when they are matched ex‐
3552 actly. Set by default.
3553
3554 afsuser (+)
3555 If set, autologout's autolock feature uses its value instead of
3556 the local username for kerberos authentication.
3557
3558 ampm (+)
3559 If set, all times are shown in 12-hour AM/PM format.
3560
3561 anyerror (+)
3562 This variable selects what is propagated to the value of the
3563 status variable. For more information see the description of the
3564 status variable below.
3565
3566 argv The arguments to the shell. Positional parameters are taken from
3567 argv, i.e., ‘$1’ is replaced by ‘$argv[1]’, etc. Set by default,
3568 but usually empty in interactive shells.
3569
3570 autocorrect (+)
3571 If set, the spell-word editor command is invoked automatically
3572 before each completion attempt.
3573
3574 autoexpand (+)
3575 If set, the expand-history editor command is invoked automati‐
3576 cally before each completion attempt.
3577
3578 If this is set to ‘onlyhistory’, then only history will be ex‐
3579 panded and a second completion will expand filenames.
3580
3581 autolist (+)
3582 If set, possibilities are listed after an ambiguous completion.
3583
3584 If set to ‘ambiguous’, possibilities are listed only when no new
3585 characters are added by completion.
3586
3587 autologout (+)
3588 The first word is the number of minutes of inactivity before au‐
3589 tomatic logout. The optional second word is the number of min‐
3590 utes of inactivity before automatic locking. When the shell au‐
3591 tomatically logs out, it prints
3592 auto-logout
3593 sets the variable logout to ‘automatic’ and exits. When the
3594 shell automatically locks, the user is required to enter their
3595 password to continue working. Five incorrect attempts result in
3596 automatic logout.
3597
3598 Set to ‘60’ (automatic logout after 60 minutes, and no locking)
3599 by default in login and superuser shells, but not if the shell
3600 thinks it is running under a window system (i.e., the DISPLAY en‐
3601 vironment variable is set), the tty is a pseudo-tty (pty) or the
3602 shell was not so compiled (see the version shell variable).
3603
3604 Unset autologout or set it to ‘0’ to disable automatic logout.
3605 See also the afsuser and logout shell variables.
3606
3607 autorehash (+)
3608 If set, the internal hash table of the contents of the directo‐
3609 ries in the path variable will be recomputed if a command is not
3610 found in the hash table. In addition, the list of available com‐
3611 mands will be rebuilt for each command completion or spelling
3612 correction attempt if set to ‘complete’ or ‘correct’ respec‐
3613 tively; if set to ‘always’, this will be done for both cases.
3614
3615 backslash_quote (+)
3616 If set, backslashes (`\') always quote ‘\’, ‘'’, and ‘"’. This
3617 may make complex quoting tasks easier, but it can cause syntax
3618 errors in csh(1) scripts.
3619
3620 catalog
3621 The file name of the message catalog. If set, tcsh uses
3622 tcsh.${catalog} as a message catalog instead of default tcsh.
3623
3624 cdpath A list of directories in which cd should search for subdirecto‐
3625 ries if they aren't found in the current directory.
3626
3627 cdtohome (+)
3628 If not set, cd requires a directory name, and will not go to the
3629 home directory if it's omitted. This is set by default.
3630
3631 color If set, it enables color display for the builtin ls-F and it
3632 passes --color=auto to ls(1). Alternatively, it can be set to
3633 only ‘ls-F’ or only ‘ls’ to enable color to only one command.
3634 Setting it to nothing is equivalent to setting it to ‘(ls-F ls)’.
3635
3636 colorcat
3637 If set, it enables color escape sequence for NLS message files,
3638 and display colorful NLS messages.
3639
3640 command (+)
3641 If set, the command which was passed to the shell with the -c
3642 flag.
3643
3644 compat_expr (+)
3645 If set, the shell will evaluate expressions right to left, like
3646 the original csh(1).
3647
3648 complete (+)
3649 If set to ‘igncase’, the completion becomes case insensitive.
3650
3651 If set to ‘enhance’, completion ignores case and considers hy‐
3652 phens and underscores to be equivalent; it will also treat peri‐
3653 ods, hyphens and underscores (‘.’, ‘-’, and ‘_’) as word separa‐
3654 tors.
3655
3656 If set to ‘Enhance’, completion matches uppercase and underscore
3657 characters explicitly and matches lowercase and hyphens in a
3658 case-insensitive manner; it will treat periods, hyphens and un‐
3659 derscores as word separators.
3660
3661 continue (+)
3662 If set to a list of commands, the shell will continue the listed
3663 commands, instead of starting a new one.
3664
3665 continue_args (+)
3666 Same as continue, but the shell will execute:
3667
3668 echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
3669
3670 correct (+)
3671 If set to ‘cmd’, commands are automatically spelling-corrected.
3672
3673 If set to ‘complete’, commands are automatically completed.
3674
3675 If set to ‘all’, the entire command line is corrected.
3676
3677 csubstnonl (+)
3678 If set, newlines and carriage returns in command substitution are
3679 replaced by spaces. Set by default.
3680
3681 cwd The full pathname of the current directory. See also the
3682 dirstack and owd shell variables.
3683
3684 dextract (+)
3685 If set,
3686 pushd +n
3687 extracts the nth directory from the directory stack rather than
3688 rotating it to the top.
3689
3690 dirsfile (+)
3691 The default location in which
3692 dirs -S
3693 and
3694 dirs -L
3695 look for a history file. If unset, ~/.cshdirs is used. Because
3696 only ~/.tcshrc is normally sourced before ~/.cshdirs, dirsfile
3697 should be set in ~/.tcshrc rather than ~/.login.
3698
3699 dirstack (+)
3700 An array of all the directories on the directory stack.
3701 ‘$dirstack[1]’ is the current working directory, ‘$dirstack[2]’
3702 the first directory on the stack, etc. Note that the current
3703 working directory is ‘$dirstack[1]’ but ‘=0’ in directory stack
3704 substitutions, etc. One can change the stack arbitrarily by set‐
3705 ting dirstack, but the first element (the current working direc‐
3706 tory) is always correct. See also the cwd and owd shell vari‐
3707 ables.
3708
3709 dspmbyte (+)
3710 Has an effect only if ‘dspm’ is listed as part of the version
3711 shell variable.
3712
3713 If set to ‘euc’, it enables display and editing EUC-kanji(Japa‐
3714 nese) code.
3715
3716 If set to ‘sjis’, it enables display and editing Shift-JIS(Japa‐
3717 nese) code.
3718
3719 If set to ‘big5’, it enables display and editing Big5(Chinese)
3720 code.
3721
3722 If set to ‘utf8’, it enables display and editing Utf8(Unicode)
3723 code.
3724
3725 If set to exactly 256 characters in the following format, it en‐
3726 ables display and editing of original multi-byte code format:
3727
3728 > set dspmbyte = NNN...[250 characters]...NNN
3729
3730 Each character N in the 256 character value corresponds (from
3731 left to right) to the ASCII codes 0x00, 0x01, 0x02, ..., 0xfd,
3732 0xfe, 0xff at the same index. Each character is set to number 0,
3733 1, 2 or 3, with the meaning:
3734
3735 Number Multi-byte purpose
3736
3737 0 Not used for multi-byte characters.
3738 1 Used for the first byte of a multi-byte character.
3739 2 Used for the second byte of a multi-byte character.
3740 3 Used for both the first byte and second byte of a
3741 multi-byte character.
3742
3743 For example, if set to 256 characters starting with ‘001322’, the
3744 value is interpreted as:
3745
3746 Character ASCII Multi-byte character use
3747
3748 0 0x00 Not used.
3749 0 0x01 Not used.
3750 1 0x02 First byte.
3751 3 0x03 First byte and second byte.
3752 2 0x04 Second byte.
3753 2 0x05 Second byte.
3754
3755 The GNU fileutils version of ls cannot display multi-byte file‐
3756 names without the -N (--literal) option. If you are using this
3757 version, set the second word of dspmbyte to ‘ls’. If not, for
3758 example,
3759 ls-F -l
3760 cannot display multi-byte filenames.
3761
3762 Note that this variable can only be used if KANJI and DSPMBYTE
3763 has been defined at compile time.
3764
3765 dunique (+)
3766 If set, pushd removes any instances of name from the stack before
3767 pushing it onto the stack.
3768
3769 echo If set, each command with its arguments is echoed just before it
3770 is executed. For non-builtin commands all expansions occur be‐
3771 fore echoing. Builtin commands are echoed before command and
3772 filename substitution, because these substitutions are then done
3773 selectively. Set by the -x command line option.
3774
3775 echo_style (+)
3776 The style of the echo builtin. May be set to:
3777
3778 Value echo style
3779
3780 bsd Don't echo a newline if the first argument is -n;
3781 the default for csh(1).
3782
3783 sysv Recognize backslashed escape sequences in echo
3784 strings.
3785
3786 both Recognize both the -n flag and backslashed escape
3787 sequences; the default for tcsh.
3788
3789 none Recognize neither.
3790
3791 Set by default to the local system default. The BSD and System V
3792 options are described in the echo(1) man pages on the appropriate
3793 systems.
3794
3795 edit (+)
3796 If set, the command-line editor is used. Set by default in in‐
3797 teractive shells.
3798
3799 editors (+)
3800 A list of command names for the run-fg-editor editor command to
3801 match. If not set, the EDITOR (‘ed’ if unset) and VISUAL (‘vi’
3802 if unset) environment variables will be used instead.
3803
3804 ellipsis (+)
3805 If set, the ‘%c’, ‘%.’, and ‘%C’ prompt sequences (see the prompt
3806 shell variable) indicate skipped directories with an ellipsis
3807 (‘...’) instead of ‘/<skipped>’.
3808
3809 euid (+)
3810 The user's effective user ID.
3811
3812 euser (+)
3813 The first matching passwd entry name corresponding to the effec‐
3814 tive user ID.
3815
3816 fignore (+)
3817 Lists file name suffixes to be ignored by completion.
3818
3819 filec In tcsh, completion is always used and this variable is ignored
3820 by default.
3821
3822 If edit is unset, then the traditional csh(1) completion is used.
3823
3824 If set in csh(1), filename completion is used.
3825
3826 gid (+)
3827 The user's real group ID.
3828
3829 globdot (+)
3830 If set, wild-card glob patterns will match files and directories
3831 beginning with ‘.’ except for ‘.’ and ‘..’.
3832
3833 globstar (+)
3834 If set, the ‘**’ and ‘***’ file glob patterns will match any
3835 string of characters including ‘/’ traversing any existing sub-
3836 directories. For example,
3837 ls **.c
3838 will list all the .c files in the current directory tree.
3839
3840 If used by itself, it will match zero or more sub-directories.
3841 For example,
3842 ls /usr/include/**/time.h
3843 will list any file named ‘time.h’ in the /usr/include directory
3844 tree; whereas
3845 ls /usr/include/**time.h
3846 will match any file in the /usr/include directory tree ending in
3847 ‘time.h’.
3848
3849 To prevent problems with recursion, the ‘**’ glob-pattern will
3850 not descend into a symbolic link containing a directory. To
3851 override this, use ‘***’.
3852
3853 group (+)
3854 The user's group name.
3855
3856 highlight
3857 If set, the incremental search match (in i-search-back and
3858 i-search-fwd) and the region between the mark and the cursor are
3859 highlighted in reverse video.
3860
3861 Highlighting requires more frequent terminal writes, which intro‐
3862 duces extra overhead. If you care about terminal performance,
3863 you may want to leave this unset.
3864
3865 histchars
3866 A string value determining the characters used in History
3867 substitution.
3868
3869 The first character of its value is used as the history substitu‐
3870 tion character, replacing the default character ‘!’.
3871
3872 The second character of its value replaces the character ‘^’ in
3873 quick substitutions.
3874
3875 histdup (+)
3876 Controls handling of duplicate entries in the history list.
3877
3878 If set to ‘all’ only unique history events are entered in the
3879 history list.
3880
3881 If set to ‘prev’ and the last history event is the same as the
3882 current command, then the current command is not entered in the
3883 history.
3884
3885 If set to ‘erase’ and the same event is found in the history
3886 list, that old event gets erased and the current one gets in‐
3887 serted.
3888
3889 Note that the ‘prev’ and ‘all’ options renumber history events so
3890 there are no gaps.
3891
3892 histfile (+)
3893 The default location in which
3894 history -S
3895 and
3896 history -L
3897 look for a history file.
3898
3899 If unset, ~/.history is used.
3900
3901 histfile is useful when sharing the same home directory between
3902 different machines, or when saving separate histories on differ‐
3903 ent terminals. Because only ~/.tcshrc is normally sourced before
3904 ~/.history, histfile should be set in ~/.tcshrc rather than
3905 ~/.login.
3906
3907 histlit (+)
3908 If set, builtin and editor commands and the savehist mechanism
3909 use the literal (unexpanded) form of lines in the history list.
3910 See also the toggle-literal-history editor command.
3911
3912 history
3913 The first word indicates the number of history events to save.
3914
3915 The optional second word (+) indicates the format in which his‐
3916 tory is printed; if not given, ‘%h\t%T\t%R\n’ is used. The for‐
3917 mat sequences are described below under prompt; note the variable
3918 meaning of ‘%R’.
3919
3920 Set to ‘100’ by default.
3921
3922 home Initialized to the home directory of the invoker. The filename
3923 expansion of ‘~’ refers to this variable.
3924
3925 ignoreeof
3926 If set to the empty string or ‘0’ and the input device is a ter‐
3927 minal, the end-of-file command (usually generated by the user by
3928 typing ^D on an empty line) causes the shell to print
3929 Use "exit" to leave tcsh.
3930 instead of exiting. This prevents the shell from accidentally
3931 being killed. Historically this setting exited after 26 succes‐
3932 sive EOF's to avoid infinite loops.
3933
3934 If set to a number ‘n’, the shell ignores n - 1 consecutive
3935 end-of-files and exits on the nth (+).
3936
3937 If unset, ‘1’ is used, i.e., the shell exits on a single ^D.
3938
3939 implicitcd (+)
3940 If set, the shell treats a directory name typed as a command as
3941 though it were a request to change to that directory.
3942
3943 If set to verbose, the change of directory is echoed to the stan‐
3944 dard output.
3945
3946 This behavior is inhibited in non-interactive shell scripts, or
3947 for command strings with more than one word. Changing directory
3948 takes precedence over executing a like-named command, but it is
3949 done after alias substitutions. Tilde and variable expansions
3950 work as expected.
3951
3952 inputmode (+)
3953 If set to ‘insert’ or ‘overwrite’, puts the editor into that in‐
3954 put mode at the beginning of each line.
3955
3956 killdup (+)
3957 Controls handling of duplicate entries in the kill ring.
3958
3959 If set to ‘all’ only unique strings are entered in the kill ring.
3960
3961 If set to ‘prev’ and the last killed string is the same as the
3962 current killed string, then the current string is not entered in
3963 the ring.
3964
3965 If set to ‘erase’ and the same string is found in the kill ring,
3966 the old string is erased and the current one is inserted.
3967
3968 killring (+)
3969 Indicates the number of killed strings to keep in memory.
3970
3971 Set to ‘30’ by default.
3972
3973 If unset or set to less than ‘2’, the shell will only keep the
3974 most recently killed string.
3975
3976 Strings are put in the killring by the editor commands that
3977 delete (kill) strings of text, e.g. backward-delete-word,
3978 kill-line, etc, as well as the copy-region-as-kill command. The
3979 yank editor command will yank the most recently killed string
3980 into the command-line, while yank-pop (see Editor commands (+))
3981 can be used to yank earlier killed strings.
3982
3983 listflags (+)
3984 If set to ‘x’, ‘a’, or ‘A’, or any combination thereof (e.g.,
3985 ‘xA’), they are used as flags to ls-F, making it act like
3986 ls -xF
3987 ls -Fa
3988 ls -FA
3989
3990 or a combination, for example
3991 ls -FxA
3992
3993 If the first word contains ‘a’, shows all files (even if they
3994 start with a ‘.’).
3995
3996 If the first word contains ‘A’, shows all files but ‘.’ and ‘..’.
3997
3998 If the first word contains ‘x’, sorts across instead of down.
3999
4000 If the second word of listflags is set, it is used as the path to
4001 ls(1).
4002
4003 listjobs (+)
4004 If set, all jobs are listed when a job is suspended.
4005
4006 If set to ‘long’, the listing is in long format.
4007
4008 listlinks (+)
4009 If set, the ls-F builtin command shows the type of file to which
4010 each symbolic link points.
4011
4012 listmax (+)
4013 The maximum number of items which the list-choices editor command
4014 will list without asking first.
4015
4016 listmaxrows (+)
4017 The maximum number of rows of items which the list-choices editor
4018 command will list without asking first.
4019
4020 loginsh (+)
4021 Set by the shell if it is a login shell. Setting or unsetting it
4022 within a shell has no effect. See also shlvl.
4023
4024 logout (+)
4025 Set by the shell to ‘normal’ before a normal logout, ‘automatic’
4026 before an automatic logout, and ‘hangup’ if the shell was killed
4027 by a hangup signal (see Signal handling). See also the
4028 autologout shell variable.
4029
4030 mail A list of files and directories to check for incoming mail, op‐
4031 tionally preceded by a numeric word. Before each prompt, if 10
4032 minutes have passed since the last check, the shell checks each
4033 file and displays
4034 You have new mail.
4035 (or, if mail contains multiple files,
4036 You have new mail in name.)
4037 if the filesize is greater than zero in size and has a modifica‐
4038 tion time greater than its access time.
4039
4040 If you are in a login shell, then no mail file is reported unless
4041 it has been modified after the time the shell has started up, to
4042 prevent redundant notifications. Most login programs will tell
4043 you whether or not you have mail when you log in.
4044
4045 If a file specified in mail is a directory, the shell will count
4046 each file within that directory as a separate message, and will
4047 report
4048 You have n mails.
4049 or
4050 You have n mails in name.
4051 as appropriate. This functionality is provided primarily for
4052 those systems which store mail in this manner, such as the Andrew
4053 Mail System.
4054
4055 If the first word of mail is numeric it is taken as a different
4056 mail checking interval, in seconds.
4057
4058 Under very rare circumstances, the shell may report
4059 You have mail.
4060 instead of
4061 You have new mail.
4062
4063 matchbeep (+)
4064 If set to ‘never’, completion never beeps.
4065
4066 If set to ‘nomatch’, it beeps only when there is no match.
4067
4068 If set to ‘ambiguous’, it beeps when there are multiple matches.
4069
4070 If set to ‘notunique’, it beeps when there is one exact and other
4071 longer matches.
4072
4073 If unset, ‘ambiguous’ is used.
4074
4075 nobeep (+)
4076 If set, beeping is completely disabled. See also visiblebell.
4077
4078 noclobber
4079 If set, restrictions are placed on output redirection to insure
4080 that files are not accidentally destroyed and that ‘>>’ redirec‐
4081 tions refer to existing files, as described in the Input/output
4082 section.
4083
4084 If contains ‘ask’, an interacive confirmation is presented,
4085 rather than an error.
4086
4087 If contains ‘notempty’, ‘>’ is allowed on empty files.
4088
4089 noding If set, disable the printing of
4090 DING!
4091 in the prompt time specifiers at the change of hour.
4092
4093 noglob If set, Filename substitution and Directory stack substitution
4094 (+) are inhibited. This is most useful in shell scripts which do
4095 not deal with filenames, or after a list of filenames has been
4096 obtained and further expansions are not desirable.
4097
4098 nokanji (+)
4099 If set and the shell supports Kanji (see the version shell vari‐
4100 able), it is disabled so that the meta key can be used.
4101
4102 nonomatch
4103 If set, a Filename substitution or Directory stack substitution
4104 (+) which does not match any existing files is left untouched
4105 rather than causing an error. It is still an error for the sub‐
4106 stitution to be malformed. For example,
4107 echo [
4108 still gives an error.
4109
4110 nostat (+)
4111 A list of directories (or glob-patterns which match directories;
4112 see Filename substitution) that should not be stat(2)ed during a
4113 completion operation. This is usually used to exclude directo‐
4114 ries which take too much time to stat(2), for example /afs.
4115
4116 notify If set, the shell announces job completions asynchronously. The
4117 default is to present job completions just before printing a
4118 prompt.
4119
4120 oid (+)
4121 The user's real organization ID. (Domain/OS only)
4122
4123 owd (+)
4124 The old working directory, equivalent to the ‘-’ used by cd and
4125 pushd. See also the cwd and dirstack shell variables.
4126
4127 padhour
4128 If set, enable the printing of padding '0' for hours, in 24 and
4129 12 hour formats. E.g., ‘07:45:42’ versus ‘7:45:42’.
4130
4131 parseoctal
4132 To retain compatibily with older versions numeric variables
4133 starting with 0 are not interpreted as octal. Setting this vari‐
4134 able enables proper octal parsing.
4135
4136 path A list of directories in which to look for executable commands.
4137
4138 A null word specifies the current directory.
4139
4140 If there is no path variable then only full path names will exe‐
4141 cute.
4142
4143 path is set by the shell at startup from the PATH environment
4144 variable or, if PATH does not exist, to a system-dependent de‐
4145 fault, such as
4146 (/usr/local/bin /usr/bsd /bin /usr/bin .)
4147
4148 The shell may put ‘.’ first or last in path or omit it entirely
4149 depending on how it was compiled; see the version shell variable.
4150
4151 A shell which is given neither the -c nor the -t option hashes
4152 the contents of the directories in path after reading ~/.tcshrc
4153 and each time path is reset.
4154
4155 If one adds a new command to a directory in path while the shell
4156 is active, one may need to do a rehash for the shell to find it.
4157
4158 printexitvalue (+)
4159 If set and an interactive program exits with a non-zero status,
4160 the shell prints
4161 Exit status
4162
4163 prompt The string which is printed before reading each command from the
4164 terminal.
4165
4166 prompt may include any of the following formatting sequences (+),
4167 which are replaced by the given information:
4168
4169 Format Prompt information
4170
4171 %/ The current working directory.
4172
4173 %~ The current working directory, but with one's home
4174 directory represented by ‘~’ and other users' home
4175 directories represented by ‘~user’ as per Filename
4176 substitution. ‘~user’ substitution happens only if
4177 the shell has already used ‘~user’ in a pathname in
4178 the current session.
4179
4180 %c[[0]n], %.[[0]n]
4181 The trailing component of the current working di‐
4182 rectory, or n trailing components if a digit n is
4183 given. If n begins with ‘0’, the number of skipped
4184 components precede the trailing component(s) in the
4185 format ‘/<skipped>trailing’. If the ellipsis shell
4186 variable is set, skipped components are represented
4187 by an ellipsis so the whole becomes ‘...trailing’.
4188 ‘~’ substitution is done as in ‘%~’ above, but the
4189 ‘~’ component is ignored when counting trailing
4190 components.
4191
4192 %C Like ‘%c’, but without ‘~’ substitution.
4193
4194 %h, %!, !
4195 The current history event number.
4196
4197 %M The full hostname.
4198
4199 %m The hostname up to the first ‘.’.
4200
4201 %S (%s)
4202 Start (stop) standout mode.
4203
4204 %B (%b)
4205 Start (stop) boldfacing mode.
4206
4207 %U (%u)
4208 Start (stop) underline mode.
4209
4210 %t, %@ The time of day in 12-hour AM/PM format.
4211
4212 %T Like ‘%t’, but in 24-hour format (but see the ampm
4213 shell variable).
4214
4215 %p The ‘precise’ time of day in 12-hour AM/PM format,
4216 with seconds.
4217
4218 %P Like ‘%p’, but in 24-hour format (but see the ampm
4219 shell variable).
4220
4221 \c c is parsed as in bindkey.
4222
4223 ^c c is parsed as in bindkey.
4224
4225 %% A single ‘%’.
4226
4227 %n The user name.
4228
4229 %N The effective user name.
4230
4231 %j The number of jobs.
4232
4233 %d The weekday in ‘Day’ format.
4234
4235 %D The day in ‘dd’ format.
4236
4237 %w The month in ‘Mon’ format.
4238
4239 %W The month in ‘mm’ format.
4240
4241 %y The year in ‘yy’ format.
4242
4243 %Y The year in ‘yyyy’ format.
4244
4245 %l The shell's tty.
4246
4247 %L Clears from the end of the prompt to end of the
4248 display or the end of the line.
4249
4250 %$ Expands the shell or environment variable name im‐
4251 mediately after the ‘$’.
4252
4253 %# ‘>’ (or the first character of the promptchars
4254 shell variable) for normal users, ‘#’ (or the sec‐
4255 ond character of promptchars) for the superuser.
4256
4257 %{string%}
4258 Includes string as a literal escape sequence. It
4259 should be used only to change terminal attributes
4260 and should not move the cursor location. This can‐
4261 not be the last sequence in prompt.
4262
4263 %? The return code of the command executed just before
4264 the prompt.
4265
4266 %R In prompt2, the status of the parser. In prompt3,
4267 the corrected string. In history, the history
4268 string.
4269
4270 ‘%B’, ‘%S’, ‘%U’, and ‘%{string%}’ are available in only eight-
4271 bit-clean shells; see the version shell variable.
4272
4273 The bold, standout and underline sequences are often used to dis‐
4274 tinguish a superuser shell. For example,
4275
4276 > set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
4277 tut [37] [2:54pm] [/usr/accts/sys] you rang? _
4278
4279 If ‘%t’, ‘%@’, ‘%T’, ‘%p’, or ‘%P’ is used, and noding is not
4280 set, then print
4281 DING!
4282 on the change of hour (i.e, ‘:00’ minutes) instead of the actual
4283 time.
4284
4285 Set by default to ‘%# ’ in interactive shells.
4286
4287 prompt2 (+)
4288 The string with which to prompt in while and foreach loops and
4289 after lines ending in ‘\’. The same format sequences may be used
4290 as in prompt; note the variable meaning of ‘%R’.
4291
4292 Set by default to ‘%R? ’ in interactive shells.
4293
4294 prompt3 (+)
4295 The string with which to prompt when confirming automatic spell‐
4296 ing correction. The same format sequences may be used as in
4297 prompt; note the variable meaning of ‘%R’.
4298
4299 Set by default to ‘CORRECT>%R (y|n|e|a)? ’ in interactive shells.
4300
4301 promptchars (+)
4302 If set (to a two-character string), the ‘%#’ formatting sequence
4303 in the prompt shell variable is replaced with the first character
4304 for normal users and the second character for the superuser.
4305
4306 pushdtohome (+)
4307 If set, pushd without arguments does
4308 pushd ~
4309 like cd.
4310
4311 pushdsilent (+)
4312 If set, pushd and popd do not print the directory stack.
4313
4314 recexact (+)
4315 If set, completion completes on an exact match even if a longer
4316 match is possible.
4317
4318 recognize_only_executables (+)
4319 If set, command listing displays only files in the path that are
4320 executable. Slow.
4321
4322 rmstar (+)
4323 If set, the user is prompted before
4324 rm *
4325 is executed.
4326
4327 rprompt (+)
4328 The string to print on the right-hand side of the screen (after
4329 the command input) when the prompt is being displayed on the
4330 left. It recognizes the same formatting characters as prompt.
4331 It will automatically disappear and reappear as necessary, to en‐
4332 sure that command input isn't obscured, and will appear only if
4333 the prompt, command input, and itself will fit together on the
4334 first line.
4335
4336 If edit isn't set, then rprompt will be printed after the prompt
4337 and before the command input.
4338
4339 savedirs (+)
4340 If set, the shell does
4341 dirs -S
4342 before exiting.
4343
4344 If the first word is set to a number, at most that many directory
4345 stack entries are saved.
4346
4347 savehist
4348 If set, the shell does
4349 history -S
4350 before exiting.
4351
4352 If the first word is set to a number, at most that many lines are
4353 saved. (The number should be less than or equal to the number
4354 history entries; if it is set to greater than the number of
4355 history settings, only history entries will be saved.)
4356
4357 If the second word is set to ‘merge’, the history list is merged
4358 with the existing history file instead of replacing it (if there
4359 is one) and sorted by time stamp and the most recent events are
4360 retained.
4361
4362 If the second word is set to ‘merge’ and the third word is set to
4363 ‘lock’, the history file update will be serialized with other
4364 shell sessions that would possibly like to merge history at ex‐
4365 actly the same time. (+)
4366
4367 sched (+)
4368 The format in which the sched builtin command prints scheduled
4369 events; if not given, ‘%h\t%T\t%R\n’ is used. The format se‐
4370 quences are described above under prompt; note the variable mean‐
4371 ing of ‘%R’.
4372
4373 shell The file in which the shell resides. This is used in forking
4374 shells to interpret files which have execute bits set, but which
4375 are not executable by the system. (See the description of
4376 Builtin and non-builtin command execution.) Initialized to the
4377 (system-dependent) home of the shell.
4378
4379 shlvl (+)
4380 The number of nested shells. Reset to 1 in login shells. See
4381 also loginsh.
4382
4383 status The exit status from the last command or backquote expansion, or
4384 any command in a pipeline is propagated to status. (This is also
4385 the default csh(1) behavior.) This default does not match what
4386 POSIX mandates (to return the status of the last command only).
4387 To match the POSIX behavior, you need to unset anyerror.
4388
4389 If the anyerror variable is unset, the exit status of a pipeline
4390 is determined only from the last command in the pipeline, and the
4391 exit status of a backquote expansion is not propagated to status.
4392
4393 If a command terminated abnormally, then 0200 is added to the
4394 status. Builtin commands which fail return exit status ‘1’, all
4395 other builtin commands return status ‘0’.
4396
4397 symlinks (+)
4398 Can be set to several different values to control symbolic link
4399 (‘symlink’) resolution:
4400
4401 If set to ‘chase’, whenever the current directory changes to a
4402 directory containing a symbolic link, it is expanded to the real
4403 name of the directory to which the link points. This does not
4404 work for the user's home directory; this is a bug.
4405
4406 If set to ‘ignore’, the shell tries to construct a current direc‐
4407 tory relative to the current directory before the link was
4408 crossed. This means that
4409 cd
4410 through a symbolic link and then
4411 cd ..
4412 returns one to the original directory. This affects only builtin
4413 commands and filename completion.
4414
4415 If set to ‘expand’, the shell tries to fix symbolic links by ac‐
4416 tually expanding arguments which look like path names. This af‐
4417 fects any command, not just builtins. Unfortunately, this does
4418 not work for hard-to-recognize filenames, such as those embedded
4419 in command options. Expansion may be prevented by quoting.
4420 While this setting is usually the most convenient, it is some‐
4421 times misleading and sometimes confusing when it fails to recog‐
4422 nize an argument which should be expanded. A compromise is to
4423 use ‘ignore’ and use the editor command normalize-path (bound by
4424 default to ^X-n) when necessary.
4425
4426 Some examples are in order. First, let's set up some play direc‐
4427 tories:
4428
4429 > cd /tmp
4430 > mkdir from from/src to
4431 > ln -s from/src to/dst
4432
4433 Here's the behavior with symlinks unset,
4434
4435 > cd /tmp/to/dst; echo $cwd
4436 /tmp/to/dst
4437 > cd ..; echo $cwd
4438 /tmp/from
4439
4440 Here's the behavior with symlinks set to ‘chase’,
4441
4442 > cd /tmp/to/dst; echo $cwd
4443 /tmp/from/src
4444 > cd ..; echo $cwd
4445 /tmp/from
4446
4447 Here's the behavior with symlinks set to ‘ignore’,
4448
4449 > cd /tmp/to/dst; echo $cwd
4450 /tmp/to/dst
4451 > cd ..; echo $cwd
4452 /tmp/to
4453
4454 Here's the behavior with symlinks set to ‘expand’.
4455
4456 > cd /tmp/to/dst; echo $cwd
4457 /tmp/to/dst
4458 > cd ..; echo $cwd
4459 /tmp/to
4460 > cd /tmp/to/dst; echo $cwd
4461 /tmp/to/dst
4462 > cd ".."; echo $cwd
4463 /tmp/from
4464 > /bin/echo ..
4465 /tmp/to
4466 > /bin/echo ".."
4467 ..
4468
4469 Note that ‘expand’ expansion:
4470 1. Works just like ‘ignore’ for builtins like cd.
4471 2. Is prevented by quoting.
4472 3. Happens before filenames are passed to non-builtin
4473 commands.
4474
4475 tcsh (+)
4476 The version number of the shell in the format ‘R.VV.PP’, where
4477 ‘R’ is the major release number, ‘VV’ the current version, and
4478 ‘PP’ the patchlevel.
4479
4480 term The terminal type. Usually set in ~/.login as described under
4481 Startup and shutdown.
4482
4483 time If set to a number, then the time builtin executes automatically
4484 after each command which takes more than that many CPU seconds.
4485
4486 If there is a second word, it is used as a format string for the
4487 output of the time builtin.
4488
4489 (u) The following sequences may be used in the time format
4490 string:
4491
4492 Format Time information
4493
4494 %U The time the process spent in user mode in cpu sec‐
4495 onds.
4496
4497 %S The time the process spent in kernel mode in cpu
4498 seconds.
4499
4500 %E The elapsed (wall clock) time in seconds.
4501
4502 %P The CPU percentage computed as (%U + %S) / %E.
4503
4504 %W Number of times the process was swapped.
4505
4506 %X The average amount in (shared) text space used in
4507 Kbytes.
4508
4509 %D The average amount in (unshared) data/stack space
4510 used in Kbytes.
4511
4512 %K The total space used (%X + %D) in Kbytes.
4513
4514 %M The maximum memory the process had in use at any
4515 time in Kbytes.
4516
4517 %F The number of major page faults (page needed to be
4518 brought from disk).
4519
4520 %R The number of minor page faults.
4521
4522 %I The number of input operations.
4523
4524 %O The number of output operations.
4525
4526 %r The number of socket messages received.
4527
4528 %s The number of socket messages sent.
4529
4530 %k The number of signals received.
4531
4532 %w The number of voluntary context switches (waits).
4533
4534 %c The number of involuntary context switches.
4535
4536 Only the first four sequences are supported on systems without
4537 BSD resource limit functions. The default time format is ‘%Uu
4538 %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww’ for systems that support re‐
4539 source usage reporting and ‘%Uu %Ss %E %P’ for systems that do
4540 not.
4541
4542 Under Sequent's DYNIX/ptx, ‘%X’, ‘%D’, ‘%K’, ‘%r’, and ‘%s’ are
4543 not available, but the following additional sequences are:
4544
4545 Format Description Sequent DYNIX/ptx time information
4546
4547 %Y The number of system calls performed.
4548
4549 %Z The number of pages which are zero-filled on de‐
4550 mand.
4551
4552 %i The number of times a process's resident set size
4553 was increased by the kernel.
4554
4555 %d The number of times a process's resident set size
4556 was decreased by the kernel.
4557
4558 %l The number of read system calls performed.
4559
4560 %m The number of write system calls performed.
4561
4562 %p The number of reads from raw disk devices.
4563
4564 %q The number of writes to raw disk devices.
4565
4566 and the default time format is ‘%Uu %Ss %E %P %I+%Oio %Fpf+%Ww’.
4567
4568 Note that the CPU percentage can be higher than 100% on multi-
4569 processors.
4570
4571 tperiod (+)
4572 The period, in minutes, between executions of the periodic spe‐
4573 cial alias.
4574
4575 tty (+)
4576 The name of the tty, or empty if not attached to one.
4577
4578 uid (+)
4579 The user's real user ID.
4580
4581 user The user's login name.
4582
4583 verbose
4584 If set, causes the words of each command to be printed, after
4585 history substitution (if any). Set by the -v command line op‐
4586 tion.
4587
4588 version (+)
4589 The version ID stamp. It contains the shell's version number
4590 (see tcsh), origin, release date, vendor, operating system and
4591 machine (see VENDOR, OSTYPE, and MACHTYPE) and a comma-separated
4592 list of options which were set at compile time. Options which
4593 are set by default in the distribution are noted.
4594
4595 Supported version options include:
4596
4597 Option Description
4598
4599 8b The shell is eight bit clean; default.
4600
4601 7b The shell is not eight bit clean.
4602
4603 wide The shell is multi-byte encoding clean (like
4604 UTF-8).
4605
4606 nls The system's NLS is used; default for systems with
4607 NLS.
4608
4609 lf Login shells execute /etc/csh.login before instead
4610 of after /etc/csh.cshrc and ~/.login before instead
4611 of after ~/.tcshrc and ~/.history.
4612
4613 dl ‘.’ is put last in path for security; default.
4614
4615 nd ‘.’ is omitted from path for security.
4616
4617 vi vi(1)-style editing is the default rather than
4618 emacs(1)-style.
4619
4620 dtr Login shells drop DTR when exiting.
4621
4622 bye bye is a synonym for logout and log is an alternate
4623 name for watchlog.
4624
4625 al autologout is enabled; default.
4626
4627 kan Kanji is used if appropriate according to locale
4628 settings, unless the nokanji shell variable is set.
4629
4630 sm The system's malloc(3) is used.
4631
4632 hb The
4633 #!interpreter arg ...
4634 convention is emulated when executing shell
4635 scripts.
4636
4637 ng The newgrp builtin is available.
4638
4639 rh The shell attempts to set the REMOTEHOST environ‐
4640 ment variable.
4641
4642 afs The shell verifies your password with the kerberos
4643 server if local authentication fails. The afsuser
4644 shell variable or the AFSUSER environment variable
4645 override your local username if set.
4646
4647 An administrator may enter additional strings to indicate differ‐
4648 ences in the local version.
4649
4650 vimode (+)
4651 If unset, various key bindings change behavior to be more
4652 emacs(1)-style: word boundaries are determined by wordchars ver‐
4653 sus other characters.
4654
4655 If set, various key bindings change behavior to be more
4656 vi(1)-style: word boundaries are determined by wordchars versus
4657 whitespace versus other characters; cursor behavior depends upon
4658 current vi mode (command, delete, insert, replace).
4659
4660 This variable is unset by bindkey -e and set by bindkey -v.
4661 vimode may be explicitly set or unset by the user after those
4662 bindkey operations if required.
4663
4664 visiblebell (+)
4665 If set, a screen flash is used rather than the audible bell. See
4666 also nobeep.
4667
4668 watch (+)
4669 A list of user/terminal pairs to watch for logins and logouts.
4670 If either the user is ‘any’ all terminals are watched for the
4671 given user and vice versa. Setting watch to
4672 (any any)
4673 watches all users and terminals. For example,
4674
4675 set watch = (george ttyd1 any console $user any)
4676
4677 reports activity of the user ‘george’ on ‘ttyd1’, any user on the
4678 console, and oneself (or a trespasser) on any terminal.
4679
4680 Logins and logouts are checked every 10 minutes by default, but
4681 the first word of watch can be set to a number to check every so
4682 many minutes. For example,
4683
4684 set watch = (1 any any)
4685
4686 reports any login/logout once every minute. For the impatient,
4687 the log builtin command triggers a watch report at any time. All
4688 current logins are reported (as with the log builtin) when watch
4689 is first set.
4690
4691 The who shell variable controls the format of watch reports.
4692
4693 who (+)
4694 The format string for watch messages. The following sequences
4695 are replaced by the given information:
4696
4697 Format Who information
4698
4699 %n The name of the user who logged in/out.
4700
4701 %a The observed action, i.e., ‘logged on’, ‘logged
4702 off’, or ‘replaced olduser on’.
4703
4704 %l The terminal (tty) on which the user logged in/out.
4705
4706 %M The full hostname of the remote host, or ‘local’ if
4707 the login/logout was from the local host.
4708
4709 %m The hostname of the remote host up to the first
4710 ‘.’. The full name is printed if it is an IP ad‐
4711 dress or an X Window System display.
4712
4713 ‘%M’ and ‘%m’ are available on only systems that store the remote
4714 hostname in /etc/utmp.
4715
4716 If unset,
4717 %n has %a %l from %m.
4718 is used, or
4719 %n has %a %l.
4720 on systems which don't store the remote hostname.
4721
4722 wordchars (+)
4723 A list of non-alphanumeric characters to be considered part of a
4724 word by the forward-word, backward-word, etc., editor commands.
4725
4726 If unset, the default value is determined based on the state of
4727 vimode: if vimode is unset, ‘*?_-.[]~=’ is used as the default;
4728 if vimode is set, ‘_’ is used as the default.
4729
4731 AFSUSER (+)
4732 Equivalent to the afsuser shell variable.
4733
4734 COMMAND_LINE
4735 Set by tcsh to the current command line when invoking programs
4736 for the complete list mode ‘`...`’. See complete in Builtin
4737 commands.
4738
4739 COLUMNS
4740 The number of columns in the terminal. See Terminal management
4741 (+).
4742
4743 DISPLAY
4744 Used by X Window System (see X(1)). If set, the shell does not
4745 set autologout.
4746
4747 EDITOR The pathname to a default editor. Used by the run-fg-editor edi‐
4748 tor command if the the editors shell variable is unset. See also
4749 the VISUAL environment variable.
4750
4751 GROUP (+)
4752 Equivalent to the group shell variable.
4753
4754 HOME Equivalent to the home shell variable.
4755
4756 HOST (+)
4757 Initialized to the name of the machine on which the shell is run‐
4758 ning, as determined by the gethostname(2) system call.
4759
4760 HOSTTYPE (+)
4761 Initialized to the type of machine on which the shell is running,
4762 as determined at compile time. This variable is obsolete and
4763 will be removed in a future version.
4764
4765 HPATH (+)
4766 A colon-separated list of directories in which the run-help edi‐
4767 tor command looks for command documentation.
4768
4769 LANG Gives the preferred character environment. See Native Language
4770 System support (+).
4771
4772 LC_CTYPE
4773 If set, only ctype character handling is changed. See Native
4774 Language System support (+).
4775
4776 LINES The number of lines in the terminal. See Terminal management
4777 (+).
4778
4779 LS_COLORS
4780 The format of this variable is reminiscent of the termcap(5) file
4781 format; a colon-separated list of expressions of the form
4782 "xx=string", where "xx" is a two-character variable name.
4783
4784 The variables with their associated defaults are:
4785
4786 Var Default File type
4787
4788 no 0 Normal (non-filename) text.
4789 fi 0 Regular file.
4790 di 01;34 Directory.
4791 ln 01;36 Symbolic link.
4792 pi 33 Named pipe (FIFO).
4793 so 01;35 Socket.
4794 do 01;35 Door.
4795 bd 01;33 Block device.
4796 cd 01;32 Character device.
4797 ex 01;32 Executable file.
4798 mi (none) Missing file (defaults to fi).
4799 or (none) Orphaned symbolic link (defaults to ln).
4800 lc ^[[ Left code.
4801 rc m Right code.
4802 ec (none) End code (replaces lc+no+rc).
4803
4804 You need to include only the variables you want to change from
4805 the default.
4806
4807 File names can also be colorized based on filename extension.
4808 This is specified in the LS_COLORS variable using the syntax
4809 "*ext=string". For example, using ISO 6429 codes, to color all
4810 C-language source files blue you would specify "*.c=34". This
4811 would color all files ending in ‘.c’ in blue (34) color.
4812
4813 Control characters can be written either in C-style-escaped nota‐
4814 tion, or in stty-like ^-notation. The C-style notation adds ‘^[’
4815 for Escape, ‘_’ for a normal space character, and ‘?’ for Delete.
4816 In addition, the ‘^[’ escape character can be used to override
4817 the default interpretation of ‘^[’, ‘^’, ‘:’, and ‘=’.
4818
4819 Each file will be written as
4820 lc color-code rc filename ec
4821
4822 If the ‘ec’ code is undefined, the sequence
4823 lc no rc
4824 will be used instead. This is generally more convenient to use,
4825 but less general.
4826
4827 The left code (‘lc’), right code (‘rc’), and end codes (‘ec’) are
4828 provided so you don't have to type common parts over and over
4829 again and to support weird terminals; you will generally not need
4830 to change them at all unless your terminal does not use ISO 6429
4831 color sequences but a different system.
4832
4833 If your terminal does use ISO 6429 color codes, you can compose
4834 the type codes (i.e., all except the ‘lc’, ‘rc’, and ‘ec’ codes)
4835 from numerical commands separated by semicolons.
4836
4837 The most common color commands are:
4838
4839 Color Description
4840
4841 0 To restore default color.
4842 1 For brighter colors.
4843 4 For underlined text.
4844 5 For flashing text.
4845 30 For black foreground.
4846 31 For red foreground.
4847 32 For green foreground.
4848 33 For yellow (or brown) foreground.
4849 34 For blue foreground.
4850 35 For purple foreground.
4851 36 For cyan foreground.
4852 37 For white (or gray) foreground.
4853 40 For black background.
4854 41 For red background.
4855 42 For green background.
4856 43 For yellow (or brown) background.
4857 44 For blue background.
4858 45 For purple background.
4859 46 For cyan background.
4860 47 For white (or gray) background.
4861
4862 Not all commands will work on all systems or display devices.
4863
4864 A few terminal programs do not recognize the default end code
4865 properly. If all text gets colorized after you do a directory
4866 listing, try changing the ‘no’ and ‘fi’ codes from 0 to the nu‐
4867 merical codes for your standard fore- and background colors.
4868
4869 For symbolic links the ‘ln’ keyword can be set to ‘target’, which
4870 makes the file color the same as the color of the link target.
4871
4872 MACHTYPE (+)
4873 The machine type (microprocessor class or machine model), as de‐
4874 termined at compile time.
4875
4876 NOREBIND (+)
4877 If set, printable characters are not rebound to
4878 self-insert-command. See Native Language System support (+).
4879
4880 OSTYPE (+)
4881 The operating system, as determined at compile time.
4882
4883 PATH A colon-separated list of directories in which to look for exe‐
4884 cutables. Equivalent to the path shell variable, but in a dif‐
4885 ferent format.
4886
4887 PWD (+)
4888 Equivalent to the cwd shell variable, but not synchronized to it;
4889 updated only after an actual directory change.
4890
4891 REMOTEHOST (+)
4892 The host from which the user has logged in remotely, if this is
4893 the case and the shell is able to determine it. Set only if the
4894 shell was so compiled; see the version shell variable.
4895
4896 SHLVL (+)
4897 Equivalent to the shlvl shell variable.
4898
4899 SYSTYPE (+)
4900 The current system type. (Domain/OS only)
4901
4902 TERM Equivalent to the term shell variable.
4903
4904 TERMCAP
4905 The terminal capability string. See Terminal management (+).
4906
4907 USER Equivalent to the user shell variable.
4908
4909 VENDOR (+)
4910 The vendor, as determined at compile time.
4911
4912 VISUAL The pathname to a default full-screen editor. Used by the
4913 run-fg-editor editor command if the the editors shell variable is
4914 unset. See also the EDITOR environment variable.
4915
4917 /etc/csh.cshrc
4918 Read first by every shell.
4919
4920 ConvexOS, Stellix and Intel use /etc/cshrc.
4921
4922 NeXTs use /etc/cshrc.std.
4923
4924 A/UX, AMIX, Cray and IRIX have no equivalent in csh(1), but read
4925 this file in tcsh anyway.
4926
4927 Solaris 2.x does not have it either, but tcsh reads /etc/.cshrc.
4928
4929 (+)
4930
4931 /etc/csh.login
4932 Read by login shells after /etc/csh.cshrc.
4933
4934 ConvexOS, Stellix and Intel use /etc/login.
4935
4936 NeXTs use /etc/login.std.
4937
4938 Solaris 2.x uses /etc/.login.
4939
4940 A/UX, AMIX, Cray and IRIX use /etc/cshrc.
4941
4942 ~/.tcshrc (+)
4943 Read by every shell after /etc/csh.cshrc or its equivalent.
4944
4945 ~/.cshrc
4946 Read by every shell, if ~/.tcshrc doesn't exist, after
4947 /etc/csh.cshrc or its equivalent.
4948
4949 This manual uses ‘~/.tcshrc’ to mean “~/.tcshrc or, if ~/.tcshrc
4950 is not found, ~/.cshrc”.
4951
4952 ~/.history
4953 Read by login shells after ~/.tcshrc if savehist is set, but see
4954 also histfile.
4955
4956 ~/.login
4957 Read by login shells after ~/.tcshrc or ~/.history.
4958
4959 The shell may be compiled to read ~/.login before instead of af‐
4960 ter ~/.tcshrc and ~/.history; see the version shell variable.
4961
4962 ~/.cshdirs (+)
4963 Read by login shells after ~/.login if savedirs is set, but see
4964 also dirsfile.
4965
4966 /etc/csh.logout
4967 Read by login shells at logout.
4968
4969 ConvexOS, Stellix and Intel use /etc/logout. NeXTs use
4970 /etc/logout.std.
4971
4972 A/UX, AMIX, Cray and IRIX have no equivalent in csh(1), but read
4973 this file in tcsh anyway.
4974
4975 Solaris 2.x does not have it either, but tcsh reads /etc/.logout.
4976 (+)
4977
4978 ~/.logout
4979 Read by login shells at logout after /etc/csh.logout or its
4980 equivalent.
4981
4982 /bin/sh
4983 Used to interpret shell scripts not starting with a ‘#’.
4984
4985 /tmp/sh*
4986 Temporary file for ‘<<’.
4987
4988 /etc/passwd
4989 Source of home directories for ‘~name’ substitutions.
4990
4991 The order in which startup files are read may differ if the shell was so
4992 compiled; see Startup and shutdown and the version shell variable.
4993
4995 This manual describes tcsh as a single entity, but experienced csh(1)
4996 users will want to pay special attention to tcsh's new features.
4997
4998 A command-line editor, which supports emacs(1)-style or vi(1)-style key
4999 bindings. See The command-line editor (+) and Editor commands (+).
5000
5001 Programmable, interactive word completion and listing. See Completion
5002 and listing (+) and the complete and uncomplete builtin commands.
5003
5004 Spelling correction (+) of filenames, commands and variables.
5005
5006 Editor commands (+) which perform other useful functions in the middle of
5007 typed commands, including documentation lookup (run-help), quick editor
5008 restarting (run-fg-editor), and command resolution (which-command).
5009
5010 An enhanced history mechanism. Events in the history list are time-
5011 stamped. See also the history command and its associated shell vari‐
5012 ables, the previously undocumented ‘#’ event specifier and new modifiers
5013 under History substitution, the down-history, expand-history,
5014 history-search-backward, history-search-forward, i-search-back,
5015 i-search-fwd, toggle-literal-history, vi-search-back, vi-search-fwd, and
5016 up-history editor commands and the histlit shell variable.
5017
5018 Enhanced directory parsing and directory stack handling. See the cd,
5019 pushd, popd, and dirs commands and their associated shell variables, the
5020 description of Directory stack substitution (+), the dirstack, owd, and
5021 symlinks shell variables and the normalize-command and normalize-path ed‐
5022 itor commands.
5023
5024 Negation in glob-patterns. See Filename substitution.
5025
5026 New File inquiry operators and a filetest builtin which uses them.
5027
5028 A variety of Automatic, periodic and timed events (+) including scheduled
5029 events, special aliases, automatic logout and terminal locking, command
5030 timing and watching for logins and logouts.
5031
5032 Support for the Native Language System (see Native Language System
5033 support (+)), OS variant features (see OS variant support (+) and the
5034 echo_style shell variable) and system-dependent file locations (see
5035 FILES).
5036
5037 Extensive terminal-management capabilities. See Terminal management (+).
5038
5039 New builtin commands including builtins, hup, ls-F, newgrp, printenv,
5040 which, and where.
5041
5042 New variables that make useful information easily available to the shell.
5043 See the gid, loginsh, oid, shlvl, tcsh, tty, uid, and version shell vari‐
5044 ables and the HOST, REMOTEHOST, VENDOR, OSTYPE, and MACHTYPE environment
5045 variables.
5046
5047 A new syntax for including useful information in the prompt string (see
5048 prompt), and special prompts for loops and spelling correction (see
5049 prompt2 and prompt3).
5050
5051 Read-only variables. See Variable substitution.
5052
5054 In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementa‐
5055 tion. It was re-christened the DECsystem-10 in 1970 or so when DEC
5056 brought out the second model, the KI10.
5057
5058 TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
5059 think tank) in 1972 as an experiment in demand-paged virtual memory oper‐
5060 ating systems. They built a new pager for the DEC PDP-10 and created the
5061 OS to go with it. It was extremely successful in academia.
5062
5063 In 1975, DEC brought out a new model of the PDP-10, the KL10; they in‐
5064 tended to have only a version of TENEX, which they had licensed from BBN,
5065 for the new box. They called their version TOPS-20 (their capitalization
5066 is trademarked). A lot of TOPS-10 users (`The OPerating System for
5067 PDP-10') objected; thus DEC found themselves supporting two incompatible
5068 systems on the same hardware--but then there were 6 on the PDP-11!
5069
5070 TENEX, and TOPS-20 to version 3, had command completion via a user-code-
5071 level subroutine library called ULTCMD. With version 3, DEC moved all
5072 that capability and more into the monitor (`kernel' for you Unix types),
5073 accessed by the COMND% JSYS (`Jump to SYStem' instruction, the supervisor
5074 call mechanism [are my IBM roots also showing?]).
5075
5076 The creator of tcsh was impressed by this feature and several others of
5077 TENEX and TOPS-20, and created a version of csh which mimicked them.
5078
5080 The system limits argument lists to ARG_MAX characters.
5081
5082 The number of arguments to a command which involves filename expansion is
5083 limited to 1/6th the number of characters allowed in an argument list.
5084
5085 Command substitutions may substitute no more characters than are allowed
5086 in an argument list.
5087
5088 To detect looping, the shell restricts the number of alias substitutions
5089 on a single line to 20.
5090
5092 csh(1), emacs(1), ls(1), newgrp(1), setpath(1), sh(1), stty(1), su(1),
5093 tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2), pipe(2),
5094 setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2), malloc(3),
5095 setlocale(3), tty(4), a.out(5), termcap(5), environ(7), termio(7),
5096 Introduction to the C Shell
5097
5099 This manual documents tcsh 6.24.07 (Astron) 2022-12-21.
5100
5102 William Joy.
5103 Original author of csh(1).
5104 J.E. Kulp, IIASA, Laxenburg, Austria.
5105 Job control and directory stack features.
5106 Ken Greer, HP Labs, 1981.
5107 File name completion.
5108 Mike Ellis, Fairchild, 1983.
5109 Command name recognition/completion.
5110 Paul Placeway, Ohio State CIS Dept., 1983-1993.
5111 Command line editor, prompt routines, new glob syntax and numerous
5112 fixes and speedups.
5113 Karl Kleinpaste, CCI, 1983-4.
5114 Special aliases, directory stack extraction stuff, login/logout
5115 watch, scheduled events, and the idea of the new prompt format.
5116 Rayan Zachariassen, University of Toronto, 1984.
5117 ls-F and which builtins and numerous bug fixes, modifications and
5118 speedups.
5119 Chris Kingsley, Caltech.
5120 Fast storage allocator routines.
5121 Chris Grevstad, TRW, 1987.
5122 Incorporated 4.3BSD csh(1) into tcsh.
5123 Christos S. Zoulas, Cornell U. EE Dept., 1987-94.
5124 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c,
5125 SHORT_STRINGS support and a new version of sh.glob.c.
5126 James J Dempsey, BBN, and Paul Placeway, OSU, 1988.
5127 A/UX port.
5128 Daniel Long, NNSC, 1988.
5129 wordchars.
5130 Patrick Wolfe, Kuck and Associates, Inc., 1988.
5131 vi mode cleanup.
5132 David C Lawrence, Rensselaer Polytechnic Institute, 1989.
5133 autolist and ambiguous completion listing.
5134 Alec Wolman, DEC, 1989.
5135 Newlines in the prompt.
5136 Matt Landau, BBN, 1989.
5137 ~/.tcshrc.
5138 Ray Moody, Purdue Physics, 1989.
5139 Magic space bar history expansion.
5140 Mordechai ????, Intel, 1989.
5141 printprompt() fixes and additions.
5142 Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989.
5143 Automatic spelling correction and prompt3.
5144 Per Hedeland, Ellemtel, Sweden, 1990-.
5145 Various bugfixes, improvements and manual updates.
5146 Hans J. Albertsson, Sun Sweden.
5147 ampm, settc, and telltc.
5148 Michael Bloom.
5149 Interrupt handling fixes.
5150 Michael Fine, Digital Equipment Corp.
5151 Extended key support.
5152 Eric Schnoebelen, Convex, 1990.
5153 Convex support, lots of csh(1) bug fixes, save and restore of direc‐
5154 tory stack.
5155 Ron Flax, Apple, 1990.
5156 A/UX 2.0 (re)port.
5157 Dan Oscarsson, LTH Sweden, 1990.
5158 NLS support and simulated NLS support for non NLS sites, fixes.
5159 Johan Widen, SICS Sweden, 1990.
5160 shlvl, Mach support, correct-line, 8-bit printing.
5161 Matt Day, Sanyo Icon, 1990.
5162 POSIX termio support, SysV limit fixes.
5163 Jaap Vermeulen, Sequent, 1990-91.
5164 Vi mode fixes, expand-line, window change fixes, Symmetry port.
5165 Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991.
5166 autolist beeping options, modified the history search to search for
5167 the whole string from the beginning of the line to the cursor.
5168 Scott Krotz, Motorola, 1991.
5169 Minix port.
5170 David Dawes, Sydney U. Australia, Physics Dept., 1991.
5171 SVR4 job control fixes.
5172 Kimmo Suominen, 1991-.
5173 Various portability and other fixes. Added ‘$''’ (dollar-single-
5174 quotes).
5175 Jose Sousa, Interactive Systems Corp., 1991.
5176 Extended vi fixes and vi delete command.
5177 Marc Horowitz, MIT, 1991.
5178 ANSIfication fixes, new exec hashing code, imake fixes, where.
5179 Luke Mewburn, 1991-.
5180 Enhanced directory printing in prompt. Added ellipsis and rprompt.
5181 vimode improvements. Manual page improvements.
5182 Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995.
5183 ETA and Pyramid port, Makefile and lint fixes, ignoreeof=n addition,
5184 and various other portability changes and bug fixes.
5185 Jeff Fink, 1992.
5186 complete-word-fwd and complete-word-back.
5187 Harry C. Pulley, 1992.
5188 Coherent port.
5189 Andy Phillips, Mullard Space Science Lab U.K., 1992.
5190 VMS-POSIX port.
5191 Beto Appleton, IBM Corp., 1992.
5192 Walking process group fixes, csh(1) bug fixes, POSIX file tests,
5193 POSIX SIGHUP.
5194 Scott Bolte, Cray Computer Corp., 1992.
5195 CSOS port.
5196 Kaveh R. Ghazi, Rutgers University, 1992.
5197 Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf sup‐
5198 port.
5199 Mark Linderman, Cornell University, 1992.
5200 OS/2 port.
5201 Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992.
5202 Linux port.
5203 Tim P. Starrin, NASA Langley Research Center Operations, 1993.
5204 Read-only variables.
5205 Dave Schweisguth, Yale University, 1993-4.
5206 New man page and tcsh.man2html.
5207 Larry Schwimmer, Stanford University, 1993.
5208 AFS and HESIOD patches.
5209 Edward Hutchins, Silicon Graphics Inc., 1996.
5210 Added implicit cd.
5211 Martin Kraemer, 1997.
5212 Ported to Siemens Nixdorf EBCDIC machine.
5213 Amol Deshpande, Microsoft, 1997.
5214 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing
5215 library and message catalog code to interface to Windows.
5216 Taga Nayuta, 1998.
5217 Color ls additions.
5218
5220 Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
5221 Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
5222 the other people at Ohio State for suggestions and encouragement
5223
5224 All the people on the net, for putting up with, reporting bugs in, and
5225 suggesting new additions to each and every version
5226
5227 Richard M. Alderson III, for writing the T in tcsh section
5228
5230 When a suspended command is restarted, the shell prints the directory it
5231 started in if this is different from the current directory. This can be
5232 misleading (i.e., wrong) as the job may have changed directories inter‐
5233 nally.
5234
5235 Shell builtin functions are not stoppable/restartable. Command sequences
5236 of the form
5237 a ; b ; c
5238 are also not handled gracefully when stopping is attempted. If you sus‐
5239 pend ‘b’, the shell will then immediately execute ‘c’. This is espe‐
5240 cially noticeable if this expansion results from an alias. It suffices
5241 to place the sequence of commands in ‘()’'s to force it to a subshell,
5242 i.e.,
5243 ( a ; b ; c )
5244
5245 Control over tty output after processes are started is primitive; perhaps
5246 this will inspire someone to work on a good virtual terminal interface.
5247 In a virtual terminal interface much more interesting things could be
5248 done with output control.
5249
5250 Alias substitution is most often used to clumsily simulate shell proce‐
5251 dures; shell procedures should be provided rather than aliases.
5252
5253 Control structures should be parsed rather than being recognized as
5254 built-in commands. This would allow control commands to be placed any‐
5255 where, to be combined with ‘|’, and to be used with ‘&’ and ‘;’ metasyn‐
5256 tax.
5257
5258 foreach doesn't ignore here documents when looking for its end.
5259
5260 It should be possible to use the ‘:’ modifiers on the output of command
5261 substitutions.
5262
5263 The screen update for lines longer than the screen width is very poor if
5264 the terminal cannot move the cursor up (i.e., terminal type ‘dumb’).
5265
5266 HPATH and NOREBIND don't need to be environment variables.
5267
5268 Glob-patterns which do not use ‘?’, ‘*’, or ‘[]’, or which use ‘{}’ or
5269 ‘~’ are not negated correctly.
5270
5271 The single-command form of if does output redirection even if the expres‐
5272 sion is false and the command is not executed.
5273
5274 ls-F includes file identification characters when sorting filenames and
5275 does not handle control characters in filenames well. It cannot be in‐
5276 terrupted.
5277
5278 Command substitution supports multiple commands and conditions, but not
5279 cycles or backward gotos.
5280
5281 Report bugs at https://bugs.astron.com/ preferably with fixes. If you
5282 want to help maintain and test tcsh, add yourself to the mailing list in
5283 https://mailman.astron.com/mailman/listinfo/tcsh
5284
5285Astron 6.24.07 December 21, 2022 Astron 6.24.07