2 .\" Copyright (c) 1980, 1990, 1993
3 .\" The Regents of the University of California. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. Neither the name of the University nor the names of its contributors
14 .\" may be used to endorse or promote products derived from this software
15 .\" without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" - Indent in multiples of 4, usually 8.
31 .\" - Use \` for literal back-quote (`).
33 .\" - Use \e for literal backslash (\).
37 .\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
39 .\" - Refer to external commands in man page format, e.g., .Xr csh 1
40 .\" However, tcsh is .Nm , because this is the tcsh man page (and
41 .\" see the next note anyway).
43 .\" - Say `the shell', not `tcsh', unless distinguishing between tcsh and csh.
45 .\" - Say `shell variable'/`environment variable' instead of `variable'
46 .\" and `builtin command'/`editor command' instead of `builtin' or `command'
47 .\" unless the distinction is absolutely clear from context.
49 .\" - Use the simple present tense. `The shell uses', not `The shell will use'.
51 .\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
52 .\" etc. in the reference section should be mentioned in the appropriate
53 .\" descriptive section, or at least in the reference-section description
54 .\" of another command (or whatever) which is mentioned in a description
55 .\" section. Remember to note OS-specific things in "OS variant support",
56 .\" new features in NEW FEATURES and referenced external commands in SEE
59 .\" UPDATE NEXT LINE FOR RELEASE
62 .\" UPDATE NEXT LINE FOR RELEASE
67 .Nd C shell with file name completion and command line editing
71 .Op Fl bcdefFimnqstvVxX
72 .Op Fl D Ns Ar name Ns Op Ns = Ns Ar value
80 is an enhanced but completely compatible version of the Berkeley
83 It is a command language interpreter usable both as an interactive login
84 shell and a shell script command processor.
85 It includes a command-line editor (see
86 .Sx The command-line editor ) ,
87 programmable word completion (see
88 .Sx Completion and listing ) ,
89 spelling correction (see
90 .Sx Spelling correction ) ,
91 a history mechanism (see
92 .Sx History substitution ) ,
98 section describes major enhancements of
102 Throughout this manual, features of
107 (specifically, the 4.4BSD
111 and features which are present in
113 but not usually documented are labeled with
116 .Ss Argument list processing
117 If the first argument (argument 0) to the shell is
119 then it is a login shell.
120 A login shell can be also specified by invoking the shell with
123 flag as the only argument.
125 The rest of the flag arguments are interpreted as follows:
126 .Bl -tag -width indent
131 from option processing, causing any
132 further shell arguments to be treated as non-option arguments.
133 The remaining arguments will not be interpreted as shell options.
134 This may be used to pass options to a shell script without confusion
135 or possible subterfuge.
136 The shell will not run a set-user ID script without this option.
139 Commands are read from the following argument (which must be present, and
140 must be a single argument),
143 shell variable for reference, and executed.
144 Any remaining arguments are placed in the
149 The shell loads the directory stack from
152 .Sx Startup and shutdown ,
153 whether or not it is a login shell. (+)
155 .It Fl D Ns Ar name Ns Op Ns = Ns Ar value
156 Sets the environment variable
163 The shell exits if any invoked command terminates abnormally or
164 yields a non-zero exit status.
167 The shell does not load any resource or startup files, or perform any
168 command hashing, and thus starts faster.
175 to spawn processes. (+)
178 The shell is interactive and prompts for its top-level input, even if
179 it appears to not be a terminal.
180 Shells are interactive without this option if
181 their inputs and outputs are terminals.
184 The shell is a login shell.
193 even if it does not belong to the effective user.
201 The shell parses commands but does not execute them.
202 This aids in debugging shell scripts.
205 The shell accepts SIGQUIT (see
206 .Sx Signal handling )
207 and behaves when it is used under a debugger.
208 Job control is disabled. (u)
211 Command input is taken from the standard input.
214 The shell reads and executes a single line of input.
218 escape the newline at the end of this line and continue onto another line.
223 shell variable, so that
224 command input is echoed after history substitution.
229 shell variable, so that commands are echoed
230 immediately before execution.
235 shell variable even before executing
247 Print a help message on the standard output and exit. (+)
250 Print the version/platform/compilation options on the standard output and exit.
251 This information is also contained in the
256 After processing of flag arguments, if arguments remain but none of the
262 options were given, the first argument is taken as the name of a file of
266 The shell opens this file and saves its name for possible
269 Because many systems use either the standard
270 version 6 or version 7 shells whose shell scripts are not compatible
271 with this shell, the shell uses such a
273 shell to execute a script
274 whose first character is not a
276 i.e., that does not start with a
279 Remaining arguments are placed in the
283 .Ss Startup and shutdown
284 A login shell begins by executing commands from the system files
288 It then executes commands from files in the user's
301 shell variable) are loaded into memory, then
310 before instead of after
314 before instead of after
325 Non-login shells read only
333 For examples of startup files, please consult:
334 .Lk http://tcshrc.sourceforge.net
340 which need be run only once per login, usually go in one's
343 Users who need to use the same set of files with both
349 which checks for the existence of the
351 shell variable (q.v.) before using
361 (see the builtin command)
363 The rest of this manual uses
373 In the normal case, the shell begins reading commands from the terminal,
376 (Processing of arguments and the use of the shell to
377 process files containing command scripts are described later.)
378 The shell repeatedly reads a line of command input, breaks it into words,
379 places it on the command history list, parses it and executes each command
382 One can log out by typing
389 via the shell's autologout mechanism (see the
392 When a login shell terminates it sets the
398 as appropriate, then executes commands from the files
402 The shell may drop DTR on logout
403 if so compiled; see the
407 The names of the system login and logout files vary from system to system for
408 compatibility with different
415 .Sx The command-line editor .
417 .Sx Completion and listing
419 .Sx Spelling correction
420 sections describe two sets of functionality that are implemented as editor
421 commands but which deserve their own treatment.
425 the editor commands specific to the shell and their default bindings.
427 .Ss The command-line editor (+)
428 Command-line input can be edited using key sequences much like those used in
432 The editor is active only when the
434 shell variable is set, which it is by default in interactive shells.
437 builtin can display and change key bindings.
439 \-style key bindings are used by default
440 (unless the shell was compiled otherwise; see the
445 can change the key bindings to
447 \-style bindings en masse.
449 The shell always binds the arrow keys (as defined in the
451 environment variable) to:
453 .Bl -tag -width right -offset indent -compact
464 unless doing so would alter another single-character binding.
465 One can set the arrow key escape sequences to the empty string with
467 to prevent these bindings.
468 The ANSI/VT100 sequences for arrow keys are always bound.
470 Other key bindings are, for the most part, what
474 users would expect and can easily be displayed by
477 is no need to list them here.
481 commands with a short description of each.
482 Certain key bindings have different behavior depending if
486 \-style bindings are being used; see
488 for more information.
490 Note that editor commands do not have the same notion of a
493 The editor delimits words with any non-alphanumeric characters not in
496 while the shell recognizes only whitespace
497 and some of the characters with special meanings to it, listed under
498 .Sx Lexical structure .
500 .Ss Completion and listing (+)
501 The shell is often able to complete words when given a unique abbreviation.
502 Type part of a word (for example
504 and hit the tab key to run the
507 The shell completes the filename
510 .Pa /usr/lost+found/ ,
511 replacing the incomplete word with the complete word in the input buffer.
516 to the end of completed directories and a space to the end of other completed
517 words, to speed typing and provide a visual indicator of successful completion.
520 shell variable can be unset to prevent this.)
521 If no match is found (perhaps
523 doesn't exist), the terminal bell rings.
524 If the word is already complete (perhaps there is a
527 system, or perhaps you were thinking too far ahead and typed the whole thing)
530 or space is added to the end if it isn't already there.
532 Completion works anywhere in the line, not at just the end; completed
533 text pushes the rest of the line to the right.
534 Completion in the middle of a word
535 often results in leftover characters to the right of the cursor that need
538 Commands and variables can be completed in much the same way.
547 were the only command on your system beginning with
549 Completion can find a command in any directory in
551 or if given a full pathname.
558 if no other variable began with
561 The shell parses the input buffer to determine whether the word you want to
562 complete should be completed as a filename, command or variable.
563 The first word in the buffer and the first word following
570 is considered to be a command.
571 A word beginning with
573 is considered to be a variable.
574 Anything else is a filename.
579 You can list the possible completions of a word at any time by typing
582 .Ic delete-char-or-list-or-eof
584 The shell lists the possible completions using the
587 and reprints the prompt and unfinished command line, for example:
588 .Bd -literal -offset indent
590 lbin/ lib/ local/ lost+found/
596 shell variable is set, the shell lists the remaining
597 choices (if any) whenever completion fails:
598 .Bd -literal -offset indent
600 > nm /usr/lib/libt[tab]
601 libtermcap.a@ libtermlib.a@
602 > nm /usr/lib/libterm
607 shell variable is set to
609 choices are listed only when
610 completion fails and adds no new characters to the word being completed.
612 A filename to be completed can contain variables, your own or others' home
613 directories abbreviated with
616 .Sx Filename substitution )
617 and directory stack entries abbreviated with
620 .Sx Directory stack substitution ) .
622 .Bd -literal -offset indent
630 .Bd -literal -offset indent
631 > set local = /usr/local
634 bin/ etc/ lib/ man/ src/
638 Note that variables can also be expanded explicitly with the
642 .Ic delete-char-or-list-or-eof
643 lists at only the end of the line;
644 in the middle of a line it deletes the character under the cursor and
645 on an empty line it logs one out or, if the
647 variable is set, does nothing.
649 bound to the editor command
652 possibilities anywhere on a line, and
655 related editor commands that do or don't delete, list and/or log out,
657 .Ic delete-char-or-list-or-eof )
662 builtin command if so desired.
665 .Ic complete-word-fwd
667 .Ic complete-word-back
669 (not bound to any keys by default) can be used to cycle up and down through
670 the list of possible completions, replacing the current word with the next or
671 previous word in the list.
675 can be set to a list of suffixes to be ignored by completion.
676 Consider the following:
677 .Bd -literal -offset indent
679 Makefile condiments.h~ main.o side.c
680 README main.c meal side.o
682 > set fignore = (.o \e~)
684 main.c main.c~ main.o
692 are ignored by completion (but not listing),
693 because they end in suffixes in
697 was needed in front of
699 to prevent it from being expanded to
702 .Sx Filename substitution .
704 is ignored if only one completion is possible.
708 shell variable is set to
710 completion 1) ignores case and 2) considers periods, hyphens and underscores
717 to be word separators and hyphens and underscores to be equivalent.
718 If you had the following files
719 .Bd -literal -offset indent
720 comp.lang.c comp.lang.perl comp.std.c++
721 comp.lang.c++ comp.std.c
725 .Ql mail \-f c.l.c[tab] ,
726 it would be completed to
727 .Ql mail \-f comp.lang.c ,
734 .Ql mail \-f c..c++[^D]
741 in the following directory
742 .Bd -literal -offset indent
743 A_silly_file a-hyphenated-file another_silly_file
746 would list all three files, because case is ignored and hyphens and
747 underscores are equivalent.
748 Periods, however, are not equivalent to
749 hyphens or underscores.
753 shell variable is set to
756 ignores case and differences between a hyphen and an underscore word
757 separator only when the user types a lowercase character or a hyphen.
758 Entering an uppercase character or an underscore will not match the
759 corresponding lowercase character or hyphen word separator.
762 in the directory of the previous example would
763 still list all three files, but typing
772 .Ql another_silly_file
773 because the user explicitly used an uppercase
774 or an underscore character.
776 Completion and listing are affected by several other shell variables:
778 can be set to complete on the shortest possible unique
779 match, even if more typing might result in a longer match:
780 .Bd -literal -offset indent
782 fodder foo food foonly
793 but if we type another
795 .Bd -literal -offset indent
800 the completion completes on
808 can be set to run the
811 before each completion attempt,
814 spelling-correct the word to be completed (see
815 .Sx Spelling correction )
816 before each completion attempt and
818 can be set to complete commands automatically after one hits
821 can be set to make completion beep or not beep in a variety
824 can be set to never beep at all.
826 can be set to a list of directories and/or patterns that
827 match directories to prevent the completion mechanism from
834 can be set to limit the number of items
835 and rows (respectively) that are listed without asking first.
836 .Ic recognize_only_executables
837 can be set to make the shell list only
838 executables when listing commands, but it is quite slow.
842 builtin command can be used to tell the shell how
843 to complete words other than filenames, commands and variables.
844 Completion and listing do not work on glob-patterns (see
845 .Sx Filename substitution ) ,
850 editor commands perform
851 equivalent functions for glob-patterns.
853 .Ss Spelling correction (+)
854 The shell can sometimes correct the spelling of filenames, commands and
855 variable names as well as completing and listing them.
857 Individual words can be spelling-corrected with the
859 editor command (usually bound to
863 and the entire input buffer with
869 shell variable can be set to
871 to correct the command name or
873 to correct the entire line each time return is typed, and
875 can be set to correct the word to be completed
876 before each completion attempt.
878 When spelling correction is invoked in any of these ways and
879 the shell thinks that any part of the command line is misspelled,
880 it prompts with the corrected line:
881 .Bd -literal -offset indent
884 CORRECT>ls /usr/bin (y|n|e|a)?
889 or space to execute the corrected line,
891 to leave the uncorrected command in the input buffer,
893 to abort the command as if
896 anything else to execute the original line unchanged.
898 Spelling correction recognizes user-defined completions (see the
901 If an input word in a position for
902 which a completion is defined resembles a word in the completion list,
903 spelling correction registers a misspelling and suggests the latter
904 word as a correction.
905 However, if the input word does not match any of
906 the possible completions for that position, spelling correction does
907 not register a misspelling.
909 Like completion, spelling correction works anywhere in the line,
910 pushing the rest of the line to the right and possibly leaving
911 extra characters to the right of the cursor.
913 .Ss Editor commands (+)
915 lists key bindings and
917 lists and briefly describes editor commands.
918 Only new or especially interesting editor commands are described here.
923 for descriptions of each editor's key bindings.
925 The character or characters to which each command is bound by default is
926 given in parentheses.
927 .Sq ^ Ns Ar character
928 means a control character and
929 .Sq M- Ns Ar character
930 a meta character, typed as
931 .Sq escape- Ns Ar character
932 on terminals without a meta key.
933 Case counts, but commands that are bound
934 to letters by default are bound to both lower- and uppercase letters for
937 Supported editor commands are:
938 .Bl -tag -width indent
940 .It Ic backward-char No (^B, left)
941 Move back a character.
942 Cursor behavior modified by
945 .It Ic backward-delete-word No (M-^H, M-^?)
946 Cut from beginning of current word to cursor - saved in cut buffer.
947 Word boundary behavior modified by
950 .It Ic backward-word No (M-b, M-B)
951 Move to beginning of current word.
952 Word boundary and cursor behavior modified by
955 .It Ic beginning-of-line No (^A, home)
956 Move to beginning of line.
957 Cursor behavior modified by
960 .It Ic capitalize-word No (M-c, M-C)
961 Capitalize the characters from cursor to end of current word.
962 Word boundary behavior modified by
965 .It Ic complete-word No (tab)
966 Completes a word as described under
967 .Sx Completion and listing .
969 .It Ic complete-word-back No (not bound)
971 .Ic complete-word-fwd ,
972 but steps up from the end of the list.
974 .It Ic complete-word-fwd No (not bound)
975 Replaces the current word with the first word in the list of possible
977 May be repeated to step down through the list.
978 At the end of the list, beeps and reverts to the incomplete word.
980 .It Ic complete-word-raw No (^X-tab)
983 but ignores user-defined completions.
985 .It Ic copy-prev-word No (M-^_)
986 Copies the previous word in the current line into the input buffer.
988 .Ic insert-last-word .
989 Word boundary behavior modified by
992 .It Ic dabbrev-expand No (M-/)
993 Expands the current word to the most recent preceding one for which
994 the current is a leading substring, wrapping around the history list
998 without any intervening typing
999 changes to the next previous word etc., skipping identical matches
1001 .Ic history-search-backward
1004 .It Ic delete-char No (not bound)
1005 Deletes the character under the cursor.
1007 .Ic delete-char-or-list-or-eof .
1008 Cursor behavior modified by
1011 .It Ic delete-char-or-eof No (not bound)
1014 if there is a character under the cursor or
1018 .Ic delete-char-or-list-or-eof .
1019 Cursor behavior modified by
1022 .It Ic delete-char-or-list No (not bound)
1025 if there is a character under the cursor
1028 at the end of the line.
1030 .Ic delete-char-or-list-or-eof .
1032 .It Ic delete-char-or-list-or-eof No (^D)
1035 if there is a character under the cursor,
1037 at the end of the line or
1040 See also those three commands, each of which does only a single action, and
1041 .Ic delete-char-or-eof ,
1042 .Ic delete-char-or-list ,
1045 each of which does a different two out of the three.
1047 .It Ic delete-word No (M-d, M-D)
1048 Cut from cursor to end of current word - save in cut buffer.
1049 Word boundary behavior modified by
1052 .It Ic down-history No (down-arrow, ^N)
1055 but steps down, stopping at the original input line.
1057 .It Ic downcase-word No (M-l, M-L)
1058 Lowercase the characters from cursor to end of current word.
1059 Word boundary behavior modified by
1062 .It Ic end-of-file No (not bound)
1063 Signals an end of file, causing the shell to exit unless the
1065 shell variable (q.v.) is set to prevent this.
1067 .Ic delete-char-or-list-or-eof .
1069 .It Ic end-of-line No (^E, end)
1070 Move cursor to end of line.
1071 Cursor behavior modified by
1074 .It Ic expand-history No (M-space)
1075 Expands history substitutions in the current word.
1077 .Sx History substitution .
1080 .Ic toggle-literal-history ,
1085 .It Ic expand-glob No (^X-*)
1086 Expands the glob-pattern to the left of the cursor.
1088 .Sx Filename substitution .
1090 .It Ic expand-line No (not bound)
1092 .Ic expand-history ,
1093 but expands history substitutions in each word in the input buffer.
1095 .It Ic expand-variables No (^X-$)
1096 Expands the variable to the left of the cursor.
1098 .Sx Variable substitution .
1100 .It Ic forward-char No (^F, right)
1101 Move forward one character.
1102 Cursor behavior modified by
1105 .It Ic forward-word No (M-f, M-F)
1106 Move forward to end of current word.
1107 Word boundary and cursor behavior modified by
1110 .It Ic history-search-backward No (M-p, M-P)
1111 Searches backwards through the history list for a command beginning with
1112 the current contents of the input buffer up to the cursor and copies it
1113 into the input buffer.
1114 The search string may be a glob-pattern (see
1115 .Sx Filename substitution )
1125 will proceed from the
1126 appropriate point in the history list.
1129 .Ic history-search-forward
1133 .It Ic history-search-forward No (M-n, M-N)
1135 .Ic history-search-backward ,
1136 but searches forward.
1138 .It Ic i-search-back No (not bound)
1139 Searches backward like
1140 .Ic history-search-backward ,
1141 copies the first match
1142 into the input buffer with the cursor positioned at the end of the pattern,
1145 and the first match.
1146 Additional characters may be
1147 typed to extend the search,
1149 may be typed to continue
1150 searching with the same pattern, wrapping around the history list if
1154 single character for this to work) or one of the following special characters
1157 .Bl -tag -width indent -compact
1159 Appends the rest of the word under the cursor to the search pattern.
1161 (or any character bound to
1162 .Ic backward-delete-char )
1163 Undoes the effect of the last character typed and deletes a character
1164 from the search pattern if appropriate.
1166 If the previous search was successful, aborts the entire search.
1167 If not, goes back to the last successful search.
1169 Ends the search, leaving the current line in the input buffer.
1172 Any other character not bound to
1173 .Ic self-insert-command
1175 search, leaving the current line in the input buffer, and
1176 is then interpreted as normal input.
1177 In particular, a carriage return
1178 causes the current line to be executed.
1182 .Ic history-search-backward .
1183 Word boundary behavior modified by
1186 .It Ic i-search-fwd No (not bound)
1189 but searches forward.
1190 Word boundary behavior modified by
1193 .It Ic insert-last-word No (M-_)
1194 Inserts the last word of the previous input line
1196 into the input buffer.
1198 .Ic copy-prev-word .
1200 .It Ic list-choices No (M-^D)
1201 Lists completion possibilities as described under
1202 .Sx Completion and listing .
1204 .Ic delete-char-or-list-or-eof
1206 .Ic list-choices-raw .
1208 .It Ic list-choices-raw No (^X-^D)
1211 but ignores user-defined completions.
1213 .It Ic list-glob No (^X-g, ^X-G)
1216 builtin) matches to the glob-pattern
1218 .Sx Filename substitution )
1219 to the left of the cursor.
1221 .It Ic list-or-eof No (not bound)
1228 .Ic delete-char-or-list-or-eof .
1230 .It Ic magic-space No (not bound)
1231 Expands history substitutions in the current line,
1233 .Ic expand-history ,
1234 and inserts a space.
1236 is designed to be bound to the space bar,
1237 but is not bound by default.
1239 .It Ic normalize-command No (^X-?)
1240 Searches for the current word in
1242 and, if it is found, replaces it with
1243 the full path to the executable.
1244 Special characters are quoted.
1246 expanded and quoted but commands within aliases are not.
1248 useful with commands that take commands as arguments, e.g.,
1253 .It Ic normalize-path No (^X-n, ^X-N)
1254 Expands the current word as described under the
1261 .It Ic overwrite-mode No (unbound)
1262 Toggles between input and overwrite modes.
1264 .It Ic run-fg-editor No (M-^Z)
1265 Saves the current input line and
1266 looks for a stopped job where the file name portion of its first word
1272 is not set, then the file name portion of the
1274 environment variable
1279 environment variable
1283 If such a job is found, it is restarted as if
1286 This is used to toggle back and forth between an editor and
1288 Some people bind this command to
1291 can do this even more easily.
1293 .It Ic run-help No (M-h, M-H)
1294 Searches for documentation on the current command, using the same notion of
1296 as the completion routines, and prints it.
1300 is designed for short help files.
1301 If the special alias
1303 is defined, it is run with the
1304 command name as a sole argument.
1306 documentation should be in a file named
1313 which should be in one
1314 of the directories listed in the
1316 environment variable.
1317 If there is more than one help file only the first is printed.
1319 .It Ic self-insert-command No (text characters)
1320 In insert mode (the default), inserts the typed character into
1321 the input line after the character under the cursor.
1322 In overwrite mode, replaces the character under the cursor with the typed character.
1323 The input mode is normally preserved between lines, but the
1325 shell variable can be set to
1330 editor in that mode at the beginning of each line.
1332 .Ic overwrite-mode .
1334 .It Ic sequence-lead-in No (arrow prefix, meta prefix, ^X)
1335 Indicates that the following characters are part of a
1337 Binding a command to a multi-key sequence really creates
1338 two bindings: the first character to
1339 .Ic sequence-lead-in
1341 whole sequence to the command.
1342 All sequences beginning with a character
1344 .Ic sequence-lead-in
1345 are effectively bound to
1347 unless bound to another command.
1349 .It Ic spell-line No (M-$)
1350 Attempts to correct the spelling of each word in the input buffer, like
1352 but ignores words whose first character is one of
1363 to avoid problems with switches, substitutions and the like.
1365 .Sx Spelling correction .
1367 .It Ic spell-word No (M-s, M-S)
1368 Attempts to correct the spelling of the current word as described under
1369 .Sx Spelling correction .
1370 Checks each component of a word which appears to be a pathname.
1372 .It Ic toggle-literal-history No (M-r, M-R)
1375 history substitutions in the input buffer.
1382 .It Ic undefined-key No (any unbound key)
1385 .It Ic up-history No (up-arrow, ^P)
1386 Copies the previous entry in the history list into the input buffer.
1389 is set, uses the literal form of the entry.
1390 May be repeated to step up through the history list, stopping at the top.
1392 .It Ic upcase-word No (M-u, M-U)
1393 Uppercase the characters from cursor to end of current word.
1394 Word boundary behavior modified by
1397 .It Ic vi-beginning-of-next-word No (not bound)
1398 Vi goto the beginning of next word.
1399 Word boundary and cursor behavior modified by
1402 .It Ic vi-eword No (not bound)
1403 Vi move to the end of the current word.
1404 Word boundary behavior modified by
1407 .It Ic vi-search-back No (?)
1410 for a search string (which may be a glob-pattern, as with
1411 .Ic history-search-backward ) ,
1412 searches for it and copies it into the input buffer.
1413 The bell rings if no match is found.
1414 Hitting return ends the search and leaves the last match in the input
1416 Hitting escape ends the search and executes the match.
1420 .It Ic vi-search-fwd No (/)
1422 .Ic vi-search-back ,
1423 but searches forward.
1425 .It Ic which-command No (M-?)
1428 (see the description of the builtin command) on the
1429 first word of the input buffer.
1431 .It Ic yank-pop No (M-y)
1432 When executed immediately after a
1436 replaces the yanked string with the next previous string from the
1437 killring. This also has the effect of rotating the killring, such that
1438 this string will be considered the most recently killed by a later
1442 will cycle through the
1443 killring any number of times.
1446 .Ss Lexical structure
1447 The shell splits input lines into words at blanks and tabs.
1458 and the doubled characters
1464 are always separate words, whether or not they are
1465 surrounded by whitespace.
1467 When the shell's input is not a terminal, the character
1473 and the rest of the input line on which it appears is
1474 discarded before further parsing.
1476 A special character (including a blank or tab) may be prevented from having
1477 its special meaning, and possibly made part of another word, by preceding it
1480 or enclosing it in single
1488 When not otherwise quoted a newline preceded by a
1490 is equivalent to a blank, but inside quotes this sequence results in a
1496 .Sx History substitution
1497 can be prevented by enclosing the strings (or parts of strings)
1498 in which they appear with single quotes or by quoting the crucial character(s)
1504 .Sx Variable substitution
1506 .Sx Command substitution
1510 .Sx ( Alias substitution
1511 is no exception: quoting in any way any
1512 character of a word for which an
1514 has been defined prevents
1515 substitution of the alias.
1516 The usual way of quoting an alias is to precede it
1518 .Sx History substitution
1520 backslashes but not by single quotes.
1521 Strings quoted with double or backward
1523 .Sx Variable substitution
1525 .Sx Command substitution ,
1526 but other substitutions are prevented.
1528 Text inside single or double quotes becomes a single word (or part of one).
1529 Metacharacters in these strings, including blanks and tabs, do not form
1531 Only in one special case (see
1532 .Sx Command substitution
1533 below) can a double-quoted string yield parts of more than one word;
1534 single-quoted strings never do.
1535 Backward quotes are special: they signal
1536 .Sx Command substitution
1537 (q.v.), which may result in more than one word.
1539 C-style escape sequences can be used in single quoted strings by
1540 preceding the leading quote with
1544 .Sx Escape sequences
1546 a complete list of recognized escape sequences.
1548 Quoting complex strings, particularly strings which themselves contain quoting
1549 characters, can be confusing.
1550 Remember that quotes need not be used as they are
1552 It may be easier to quote not an entire string, but only
1553 those parts of the string which need quoting, using different types of quoting
1554 to do so if appropriate.
1558 shell variable (q.v.) can be set to make backslashes
1564 (+). This may make complex quoting tasks
1565 easier, but it can cause syntax errors in
1569 .Ss Escape sequences (+)
1570 The following escape sequences are always recognized inside a string
1573 and optionally by the
1580 Supported escape sequences are:
1582 .Bl -tag -width 12n -offset indent -compact
1588 The control character denoted by
1594 is a backslash, it must be doubled.
1610 Literal single quote.
1612 Literal double quote.
1614 The character corresponding to the octal number
1617 The character corresponding to the hexadecimal number
1619 (1\-2 hexadecimal digits).
1620 .It Li \ex{ Ns Ar nnnnnnnn Ns Li }
1621 The character corresponding to the hexadecimal number
1623 (1\-8 hexadecimal digits).
1624 .It Li \eu Ns Ar nnnn
1625 The Unicode code point
1627 (1\-4 hexadecimal digits).
1628 .It Li \eU Ns Ar nnnnnnnn
1629 The Unicode code point
1631 (1\-8 hexadecimal digits).
1634 The implementations of
1639 in other shells may take a varying number of digits. It is often safest
1640 to use leading zeros to provide the maximum expected number of digits.
1643 We now describe the various transformations the shell performs on the input in
1644 the order in which they occur.
1645 We note in passing the data structures involved
1646 and the commands and variables which affect them.
1647 Remember that substitutions
1648 can be prevented by quoting as described under
1649 .Sx Lexical structure .
1651 .Ss History substitution
1654 input from the terminal is saved in the history list.
1655 The previous command is always saved, and the
1658 variable can be set to a number to save that many commands.
1661 shell variable can be set to not save duplicate events or consecutive duplicate
1664 Saved commands are numbered sequentially from 1 and stamped with the time.
1665 It is not usually necessary to use event numbers, but the current event number
1666 can be made part of the prompt by placing an
1672 By default history entries are displayed by printing each parsed token
1673 separated by space; thus the redirection operator
1675 will be displayed as
1677 The shell actually saves history in expanded and literal (unexpanded) forms.
1680 shell variable is set, commands that display and store
1681 history use the literal form.
1685 builtin command can print, store in a file, restore
1686 and clear the history list at any time,
1691 shell variables can be set to
1692 store the history list automatically on logout and restore it on login.
1694 History substitutions introduce words from the history list into the input
1695 stream, making it easy to repeat commands, repeat arguments of a previous
1696 command in the current command, or fix spelling mistakes in the previous
1697 command with little typing and a high degree of confidence.
1699 History substitutions begin with the character
1701 They may begin anywhere in
1702 the input stream, but they do not nest.
1705 may be preceded by a
1708 prevent its special meaning; for convenience, a
1710 is passed unchanged when it
1711 is followed by a blank, tab, newline,
1715 History substitutions also
1716 occur when an input line begins with
1718 This special abbreviation will be
1720 The characters used to signal history substitution
1726 can be changed by setting the
1730 line which contains a history substitution is printed before it is executed.
1732 A history substitution may have an
1733 .Dq event specification ,
1734 which indicates the event from which words are to be taken, a
1735 .Dq word designator ,
1736 which selects particular words from the chosen event, and/or a
1738 which manipulates the selected words.
1740 An event specification can be:
1742 .Bl -tag -width 5n -offset indent -compact
1745 A number, referring to a particular event.
1748 An offset, referring to the event
1750 before the current event.
1754 This should be used carefully in
1756 where there is no check for recursion.
1758 allows 10 levels of recursion. (+)
1761 The previous event (equivalent to
1765 The most recent event whose first word begins with the string
1768 .It Li ? Ns Ar s Ns Li ?
1769 The most recent event which contains the string
1773 can be omitted if it is immediately followed by a newline.
1776 For example, consider this bit of someone's history list:
1777 .Bd -literal -offset indent
1778 9 8:30 nroff \-man wumpus.man
1779 10 8:31 cp wumpus.man wumpus.man.old
1780 11 8:36 vi wumpus.man
1781 12 8:37 diff wumpus.man.old wumpus.man
1784 The commands are shown with their event numbers and time stamps.
1785 The current event, which we haven't typed in yet, is event 13.
1791 refers to the previous event, 12.
1803 refers to event 9, which begins with
1806 also refers to event 12, which contains
1808 Without word designators or modifiers history references simply expand to the
1809 entire event, so we might type
1811 to redo the copy command or
1815 output scrolled off the top of the screen.
1817 History references may be insulated from the surrounding text with braces if
1821 would look for a command beginning with
1823 and, in this example, not find one, but
1827 .Ql vi wumpus.mandoc .
1828 Even in braces, history substitutions do not nest.
1832 expands, for example,
1839 expands it to the last event beginning
1842 only completely numeric arguments are treated as event numbers.
1843 This makes it possible to recall events beginning with numbers.
1851 To select words from an event we can follow the event specification by a
1853 and a designator for the desired words.
1854 The words of an input line are
1855 numbered from 0, the first (usually command) word being 0, the second word
1856 (first argument) being 1, etc.
1858 The basic word designators are:
1860 .Bl -tag -width 4n -offset indent -compact
1863 The first (command) word.
1871 The first argument, equivalent to
1878 The word matched by an
1879 .Li ? Ns Ar s Ns Li ? No search.
1881 .It Ar x Ns Li \- Ns Ar y
1891 but returns nothing if the event contains only 1 word.
1895 .Sq Ar x Ns Li \-$ .
1900 but omitting the last word
1904 Selected words are inserted into the command line separated by single blanks.
1907 command in the previous example might have been
1909 .Ql diff !!:1.old !!:1
1912 to select the first argument
1913 from the previous event) or
1914 .Ql diff !\-2:2 !\-2:1
1915 to select and swap the
1919 If we didn't care about the order of the
1927 command might have been written
1928 .Ql cp wumpus.man !#:1.old ,
1931 to refer to the current event.
1932 .Ql !n:\- hurkle.man
1933 would reuse the first two words from the
1937 .Ql nroff \-man hurkle.man .
1941 separating the event specification from the word designator can be
1942 omitted if the argument selector begins with a
1951 command might have been
1952 .Ql diff !!^.old !!^
1955 .Ql diff !!$.old !!$ .
1960 an argument selector beginning with
1962 will be interpreted as an event
1965 A history reference may have a word designator but no event specification.
1966 It then references the previous command.
1969 example, we could have said simply
1971 or, to get the arguments in the opposite order, just
1974 The word or words in a history reference can be edited, or
1976 by following it with one or more modifiers, each preceded by a
1979 .Bl -tag -width 6n -offset indent -compact
1982 Remove a trailing pathname component, leaving the head.
1985 Remove all leading pathname components, leaving the tail.
1988 Remove a filename extension
1990 leaving the root name.
1993 Remove all but the extension.
1996 Uppercase the first lowercase letter.
1999 Lowercase the first uppercase letter.
2001 .It Li s/ Ns Ar l Ns Li / Ns Ar r Ns Li /
2007 is simply a string like
2009 not a regular expression as in
2013 Any character may be used as the delimiter in place of
2017 can be used to quote the delimiter inside
2036 from a previous substitution or the
2038 from a previous search or event number in event specification is used.
2039 The trailing delimiter may be omitted if it is immediately followed by a
2043 Repeat the previous substitution.
2046 Apply the following modifier once to each word.
2049 Apply the following modifier as many times as possible to a single word.
2053 can be used together to apply a modifier globally.
2056 modifier, only the patterns contained in the original word are
2057 substituted, not patterns that contain any substitution result.
2060 Print the new command line but do not execute it.
2063 Quote the substituted words, preventing further substitutions.
2068 but in addition preserve empty variables as a string containing a NUL.
2069 This is useful to preserve positional arguments for example:
2070 .Bd -literal -offset indent -compact
2071 > set args=('arg 1' '' 'arg 3')
2072 > tcsh -f -c 'echo ${#argv}' $args:gQ
2079 but break into words at blanks, tabs and newlines.
2082 Modifiers are applied to only the first modifiable word (unless
2085 It is an error for no word to be modifiable.
2089 command might have been written as
2090 .Ql diff wumpus.man.old !#^:r ,
2095 from the first argument on the same line
2098 .Ql echo hello out there ,
2104 to upper case the first word to
2108 to upper case all words.
2110 .Ql mail \-s \&"I forgot my password\&" rot
2114 correct the spelling of
2117 .Sx Spelling correction
2119 different approach).
2121 There is a special abbreviation for substitutions.
2123 when it is the first character on an input line, is equivalent to
2125 Thus we might have said
2127 to make the spelling correction in the
2129 This is the only history substitution which does not explicitly begin with
2134 as such, only one modifier may be applied to each history
2135 or variable expansion.
2138 more than one may be used, for example
2139 .Bd -literal -offset indent
2140 % mv wumpus.man /usr/share/man/man1/wumpus.1
2149 A substitution followed by a
2150 colon may need to be insulated from it with braces:
2151 .Bd -literal -offset indent
2152 > mv a.out /usr/games/wumpus
2153 > setenv PATH !$:h:$PATH
2155 > setenv PATH !{\-2$:h}:$PATH
2156 setenv PATH /usr/games:/bin:/usr/bin:.
2159 The first attempt would succeed in
2165 expects another modifier after the second colon
2169 Finally, history can be accessed through the editor as well as through
2170 the substitutions just described.
2175 .Ic history-search-backward
2177 .Ic history-search-forward ,
2186 .Ic insert-last-word
2187 editor commands search for
2188 events in the history list and copy them into the input buffer.
2190 .Ic toggle-literal-history
2191 editor command switches between the
2192 expanded and literal forms of history lines in the input buffer.
2196 expand history substitutions
2197 in the current word and in the entire input buffer respectively.
2199 .Ss Alias substitution
2200 The shell maintains a list of aliases which can be set, unset and printed by
2206 After a command line is parsed
2207 into simple commands (see
2209 the first word of each command,
2210 left-to-right, is checked to see if it has an alias.
2211 If so, the first word is
2212 replaced by the alias.
2213 If the alias contains a history reference, it undergoes
2214 .Sx History substitution
2215 (q.v.) as though the original command were the
2216 previous input line.
2217 If the alias does not contain a history reference, the
2218 argument list is left untouched.
2220 Thus if the alias for
2228 the argument list here being undisturbed.
2232 .Ql grep !^ /etc/passwd
2236 .Ql grep bill /etc/passwd .
2237 Aliases can be used to introduce parser metasyntax.
2239 .Sq alias print 'pr \e!* | lpr'
2245 its arguments to the line printer.
2247 Alias substitution is repeated until the first word of the command has no
2249 If an alias substitution does not change the first word (as in the
2250 previous example) it is flagged to prevent a loop.
2251 Other loops are detected and
2254 Some aliases are referred to by the shell; see
2255 .Sx Special aliases .
2257 .Ss Variable substitution
2258 The shell maintains a list of variables, each of which has as value a list of
2260 The values of shell variables can be displayed and changed with the
2265 The system maintains its own list of
2268 These can be displayed and changed with
2274 (+) Variables may be made read-only with
2277 Read-only variables may not be modified or unset;
2278 attempting to do so will cause an error.
2279 Once made read-only, a variable cannot be made writable,
2282 should be used with caution.
2283 Environment variables cannot be made read-only.
2285 Some variables are set by the shell or referred to by it.
2288 variable is an image of the shell's argument
2289 list, and words of this variable's value are referred to in special ways.
2290 Some of the variables referred to by the shell are toggles;
2291 the shell does not care what their value is, only whether they are set or not.
2294 variable is a toggle which causes command
2298 command line option sets this variable.
2299 .Sx Special shell variables
2300 lists all variables which are referred to by the shell.
2302 Other operations treat variables numerically.
2305 command permits numeric
2306 calculations to be performed and the result assigned to a variable.
2308 values are, however, always represented as (zero or more) strings.
2310 purposes of numeric operations, the null string is considered to be zero, and
2311 the second and subsequent words of multi-word values are ignored.
2313 After the input line is aliased and parsed, and before each command is
2314 executed, variable substitution is performed keyed by
2318 expansion can be prevented by preceding the
2333 are interpreted later (see
2334 .Sx Command substitution
2337 substitution does not occur there until later,
2341 is passed unchanged if followed by a blank, tab, or
2344 Input/output redirections are recognized before variable expansion, and are
2345 variable expanded separately.
2346 Otherwise, the command name and entire argument
2347 list are expanded together.
2348 It is thus possible for the first (command) word
2349 (to this point) to generate more than one word, the first of which becomes the
2350 command name, and the rest of which become arguments.
2356 modifier the results of variable
2357 substitution may eventually be command and filename substituted.
2361 variable whose value consists of multiple words expands to a (portion of a)
2362 single word, with the words of the variable's value separated by blanks.
2366 modifier is applied to a substitution the variable will expand to
2367 multiple words with each word separated by a blank and quoted to prevent later
2368 command or filename substitution.
2370 The following metasequences are provided for introducing variable values into
2373 .Bl -tag -width 10n -offset indent -compact
2376 .It Li ${ Ns Ar name Ns Li }
2377 Substitutes the words of the value of variable
2383 from following characters which would
2384 otherwise be part of it.
2385 Shell variables have names consisting of
2386 letters and digits starting with a letter.
2387 The underscore character is
2388 considered a letter.
2391 is not a shell variable, but is set in the
2392 environment, then that value is returned (but some of the other forms
2393 given below are not available in this case).
2396 .It Li $ Ns Ar name Ns Li [ Ns Ar selector Ns Li ]
2397 .It Li ${ Ns Ar name Ns Li [ Ns Ar selector Ns Li ]}
2398 Substitutes only the selected words from the value of
2404 substitution and may consist of
2405 a single number or two numbers separated by a
2407 The first word of a variable's value is numbered
2409 If the first number of a range is omitted it defaults to
2411 If the last member of a range is omitted it defaults to
2417 It is not an error for a range to be empty if the
2418 second argument is omitted or in range.
2422 Substitutes the name of the file from which command input
2424 An error occurs if the name is not known.
2427 .It Li $ Ns Ar number
2428 .It Li ${ Ns Ar number Ns Li }
2430 .Ql $argv[ Ns Ar number Ns Li \] .
2436 which is equivalent to
2440 Except as noted, it is an error to reference a variable which
2445 modifiers described under
2446 .Sx History substitution ,
2449 can be applied to the substitutions above.
2450 More than one may be used.
2452 Braces may be needed to insulate a variable substitution from a literal colon
2454 .Sx History substitution
2455 (q.v.); any modifiers must appear
2458 The following substitutions can not be modified with
2462 .Bl -tag -width 10n -offset indent -compact
2464 .It Li $? Ns Ar name
2465 .It Li ${? Ns Ar name Ns Li }
2466 Substitutes the string
2478 if the current input filename is known,
2483 in interactive shells.
2486 .It Li $# Ns Ar name
2487 .It Li ${# Ns Ar name Ns Li }
2488 Substitutes the number of words in
2498 .It Li $% Ns Ar name
2499 .It Li ${% Ns Ar name Ns Li }
2500 Substitutes the number of characters in
2505 .It Li $% Ns Ar number
2506 .It Li ${% Ns Ar number Ns Li }
2507 Substitutes the number of characters in
2508 .Ql $argv[ Ns Ar number Ns Li \] .
2519 Substitutes the (decimal) process number of the (parent) shell.
2523 Substitutes the (decimal) process number of the last
2524 background process started by this shell.
2529 Substitutes the command line of the last command executed.
2534 Substitutes a line from the standard input, with no further interpretation
2536 It can be used to read from the keyboard in a shell script.
2541 as if it were equivalent to
2547 is waiting for a line to be
2548 typed the user may type an interrupt to interrupt the sequence into
2549 which the line is to be substituted, but
2551 does not allow this.
2555 .Ic expand-variables ,
2558 can be used to interactively expand individual variables.
2560 .Ss "Command, filename and directory stack substitution"
2561 The remaining substitutions are applied selectively to the arguments
2562 of builtin commands.
2563 This means that portions of expressions which are not evaluated are
2564 not subjected to these expansions.
2565 For commands which are not internal to the
2566 shell, the command name is substituted separately from the argument list.
2567 This occurs very late, after input-output redirection is performed, and
2568 in a child of the main shell.
2570 .Ss "Command substitution"
2571 Command substitution is indicated by a command enclosed in
2574 from such a command is broken into separate words at blanks, tabs and newlines,
2575 and null words are discarded.
2576 The output is variable and command substituted
2577 and put in place of the original string.
2579 Command substitutions inside double
2582 retain blanks and tabs; only newlines force new words.
2584 final newline does not force a new word in any case.
2585 It is thus possible for a
2586 command substitution to yield only part of a word, even if the command outputs
2589 By default, the shell since version 6.12 replaces all newline and carriage
2590 return characters in the command by spaces.
2591 If this is switched off by
2594 newlines separate commands as usual.
2596 .Ss "Filename substitution"
2597 If a word contains any of the characters
2606 it is a candidate for filename substitution, also known as
2608 This word is then regarded as a pattern
2609 .Dq ( glob-pattern ) ,
2611 replaced with an alphabetically sorted list of file names which match the
2614 In matching filenames, the character
2616 at the beginning of a filename or
2617 immediately following a
2619 as well as the character
2622 explicitly (unless either
2626 or both are set (+)).
2629 matches any string of characters,
2630 including the null string.
2633 matches any single character.
2636 matches any one of the characters enclosed.
2640 characters separated by
2642 matches any character lexically between the two.
2644 (+) Some glob-patterns can be negated:
2647 matches any single character
2650 characters and/or ranges of characters in the braces.
2652 An entire glob-pattern can also be negated with
2654 .Bd -literal -offset indent
2656 bang crash crunch ouch
2661 Glob-patterns which do not use
2670 (below) are not negated correctly.
2676 Left-to-right order is preserved:
2677 .Ql /usr/source/s1/{oldls,ls}.c
2680 .Ql /usr/source/s1/oldls.c /usr/source/s1/ls.c .
2681 The results of matches are
2682 sorted separately at a low level to preserve this order:
2685 .Ql ../memo ../box ../mbox .
2688 was not sorted with the results of matching
2690 It is not an error when this construct expands to files which do not exist,
2691 but it is possible to get an error from a command to which the expanded list
2693 This construct may be nested.
2694 As a special case the words
2699 are passed undisturbed.
2703 at the beginning of a filename refers to home directories.
2704 Standing alone, i.e.,
2706 it expands to the invoker's home directory as
2707 reflected in the value of the
2711 name consisting of letters, digits and
2713 characters the shell searches for a
2714 user with that name and substitutes their home directory; thus
2722 .Ql /usr/ken/chmach .
2725 is followed by a character other than a letter or
2727 or appears elsewhere
2728 than at the beginning of a word, it is left undisturbed.
2730 .Ql setenv MANPATH /usr/share/man:/usr/local/share/man:~/lib/man
2732 therefore, do home directory substitution as one might hope.
2734 It is an error for a glob-pattern containing
2743 not to match any files.
2744 However, only one pattern in a list of
2745 glob-patterns must match a file (so that, e.g.,
2748 only if there were no files in the current directory ending in
2755 shell variable is set a pattern (or list
2756 of patterns) which matches nothing is left unchanged rather than causing
2761 shell variable can be set to allow
2766 a file glob pattern that matches any string of characters including
2768 recursively traversing any existing sub-directories.
2771 will list all the .c files in the current directory tree.
2772 If used by itself, it will match zero or more sub-directories
2774 .Ql ls /usr/include/**/time.h
2775 will list any file named
2780 .Ql ls /usr/include/**time.h
2784 directory tree ending in
2787 .Ql ls /usr/include/**time**.h
2788 will match any .h file with
2791 in a subdirectory name or in the filename itself).
2792 To prevent problems with recursion, the
2794 glob-pattern will not
2795 descend into a symbolic link containing a directory.
2803 shell variable can be set to prevent filename substitution,
2806 editor command, normally bound to
2809 used to interactively expand individual filename substitutions.
2811 .Ss "Directory stack substitution (+)"
2812 The directory stack is a list of directories, numbered from zero, used by the
2817 builtin commands (q.v.).
2819 can print, store in a file, restore and clear the directory stack
2820 at any time, and the
2824 shell variables can be set to
2825 store the directory stack automatically on logout and restore it on login.
2828 shell variable can be examined to see the directory stack and
2829 set to put arbitrary directories into the directory stack.
2833 followed by one or more digits expands to an entry in
2834 the directory stack.
2837 expands to the last directory in
2840 .Bd -literal -offset indent
2857 shell variables and the
2859 editor command apply to directory stack as well as filename substitutions.
2861 .Ss "Other substitutions (+)"
2862 There are several more transformations involving filenames, not strictly
2863 related to the above but mentioned here for completeness.
2865 filename may be expanded to a full path when the
2867 variable (q.v.) is set to
2869 Quoting prevents this expansion, and
2872 editor command does it on demand.
2874 .Ic normalize-command
2875 editor command expands commands in
2877 into full paths on demand.
2884 as the old working directory
2885 (equivalent to the shell variable
2887 This is not a substitution at all, but an abbreviation recognized by only
2889 Nonetheless, it too can be prevented by quoting.
2892 The next three sections describe how the shell executes commands and
2893 deals with their input and output.
2895 .Ss "Simple commands, pipelines and sequences"
2896 A simple command is a sequence of words, the first of which specifies the
2897 command to be executed.
2898 A series of simple commands joined by
2902 The output of each command in a pipeline is connected to the
2905 Simple commands and pipelines may be joined into sequences with
2908 be executed sequentially.
2909 Commands and pipelines can also be joined into
2914 indicating, as in the C language, that the second
2915 is to be executed only if the first fails or succeeds respectively.
2917 A simple command, pipeline or sequence may be placed in parentheses,
2919 to form a simple command, which may in turn be a component of a pipeline or
2921 A command, pipeline or sequence can be executed
2922 without waiting for it to terminate by following it with an
2925 .Ss "Builtin and non-builtin command execution"
2926 Builtin commands are executed within the shell.
2927 If any component of a
2928 pipeline except the last is a builtin command, the pipeline is executed
2931 Parenthesized commands are always executed in a subshell.
2932 .Bd -literal -offset indent
2938 directory, leaving you where you were
2939 (printing this after the home directory), while
2940 .Bd -literal -offset indent
2947 Parenthesized commands are most often
2950 from affecting the current shell.
2952 When a command to be executed is found not to be a builtin command the shell
2953 attempts to execute the command via
2955 Each word in the variable
2957 names a directory in which the shell will look for the
2959 If the shell is not given a
2962 hashes the names in these directories into an internal table so that it will
2965 in only a directory where there is a possibility that the
2966 command resides there.
2967 This greatly speeds command location when a large
2968 number of directories are present in the search path. This hashing mechanism is
2970 .Bl -enum -width 2n -offset indent
2972 If hashing is turned explicitly off via
2975 If the shell was given a
2978 For each directory component of
2980 which does not begin with a
2983 If the command contains a
2987 In the above four cases the shell concatenates each component of the path
2988 vector with the given command name to form a path name of a file which it
2989 then attempts to execute it. If execution is successful, the search stops.
2991 If the file has execute permissions but is not an executable to the system
2992 (i.e., it is neither an executable binary nor a script that specifies its
2993 interpreter), then it is assumed to be a file containing shell commands and
2994 a new shell is spawned to read it.
2997 special alias may be set
2998 to specify an interpreter other than the shell itself.
3000 On systems which do not understand the
3002 script interpreter convention
3003 the shell may be compiled to emulate it; see the
3007 If so, the shell checks the first line of the file to
3008 see if it is of the form
3009 .Ql #! Ns Ar interpreter arg Li \&... .
3016 file to it on standard input.
3019 The standard input and standard output of a command may be redirected with the
3022 .Bl -tag -width 8n -offset indent -compact
3027 (which is first variable, command and filename
3028 expanded) as the standard input.
3032 Read the shell input up to a line which is identical to
3035 is not subjected to variable, filename or command substitution, and each input
3038 before any substitutions are done on this input
3049 command substitution is performed on the intervening lines, allowing
3057 Commands which are substituted have all blanks, tabs,
3058 and newlines preserved, except for the final newline which is dropped.
3060 resultant text is placed in an anonymous temporary file which is given to the
3061 command as standard input.
3069 is used as standard output.
3070 If the file does not exist
3071 then it is created; if the file exists, it is truncated, its previous contents
3074 If the shell variable
3076 is set, then the file must not exist or be a
3077 character special file (e.g., a terminal or
3079 or an error results.
3080 This helps prevent accidental destruction of files.
3084 can be used to suppress this check.
3090 is allowed on empty files;
3095 an interacive confirmation is presented, rather than an
3100 route the diagnostic output into the specified file as
3101 well as the standard output.
3103 is expanded in the same way as
3105 input filenames are.
3113 but appends output to the end of
3115 If the shell variable
3117 is set, then it is an error for
3120 to exist, unless one of the
3125 A command receives the environment in which the shell was invoked as modified
3126 by the input-output parameters and the presence of the command in a pipeline.
3127 Thus, unlike some previous shells, commands run from a file of shell commands
3128 have no access to the text of the commands by default; rather they receive the
3129 original standard input of the shell.
3132 mechanism should be used to
3133 present inline data.
3134 This permits shell command scripts to function as
3135 components of pipelines and allows the shell to block read its input.
3137 that the default standard input for a command run detached is
3141 but the original standard input of the shell.
3142 If this is a terminal and if the process attempts to read from the terminal,
3143 then the process will block and the user will be notified (see
3146 Diagnostic output may be directed through a pipe with the standard output.
3152 The shell cannot presently redirect diagnostic output without also redirecting
3153 standard output, but
3154 .Ql \&( Ar command Li > Ar output-file Li ) >& Ar error-file
3155 is often an acceptable workaround.
3162 to send output to the terminal.
3165 Having described how the shell accepts, parses and executes
3166 command lines, we now turn to a variety of its useful features.
3169 The shell contains a number of commands which can be used to regulate the
3170 flow of control in command files (shell scripts) and (in limited but
3171 useful ways) from terminal input.
3172 These commands all operate by forcing the
3173 shell to reread or skip in its input and, due to the implementation,
3174 restrict the placement of some of the commands.
3181 statements, as well as the
3182 .Ic if \&... then \&... else
3185 statement, require that the major
3186 keywords appear in a single simple command on an input line as shown below.
3188 If the shell's input is not seekable, the shell buffers up input whenever
3189 a loop is being read and performs seeks in this internal buffer to
3190 accomplish the rereading implied by the loop.
3191 (To the extent that this allows, backward
3193 s will succeed on non-seekable inputs.)
3202 use expressions with a common syntax.
3203 The expressions can include any
3204 of the operators described in the next three sections.
3207 builtin command (q.v.) has its own separate syntax.
3209 .Ss "Logical, arithmetical and comparison operators"
3210 These operators are similar to those of C and have the same precedence.
3212 The operators, in descending precedence, with equivalent precedence per line, are:
3214 .Bl -column -offset indent -compact "XX" "XX" "XX" "XX"
3215 .It Li \&( Ta Li \&)
3218 .It Li * Ta Li / Ta Li %
3221 .It Li <= Ta Li >= Ta Li < Ta Li >
3222 .It Li == Ta Li \&!= Ta Li =~ Ta Li \&!~
3237 their arguments as strings; all others operate on numbers.
3246 except that the right hand side is a
3248 .Sx Filename substitution )
3249 against which the left hand operand is matched.
3250 This reduces the need for use of the
3252 builtin command in shell scripts when all that is really needed is
3256 missing arguments are considered
3258 The results of all expressions are
3259 strings, which represent decimal numbers.
3260 It is important to note that
3261 no two components of an expression can appear in the same word; except
3262 when adjacent to components of expressions which are syntactically
3263 significant to the parser
3273 surrounded by spaces.
3275 .Ss "Command exit status"
3276 Commands can be executed in expressions and their exit status
3277 returned by enclosing them in braces
3279 Remember that the braces should
3280 be separated from the words of the command by spaces.
3282 succeed, returning true, i.e.,
3284 if the command exits with status 0,
3285 otherwise they fail, returning false, i.e.,
3287 If more detailed status
3288 information is required then the command should be executed outside of an
3291 shell variable examined.
3293 .Ss "File inquiry operators"
3294 Some of these operators perform true/false tests on files and related
3296 They are of the form
3302 .Bl -tag -width 3n -offset indent -compact
3314 Executable in the path or shell builtin, e.g.,
3342 Symbolic link. (+) *
3345 Block special file. (+)
3348 Character special file. (+)
3351 Named pipe (fifo). (+) *
3354 Socket special file. (+) *
3357 Set-user-ID bit is set. (+)
3360 Set-group-ID bit is set. (+)
3363 Sticky bit is set. (+)
3367 (which must be a digit) is an open file descriptor
3368 for a terminal device. (+)
3371 Has been migrated (Convex only). (+)
3374 Applies subsequent operators in a multiple-operator test to a symbolic link
3375 rather than to the file to which the link points. (+) *
3379 is command and filename expanded and then tested to
3380 see if it has the specified relationship to the real user.
3383 does not exist or is inaccessible or, for the operators indicated by
3385 if the specified file type does not exist on the current system,
3386 then all inquiries return false, i.e.,
3389 These operators may be combined for conciseness:
3390 .Ql \- Ns Ar xy file
3393 .Ql \- Ns Ar x file Li && \- Ns Ar y file .
3399 for plain executable files, but not for directories.
3402 may be used in a multiple-operator test to apply subsequent operators
3403 to a symbolic link rather than to the file to which the link points.
3406 is true for links owned by the invoking user.
3411 are always true for links and false for
3414 has a different meaning when it is the last operator
3415 in a multiple-operator test; see below.
3417 It is possible but not useful, and sometimes misleading, to combine operators
3420 to be a file with operators which do not
3427 with a non-file operator
3428 can lead to particularly strange results.
3430 Other operators return other information, i.e., not just
3435 They have the same format as before;
3439 .Bl -tag -width 6n -offset indent -compact
3442 Last file access time, as the number of seconds since the epoch.
3447 but in timestamp format, e.g.,
3448 .Sq Fri May 14 16:36:10 1993 .
3451 Last file modification time.
3456 but in timestamp format.
3459 Last inode modification time.
3464 but in timestamp format.
3475 ile identifier, in the form
3480 The name of the file pointed to by a symbolic link.
3483 Number of (hard) links.
3486 Permissions, in octal, without leading zero.
3495 .Ql \-P Ar file Li & Ar mode ,
3502 is writable by group and other,
3509 .It Li P Ns Ar mode Ns Li \&:
3518 Username, or the numeric userid if the username is unknown.
3524 Groupname, or the numeric groupid if the groupname is unknown.
3530 Only one of these operators may appear in a multiple-operator test, and it
3534 has a different meaning at the end of and
3535 elsewhere in a multiple-operator test.
3538 is a valid return value
3539 for many of these operators, they do not return
3541 when they fail: most
3549 If the shell is compiled with POSIX defined (see the
3552 variable), the result of a file inquiry is based on the permission bits of
3553 the file and not on the result of the
3556 For example, if one tests a file with
3558 whose permissions would
3559 ordinarily allow writing but which is on a file system mounted read-only,
3560 the test will succeed in a POSIX shell but fail in a non-POSIX shell.
3562 File inquiry operators can also be evaluated with the
3568 The shell associates a
3572 current jobs, printed by the
3574 command, and assigns them small integer
3576 When a job is started asynchronously with
3579 line which looks like
3580 .Bd -literal -offset indent
3584 indicating that the job which was started asynchronously was job number 1 and
3585 had one (top-level) process, whose process id was 1234.
3587 If you are running a job and wish to do something else you may hit the suspend
3590 which sends a STOP signal to the current job.
3591 The shell will then normally
3592 indicate that the job has been
3594 and print another prompt.
3597 shell variable is set, all jobs will be listed
3600 builtin command; if it is set to
3603 be in long format, like
3605 You can then manipulate the state of the suspended job.
3606 You can put it in the
3610 command or run some other commands and
3611 eventually bring the job back into the
3620 takes effect immediately and is like an interrupt
3621 in that pending output and unread input are discarded when it is typed.
3624 builtin command causes the shell to wait for all background
3629 key sends a delayed suspend signal, which does not generate a STOP
3630 signal until a program attempts to
3632 it, to the current job.
3633 This can usefully be typed ahead when you have prepared some commands for a
3634 job which you wish to stop after it has read them.
3637 key performs this function in
3642 is an editing command.
3645 A job being run in the background stops if it tries to read from the
3647 Background jobs are normally allowed to produce output, but this can
3648 be disabled by giving the command
3650 If you set this tty option,
3651 then background jobs will stop when they try to produce output like they do
3652 when they try to read input.
3654 There are several ways to refer to jobs in the shell.
3657 introduces a job name.
3658 If you wish to refer to job number 1, you can name it
3661 Just naming a job brings it to the foreground; thus
3666 bringing job 1 back into the foreground.
3669 resumes job 1 in the background, just like
3671 A job can also be named
3672 by an unambiguous prefix of the string typed in to start it:
3675 normally restart a suspended
3677 job, if there were only one suspended
3678 job whose name began with the string
3680 It is also possible to type
3682 to specify a job whose text contains
3684 if there is only one such job.
3686 The shell maintains a notion of the current and previous jobs.
3688 pertaining to jobs, the current job is marked with a
3690 and the previous job
3696 and (by analogy with the syntax of
3701 all refer to the current job, and
3704 to the previous job.
3706 The job control mechanism requires that the
3712 It is an artifact from a
3714 implementation of the tty
3715 driver which allows generation of interrupt characters from the keyboard to
3722 details on setting options in the new tty driver.
3724 .Ss "Status reporting"
3725 The shell learns immediately whenever a process changes state.
3727 informs you whenever a job becomes blocked so that no further progress is
3728 possible, but only right before it prints a prompt.
3729 This is done so that it
3730 does not otherwise disturb your work.
3731 If, however, you set the shell variable
3733 the shell will notify you immediately of changes of status in
3735 There is also a builtin command
3738 single process so that its status changes will be immediately reported.
3742 marks the current process; simply enter
3745 starting a background job to mark it.
3747 When you try to leave the shell while jobs are stopped, you will be
3749 .Sq There are suspended jobs.
3754 If you do this or immediately try to exit again, the shell
3755 will not warn you a second time, and the suspended jobs will be terminated.
3757 .Ss "Automatic, periodic and timed events (+)"
3758 There are various ways to run commands and take other actions automatically
3759 at various times in the
3762 They are summarized here,
3763 and described in detail under the appropriate
3764 .Sx Builtin commands ,
3765 .Sx Special shell variables ,
3767 .Sx Special aliases .
3771 builtin command puts commands in a scheduled-event list,
3772 to be executed by the shell at a given time.
3783 can be set, respectively, to execute commands:
3784 when the shell wants to ring the bell,
3785 when the working directory changes,
3786 when a job is started or is brought into the foreground,
3791 and before each command gets executed.
3795 shell variable can be set to log out or lock the shell
3796 after a given number of minutes of inactivity.
3800 shell variable can be set to check for new mail periodically.
3804 shell variable can be set to print the exit status
3805 of commands which exit with a status other than zero.
3809 shell variable can be set to ask the user, when
3812 typed, if that is really what was meant.
3816 shell variable can be set to execute the
3819 command after the completion of any process that takes more than a given
3820 number of CPU seconds.
3826 shell variables can be set to report when
3827 selected users log in or out, and the
3829 builtin command reports
3830 on those users at any time.
3832 .Ss "Native Language System support (+)"
3833 The shell is eight bit clean
3834 (if so compiled; see the
3837 and thus supports character sets needing this capability.
3838 NLS support differs depending on whether or not
3839 the shell was compiled to use the system's NLS (again, see
3841 In either case, 7-bit ASCII is the default character code
3842 (e.g., the classification of which characters are printable) and sorting,
3847 environment variables
3848 causes a check for possible changes in these respects.
3850 When using the system's NLS, the
3853 to determine appropriate character code/classification and sorting
3858 as the character code).
3859 This function typically examines the
3863 environment variables; refer to the system documentation for further details.
3864 When not using the system's NLS, the shell simulates it by assuming that the
3865 ISO 8859-1 character set is used
3866 whenever either of the
3870 variables are set, regardless of
3872 Sorting is not affected for the simulated NLS.
3874 In addition, with both real and simulated NLS, all printable
3875 characters in the range \e200\-\e377, i.e., those that have
3877 bindings, are automatically rebound to
3878 .Ic self-insert-command .
3879 The corresponding binding for the
3880 .No escape- Ns Ar char
3881 sequence, if any, is
3883 These characters are not rebound if the
3885 environment variable
3887 This may be useful for the simulated NLS or a primitive real NLS
3888 which assumes full ISO 8859-1.
3892 range \e240\-\e377 are effectively undone.
3893 Explicitly rebinding the relevant keys with
3895 is of course still possible.
3897 Unknown characters (i.e., those that are neither printable nor control
3898 characters) are printed in the format \ennn.
3899 If the tty is not in 8 bit mode, other 8 bit characters are printed by
3900 converting them to ASCII and using standout mode.
3902 never changes the 7/8 bit mode of the tty and tracks user-initiated
3903 changes of 7/8 bit mode.
3904 NLS users (or, for that matter, those who want to
3905 use a meta key) may need to explicitly set
3906 the tty in 8 bit mode through the appropriate
3908 command in, e.g., the
3912 .Ss "OS variant support (+)"
3913 A number of new builtin commands are provided to support features in
3914 particular operating systems.
3915 All are described in detail in the
3916 .Sx Builtin commands
3919 On systems that support TCF (aix-ibm370, aix-ps2),
3923 get and set the system execution path,
3927 get and set the experimental version prefix
3930 migrates processes between sites.
3934 prints the site on which each job is executing.
3938 executes commands of the underlying BS2000/OSD
3943 adds shared libraries to the current environment,
3945 changes the rootnode and
3947 changes the systype.
3951 is equivalent to Mach's
3954 Under Masscomp/RTU and Harris CX/UX,
3962 runs a command under the specified
3967 prints or sets the universe.
3974 environment variables
3975 indicate respectively the vendor, operating system and machine type
3976 (microprocessor class or machine model) of the
3977 system on which the shell thinks it is running.
3978 These are particularly useful when sharing one's home directory between several
3979 types of machines; one can, for example,
3980 .Bd -literal -offset indent
3981 set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
3986 and put executables compiled for each machine in the
3987 appropriate directory.
3992 variable indicates what options were chosen when the shell was compiled.
4000 shell variables and the system-dependent locations of
4001 the shell's input files (see
4004 .Ss "Signal handling"
4005 Login shells ignore interrupts when reading the file
4007 The shell ignores quit signals unless started with
4009 Login shells catch the terminate signal, but non-login shells inherit the
4010 terminate behavior from their parents.
4011 Other signals have the values which the shell inherited from its parent.
4013 In shell scripts, the shell's handling of interrupt and terminate signals
4014 can be controlled with
4016 and its handling of hangups can be
4022 The shell exits on a hangup (see also the
4026 default, the shell's children do too, but the shell does not send them a
4027 hangup when it exits.
4029 arranges for the shell to send a hangup to
4030 a child when it exits, and
4032 sets a child to ignore hangups.
4034 .Ss "Terminal management (+)"
4035 The shell uses three different sets of terminal
4041 used when quoting literal characters;
4044 used when executing commands.
4045 The shell holds some settings in each mode constant, so commands which leave
4046 the tty in a confused state do not interfere with the shell.
4047 The shell also matches changes in the speed and padding of the tty.
4048 The list of tty modes that are kept constant
4049 can be examined and modified with the
4052 Note that although the editor uses CBREAK mode (or its equivalent),
4053 it takes typed-ahead characters anyway.
4060 commands can be used to
4061 manipulate and debug terminal capabilities from the command line.
4063 On systems that support SIGWINCH or SIGWINDOW, the shell
4064 adapts to window resizing automatically and adjusts the environment
4077 fields, the shell adjusts
4078 them to reflect the new window size.
4081 The next sections of this manual describe all of the available
4082 .Sx Builtin commands ,
4083 .Sx Special aliases ,
4085 .Sx Special shell variables .
4087 .Ss "Builtin commands"
4096 .It Ic % Ns Ar job Cm \&&
4102 Does nothing, successfully.
4106 .Bl -tag -width 8n -compact
4109 .It Ic @ Ar name Cm = Ar expr
4110 .It Ic @ Ar name Ns Cm \&[ Ns Ar index Ns Cm \&] = Ar expr
4111 .It Ic @ Ar name Ns Cm ++|--
4112 .It Ic @ Ar name Ns Cm \&[ Ns Ar index Ns Cm \&]++|--
4113 The first form prints the values of all shell variables.
4115 The second form assigns the value of
4120 The third form assigns the value of
4135 may contain the operators
4147 then at least that part of
4149 must be placed within
4151 Note that the syntax of
4153 has nothing to do with that described
4157 The fourth and fifth forms increment
4182 must be separated by spaces.
4187 .It Ic alias Op Ar name Op Ar wordlist
4188 Without arguments, prints all aliases.
4191 prints the alias for name.
4201 is command and filename substituted.
4212 Shows the amount of dynamic memory acquired, broken down into used and free
4214 With an argument shows the number of free and used blocks in each size
4216 The categories start at size 8 and double at each step.
4217 This command's output may vary across system types, because systems other
4218 than the VAX may use a different memory allocator.
4220 .It Ic bg Op Cm % Ns Ar job No \&...
4221 Puts the specified jobs (or, without arguments, the current job)
4222 into the background, continuing each if it is stopped.
4224 may be a number, a string,
4235 .Bl -tag -width 8n -compact
4237 .It Ic bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc No (+)
4238 .It Ic bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl \- Oc Ar key No (+)
4239 .It Ic bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl \- Oc Ar key command No (+)
4240 The first form either lists all bound keys and the editor
4241 command to which each is bound,
4242 lists a description of the commands,
4243 or binds all keys to a specific mode.
4245 The second form lists the editor command to which
4249 The third form binds the editor command
4258 .Bl -tag -width 5n -offset indent -compact
4261 Lists or changes key-bindings in the alternative key map.
4262 This is the key map used in
4269 a control character written
4270 .No ^ Ns Ar character
4274 .No C- Ns Ar character
4277 a meta character written
4278 .No M- Ns Ar character
4281 a function key written
4285 or an extended prefix key written
4286 .No X- Ns Ar character
4292 is interpreted as a builtin or external command instead of an
4296 Binds all keys to the standard bindings for the default editor,
4311 is interpreted as a symbolic arrow key name, which may be one of
4319 Lists all editor commands and a short description of each.
4332 .Ic self-insert-command
4339 is taken as a literal string and treated as terminal input when
4345 reinterpreted, and this continues for ten levels of interpretation.
4347 .It Fl u No (or any invalid option)
4348 Prints a usage message.
4358 Forces a break from option processing, so the next word is taken as
4360 even if it begins with
4366 may be a single character or a string.
4367 If a command is bound to a string, the first character of the string is bound to
4368 .Ic sequence-lead-in
4369 and the entire string is bound to the command.
4371 Control characters in
4373 can be literal (they can be typed by preceding
4374 them with the editor command
4379 written caret-character style, e.g.,
4383 (caret-question mark).
4387 can contain backslashed
4388 escape sequences (in the style of System V
4392 .Bl -tag -width 5n -offset indent -compact
4411 The ASCII character corresponding to the octal number
4416 nullifies the special meaning of the following character, if it has
4425 .It Ic bs2cmd Ar bs2000-command No (+)
4428 to the BS2000 command interpreter for
4429 execution. Only non-interactive commands can be executed, and it is
4430 not possible to execute any command that would overlay the image
4431 of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
4434 Causes execution to resume after the
4441 The remaining commands on the
4442 current line are executed.
4443 Multi-level breaks are thus
4444 possible by writing them all on one line.
4447 Causes a break from a
4452 .It Ic builtins No (+)
4453 Prints the names of all builtin commands.
4459 Available only if the shell was so compiled;
4464 .It Ic case Ar label Ns Cm :
4467 statement as discussed below.
4472 .Op Fl n Ns | Ns Fl v
4478 is given, changes the shell's working directory
4485 variable is not set, in which case a
4492 it is interpreted as the previous working directory
4494 .Sx Other substitutions ) .
4498 is not a subdirectory of the current directory
4499 (and does not begin with
4504 each component of the variable
4506 is checked to see if it has a subdirectory
4511 is a shell variable whose value
4516 then this is tried to see if it is a directory, and the
4522 prints the final directory stack, just like
4529 flags have the same effect on
4538 forces a break from option processing so the next word
4539 is taken as the directory
4541 even if it begins with
4560 .Ar word Cm / Ar pattern Cm / Ar list Oo Cm : Ar select Oc Cm / Oo
4570 Without arguments, lists all completions.
4573 lists completions for
4579 etc., defines completions.
4582 may be a full command name or a glob-pattern
4584 .Sx Filename substitution ) .
4588 completion should be used only when
4593 specifies which word relative to the current word
4594 is to be completed, and may be one of the following:
4596 .Bl -tag -width 5n -offset indent -compact
4599 Current-word completion.
4601 is a glob-pattern which must match the beginning of the current word on
4604 is ignored when completing the current word.
4611 when completing the current word.
4614 Next-word completion.
4616 is a glob-pattern which must match the beginning of the previous word on
4622 but must match the beginning of the word two before the current word.
4625 Position-dependent completion.
4627 is a numeric range, with the same syntax used to index shell
4628 variables, which must include the current word.
4632 the list of possible completions, may be one of the following:
4634 .Bl -tag -width 5n -offset indent -compact
4640 Bindings (editor commands).
4643 Commands (builtin or external commands).
4646 External commands which begin with the supplied path prefix.
4652 Directories which begin with the supplied path prefix.
4655 Environment variables.
4661 Filenames which begin with the supplied path prefix.
4689 files which begin with the supplied path prefix.
4710 Words from the variable
4714 Words from the given list.
4717 Words from the output of command.
4721 is an optional glob-pattern.
4722 If given, words from only
4729 shell variable is ignored.
4743 as an explanatory message when the
4745 editor command is used.
4748 is a single character to be appended to a successful
4750 If null, no character is appended.
4751 If omitted (in which
4752 case the fourth delimiter can also be omitted), a slash is appended to
4753 directories and a space to other words.
4759 has the additional environment variable
4762 contains (as its name indicates) contents of the current (already
4763 typed in) command line. One can examine and use contents of the
4765 environment variable in a custom script to build more
4766 sophisticated completions (see completion for
4768 included in this package).
4770 Now for some examples.
4771 Some commands take only directories as arguments,
4772 so there's no point completing plain files.
4773 .Bd -literal -offset indent
4774 > complete cd 'p/1/d/'
4777 completes only the first word following
4782 \-type completion can also be used to narrow down command completion:
4783 .Bd -literal -offset indent
4786 > complete \-co* 'p/0/(compress)/'
4791 This completion completes commands (words in position 0,
4803 indicates that this completion is to be used with only
4805 .Bd -literal -offset indent
4806 > complete find 'n/\-user/u/'
4815 immediately following
4817 is completed from the list of users.
4818 .Bd -literal -offset indent
4819 > complete cc 'c/\-I/d/'
4829 is completed as a directory.
4831 is not taken as part of the
4832 directory because we used lowercase
4837 are useful with different commands.
4838 .Bd -literal -offset indent
4839 > complete alias 'p/1/a/'
4840 > complete man 'p/*/c/'
4841 > complete set 'p/1/s/'
4842 > complete true 'p/1/x:Truth has no options./'
4845 These complete words following
4852 with shell variables.
4854 doesn't have any options, so
4856 does nothing when completion
4857 is attempted and prints
4858 .Sq Truth has no options.
4859 when completion choices are listed.
4863 example, and several other examples below, could
4864 just as well have used
4871 Words can be completed from a variable evaluated at completion time,
4872 .Bd -literal -offset indent
4873 > complete ftp 'p/1/$hostnames/'
4874 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
4876 rtfm.mit.edu tesla.ee.cornell.edu
4878 > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
4880 rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
4883 or from a command run at completion time:
4884 .Bd -literal -offset indent
4885 > complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
4887 23113 23377 23380 23406 23429 23529 23530 PID
4892 command does not itself quote its arguments,
4893 so the braces, space and
4897 must be quoted explicitly.
4899 One command can have multiple completions:
4900 .Bd -literal -offset indent
4901 > complete dbx 'p/2/(core)/' 'p/*/c/'
4904 completes the second argument to
4909 arguments with commands.
4910 Note that the positional completion is specified
4911 before the next-word completion.
4912 Because completions are evaluated from left to right, if
4913 the next-word completion were specified first it would always match
4914 and the positional completion would never be executed.
4916 common mistake when defining a completion.
4920 pattern is useful when a command takes files with only
4921 particular forms as arguments.
4923 .Bd -literal -offset indent
4924 > complete cc 'p/*/f:*.[cao]/'
4929 arguments to files ending in only
4935 can also exclude files, using negation of a glob-pattern as
4937 .Sx Filename substitution .
4939 .Bd -literal -offset indent
4940 > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
4943 to exclude precious source code from
4947 could still type excluded names manually or override the completion
4949 .Ic complete-word-raw
4951 .Ic list-choices-raw
4952 editor commands (q.v.).
4967 respectively, but they use the
4969 argument in a different way: to
4970 restrict completion to files beginning with a particular path prefix.
4972 example, the Elm mail program uses
4974 as an abbreviation for one's mail
4977 .Bd -literal -offset indent
4978 > complete elm c@=@F:$HOME/Mail/@
4984 .Ql elm \-f ~/Mail/ .
4985 Note that we used the separator
4989 to avoid confusion with the
4991 argument, and we used
4995 because home directory substitution works at only the
4996 beginning of a word.
4999 is used to add a nonstandard suffix
5002 for directories) to completed words.
5003 .Bd -literal -offset indent
5004 > complete finger 'c/*@/$hostnames/' 'p/1/u/@'
5007 completes arguments to
5009 from the list of users, appends an
5011 and then completes after the
5017 again the order in which the completions are specified.
5019 Finally, here's a complex example for inspiration:
5020 .Bd -literal -offset indent
5022 \&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
5023 \&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
5024 \&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
5025 \&'n/\-type/(b c d f l p s)/' \e
5026 \'c/\-/(name newer cpio ncpio exec ok user \e
5027 group fstype type atime ctime depth inum \e
5028 ls mtime nogroup nouser perm print prune \e
5033 This completes words following
5039 (note the pattern which matches both) to files,
5044 to commands, words following
5048 to users and groups respectively
5055 It also completes the switches themselves from the given list
5059 and completes anything not otherwise completed to a directory.
5062 Remember that programmed completions are ignored if the word being completed
5063 is a tilde substitution (beginning with
5065 or a variable (beginning with
5072 Continues execution of the nearest enclosing
5076 The rest of the commands on the current line are executed.
5079 Labels the default case in a
5082 It should come after all
5088 .Bl -tag -width 8n -compact
5092 .Op Fl n Ns | Ns Fl v
5103 The first form prints the directory stack.
5104 The top of the stack is at the
5105 left and the first directory in the stack is the current directory.
5111 in the output is expanded explicitly
5114 or the pathname of the home directory for user
5119 entries are wrapped before they reach the edge of the screen.
5123 entries are printed one per line, preceded by their stack positions.
5133 is accepted but does nothing.
5137 the second form saves the directory stack to
5149 a directory stack file saved by the
5164 Note that login shells do the equivalent of
5174 is normally sourced before
5182 The third form clears the directory stack.
5187 .It Ic echo Oo Fl n Oc Ar word No \&...
5190 to the shell's standard
5191 output, separated by spaces and terminated with a newline.
5194 shell variable may be set to emulate (or not) the flags and escape
5195 sequences of the BSD and/or System V versions of
5198 .Sx Escape sequences
5202 .It Ic echotc Oo Fl sv Oc Ar arg No \&... No (+)
5203 Exercises the terminal capabilities (see
5209 sends the cursor to the home position,
5211 sends it to column 3 and row 10, and
5212 .Ql echotc ts 0; echo \&"This is a test.\&"; echotc fs
5227 value of that capability
5231 indicating that the terminal does
5232 or does not have that capability).
5233 One might use this to make the output
5234 from a shell script less verbose on slow terminals, or limit command
5235 output to the number of lines on the screen:
5236 .Bd -literal -offset indent
5237 > set history=\`echotc lines\`
5241 Termcap strings may contain wildcards which will not echo correctly.
5242 One should use double quotes when setting a shell variable to a terminal
5243 capability string, as in the following example that places the date in
5245 .Bd -literal -offset indent
5246 > set tosl="\`echotc ts 0\`"
5247 > set frsl="\`echotc fs\`"
5248 > echo \-n "$tosl";date; echo \-n "$frsl"
5253 nonexistent capabilities return the empty string rather
5254 than causing an error.
5257 messages are verbose.
5262 .Bl -tag -width 8n -compact
5268 See the description of the
5279 .It Ic eval Ar arg No \&...
5280 Treats the arguments as input to the
5281 shell and executes the resulting command(s) in the context
5282 of the current shell.
5283 This is usually used to execute commands
5284 generated as the result of command or variable substitution,
5285 because parsing occurs before these substitutions.
5291 .It Ic exec Ar command No \&...
5292 Executes the specified
5294 in place of the current shell.
5296 .It Ic exit Op Ar expr
5297 The shell exits either with the value of the specified
5299 (an expression, as described under
5305 .It Ic fg Op Cm % Ns Ar job No \&...
5306 Brings the specified jobs (or, without arguments, the current job)
5307 into the foreground, continuing each if it is stopped.
5309 may be a number, a string,
5321 .It Ic filetest \- Ns Ar op file No \&... No (+)
5324 (which is a file inquiry operator as described under
5325 .Sx File inquiry operators )
5328 and returns the results as a
5329 space-separated list.
5333 .Bl -tag -width 8n -compact
5335 .It Ic foreach Ar name Cm \&( Ns Ar wordlist Ns Cm \&)
5338 Successively sets the variable
5342 and executes the sequence of commands between this command
5349 must appear alone on separate lines.) The builtin command
5351 may be used to continue the loop prematurely and
5354 to terminate it prematurely.
5355 When this command is read from the terminal, the loop is read once
5360 before any statements in
5361 the loop are executed.
5362 If you make a mistake typing in a
5363 loop at the terminal you can rub it out.
5368 .It Ic getspath No (+)
5369 Prints the system execution path.
5372 .It Ic getxvers No (+)
5373 Prints the experimental version prefix.
5376 .It Ic glob Ar word No \&...
5381 parameter is not recognized and words are
5382 delimited by null characters in the output.
5384 programs which wish to use the shell to filename expand a list of words.
5388 is filename and command-substituted to
5389 yield a string of the form
5391 The shell rewinds its
5392 input as much as possible, searches for a line of the
5394 .Sq Ar label Ns No \&: ,
5395 possibly preceded by blanks or tabs, and
5396 continues execution after that line.
5399 Prints a statistics line indicating how effective the
5400 internal hash table has been at locating commands (and avoiding
5405 is attempted for each component of the
5407 where the hash function indicates a possible hit, and
5408 in each component which does not begin with a
5413 prints only the number and size of
5418 .Bl -tag -width 8n -compact
5425 .Fl S Ns | Ns Fl L Ns | Ns Fl M
5433 The first form prints the history event list.
5438 most recent events are printed or saved.
5441 the history list is printed without leading numbers.
5444 is specified, timestamps are printed also in comment form.
5445 (This can be used to
5446 produce files suitable for loading with
5452 the order of printing is most recent
5453 first rather than oldest first.
5457 the second form saves the history list to
5459 If the first word of the
5461 shell variable is set to a
5462 number, at most that many lines are saved.
5463 If the second word of
5467 the history list is merged with the
5468 existing history file instead of replacing it (if there is one) and
5469 sorted by time stamp.
5470 (+) Merging is intended for an environment like
5472 with several shells in simultaneous use.
5473 If the second word of
5477 and the third word is set to
5479 the history file update
5480 will be serialized with other shell sessions that would possibly like
5481 to merge history at exactly the same time.
5487 which is presumably a
5488 history list saved by the
5493 to the history list.
5500 into the history list and sorted by timestamp.
5513 except that it does not require a
5516 Note that login shells do the equivalent of
5526 is normally sourced before
5536 is set, the first and second forms print and save the literal
5537 (unexpanded) form of the history list.
5539 The third form clears the history list.
5544 .It Ic hup Oo Ar command Oc No (+)
5549 such that it will exit on a hangup
5550 signal and arranges for the shell to send it a hangup signal when the shell
5552 Note that commands may set their own response to hangups, overriding
5554 Without an argument, causes the non-interactive shell only to
5555 exit on a hangup for the remainder of the script.
5562 .It Ic if Cm \&( Ns Ar expr Ns Cm \&) Ar command
5565 (an expression, as described under
5567 evaluates true, then
5570 Variable substitution on
5572 happens early, at the same time it
5573 does for the rest of the
5577 must be a simple command, not an alias, a pipeline, a command list
5578 or a parenthesized command list, but it may have arguments.
5579 Input/output redirection occurs even if
5586 executed; this is a bug.
5590 .Bl -tag -width 8n -compact
5592 .It Ic if Cm \&( Ns Ar expr Ns Cm \&) then
5594 .It Ic else if Cm \&( Ns Ar expr2 Ns Cm \&) then
5601 is true then the commands to the
5604 are executed; otherwise if
5607 the commands to the second
5613 pairs are possible; only one
5619 part is likewise optional.
5624 must appear at the beginning of input lines;
5627 must appear alone on its input line or after an
5632 .Bl -tag -width 8n -compact
5634 .It Ic inlib Ar shared-library No \&... No (+)
5637 to the current environment.
5639 to remove a shared library.
5644 .Bl -tag -width 8n -compact
5647 .It Ic jobs Fl Z Oo Ar title Oc No (+)
5648 Lists the active jobs.
5651 lists process IDs in addition to the normal information.
5652 On TCF systems, prints the site on which each job is executing.
5656 option sets the process title to
5663 is provided, the process title will be cleared.
5665 .\" adjacant multi-tag items; add a blank
5671 .Cm % Ns Ar job Ns | Ns Ar pid No \&...
5673 The first form lists the signal names.
5675 The second form sends the specified
5678 is given, the TERM (terminate) signal) to the specified jobs or processes.
5680 may be a number, a string,
5688 Signals are either given by number or by name (as given in
5689 .Pa /usr/include/signal.h ,
5690 stripped of the prefix
5696 does not send a signal
5698 If the signal being sent is TERM (terminate)
5699 or HUP (hangup), then the job or process is sent a
5700 CONT (continue) signal as well.
5705 .It Ic limit Oo Fl h Oc Op Ar resource Op Ar maximum-use
5706 Limits the consumption by the current process and each
5707 process it creates to not individually exceed
5715 the current limit is printed; if no
5718 all limitations are given.
5722 hard limits are used instead of the current limits.
5724 hard limits impose a ceiling on the values of the current
5726 Only the super-user may raise the hard limits, but
5727 a user may lower or raise the current limits within the legal range.
5731 types currently include (if supported by the OS):
5732 .Bl -tag -width 12n -offset indent
5735 Maximum number of threads for this process.
5738 Size of the largest core dump that will be created.
5741 Maximum number of cpu-seconds to be used by each process.
5744 Maximum growth of the data+stack region via
5746 beyond the end of the program text.
5748 .It Ic descriptors No or Ic openfiles
5749 Maximum number of open files for this process.
5752 Largest single file which can be created.
5755 Maximum amount of memory a process
5761 Maximum number of kqueues allocated for this process.
5764 Maximum number of locks for this user.
5767 Maximum number of bytes in POSIX mqueues for this user.
5770 Maximum nice priority the user is allowed to raise mapped from [19...-20]
5771 to [0...39] for this user.
5774 Maximum number of simultaneous processes for this user id.
5777 Maximum realtime priority for this user.
5780 Timeout for RT tasks in microseconds for this user.
5783 Maximum number of pending signals for this user.
5786 Maximum number of simultaneous threads (lightweight processes) for this
5790 Maximum size which a process may lock into memory using
5794 Maximum amount of physical memory a process
5795 may have allocated to it at a given time.
5798 Maximum number of POSIX advisory locks for this user.
5800 .It Ic pseudoterminals
5801 Maximum number of pseudo-terminals for this user.
5804 Maximum size of socket buffer usage for this user.
5807 Maximum size of the automatically-extended stack region.
5810 Maximum amount of swap space reserved or used for this user.
5813 Maximum number of threads for this process.
5816 Maximum amount of virtual memory a process
5817 may have allocated to it at a given time (address space).
5822 may be given as a (floating point or
5823 integer) number followed by a scale factor.
5827 the default scale is
5831 (1024 bytes); a scale factor of
5842 the default scaling is
5848 for hours, or a time of the
5850 .Sq Ar mm Ns Li : Ns Ar ss
5851 giving minutes and seconds may be used.
5857 then the limitation on the specified
5859 is removed (this is equivalent to the
5865 names and scale factors, unambiguous
5866 prefixes of the names suffice.
5871 shell variable and reports on each user indicated
5874 who is logged in, regardless of when they last logged in.
5879 Terminates a login shell, replacing it with an instance of
5881 This is one way to log off, included for
5886 Terminates a login shell.
5887 Especially useful if
5892 .Op Fl Ar switch No \&...
5893 .Op Ar file No \&...
5899 It identifies each type of
5900 special file in the listing with a special character:
5902 .Bl -tag -width 5n -offset indent -compact
5912 Named pipe (systems with named pipes only).
5914 Socket (systems with sockets only).
5916 Symbolic link (systems with symbolic links only).
5918 Hidden directory (AIX only) or context dependent (HP/UX only).
5920 Network special (HP/UX only).
5925 shell variable is set, symbolic links are identified
5926 in more detail (on only systems that have them, of course):
5928 .Bl -tag -width 5n -offset indent -compact
5930 Symbolic link to a non-directory.
5932 Symbolic link to a directory.
5934 Symbolic link to nowhere.
5940 and causes partitions holding
5941 files pointed to by symbolic links to be mounted.
5945 shell variable is set to
5951 combination thereof (e.g.,
5953 they are used as flags to
5972 in which case it acts like
5975 passes its arguments to
5977 if it is given any switches,
5980 generally does the right thing.
5984 builtin can list files using different colors depending on the
5985 filetype or extension.
5988 shell variable and the
5990 environment variable.
5993 .Bl -tag -width 8n -compact
5997 .Ar pid Ns | Ns Cm % Ns Ar jobid No \&... (+)
5999 .It Ic migrate Fl Ar site No (+)
6000 The first form migrates the process or job to the site specified or the
6001 default site determined by the system path.
6004 The second form is equivalent to
6005 .Ql migrate \- Ns Ar site Li $$ :
6007 current process to the specified site.
6009 itself can cause unexpected behavior, because the shell
6010 does not like to lose its tty.
6015 .It Ic newgrp Oo Cm \- Oc Oo Ar group Oc No (+)
6020 Available only if the shell was so compiled;
6025 .It Ic nice Oo Cm + Ns Ar number Oc Op Ar command
6026 Sets the scheduling priority for the shell to
6041 The super-user may specify negative
6043 .Ql nice \- Ns Ar number Li \&... .
6045 executed in a sub-shell, and the restrictions placed on
6050 .It Ic nohup Op Ar command
6055 such that it will ignore hangup signals.
6056 Note that commands may set their own response to hangups, overriding
6058 Without an argument, causes the non-interactive shell only to
6059 ignore hangups for the remainder of the script.
6066 .It Ic notify Op Cm % Ns Ar job No \&...
6067 Causes the shell to notify the user asynchronously when the status of any
6068 of the specified jobs (or, without
6070 the current job) changes,
6071 instead of waiting until the next prompt as is usual.
6073 may be a number, a string,
6085 .It Ic onintr Op Cm \- Ns | Ns Ar label
6086 Controls the action of the shell on interrupts.
6088 restores the default action of the shell on interrupts,
6089 which is to terminate shell scripts or to return to the
6090 terminal command input level.
6093 causes all interrupts to be ignored.
6096 causes the shell to execute a
6098 when an interrupt is received or a child process terminates because it was
6102 is ignored if the shell is running detached and in system
6105 where interrupts are disabled anyway.
6110 .Op Fl n Ns | Ns Fl v
6113 Without arguments, pops the directory stack and returns to the new top directory.
6118 th entry in the stack.
6120 Finally, all forms of
6122 print the final directory stack,
6127 shell variable can be set to
6128 prevent this and the
6130 flag can be given to override
6137 flags have the same effect on
6143 .It Ic printenv Oo Ar name Oc No (+)
6144 Prints the names and values of all environment variables or,
6147 the value of the environment variable
6153 .Op Fl n Ns | Ns Fl v
6154 .Op Ar name Ns | Ns Cm + Ns Ar n
6156 Without arguments, exchanges the top two elements of the directory stack.
6161 without arguments does
6168 pushes the current working directory onto the directory
6169 stack and changes to
6175 it is interpreted as the previous working directory
6177 .Sx Filename substitution ) .
6183 removes any instances of
6185 from the stack before pushing it onto the stack.
6192 directory stack around to be the top element and changes to it.
6200 directory, pushes it onto the top of the stack and changes to it.
6203 Finally, all forms of
6205 print the final directory stack,
6210 shell variable can be set to
6211 prevent this and the
6213 flag can be given to override
6220 flags have the same effect on
6227 Causes the internal hash table of the contents of the
6230 variable to be recomputed.
6234 shell variable is not set and new
6235 commands are added to directories in
6237 while you are logged
6241 a new command will be found
6242 automatically, except in the special case where another command of
6243 the same name which is located in a different directory already
6244 exists in the hash table.
6245 Also flushes the cache of home directories
6246 built by tilde expansion.
6248 .It Ic repeat Ar count Ar command
6251 which is subject to the same restrictions as the
6255 statement above, is executed
6258 I/O redirections occur exactly once, even if
6262 .It Ic rootnode Cm // Ns Ar nodename No (+)
6263 Changes the rootnode to
6264 .Pa // Ns Ar nodename ,
6269 .Ql // Ns Ar nodename .
6274 .Bl -tag -width 8n -compact
6279 .Ar hh Ns Cm : Ns Ar mm
6283 .It Ic sched Cm \- Ns Ar n No (+)
6284 The first form prints the scheduled-event list.
6287 shell variable may be set to define the format in which
6288 the scheduled-event list is printed.
6290 The second form adds
6292 to the scheduled-event list.
6294 .Bd -literal -offset indent
6295 > sched 11:00 echo It\e's eleven o\e'clock.
6298 causes the shell to echo
6299 .Sq It's eleven o'clock.
6301 The time may be in 12-hour AM/PM format
6302 .Bd -literal -offset indent
6304 > sched 5pm set prompt='[%h] It\e's after 5; go home: >'
6307 or may be relative to the current time:
6308 .Bd -literal -offset indent
6309 > sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
6312 A relative time specification may not use AM/PM format.
6314 The third form removes item
6316 from the event list:
6317 .Bd -literal -offset indent
6319 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
6320 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: >
6323 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico \-r1 \-sother
6326 A command in the scheduled-event list is executed just before the first
6327 prompt is printed after the time when the command is scheduled.
6328 It is possible to miss the exact time when the command is to be run, but
6329 an overdue command will execute at the next prompt.
6330 A command which comes due while the shell
6331 is waiting for user input is executed immediately.
6332 However, normal operation of an already-running command will not
6333 be interrupted so that a scheduled-event list element may be run.
6335 This mechanism is similar to, but not the same as, the
6337 command on some Unix systems.
6338 Its major disadvantage is that it may not run a command at exactly the
6340 Its major advantage is that because
6343 the shell, it has access to shell variables and other structures.
6344 This provides a mechanism for changing one's working environment
6345 based on the time of day.
6347 .\" adjacant multi-tag items; add a blank
6351 .It Ic set Ar name No \&...
6352 .It Ic set Ar name Ns Cm = Ns Ar word No \&...
6355 .Op Fl f Ns | Ns Fl l
6356 .Ar name Ns Cm =\&( Ns Ar wordlist Ns Cm \&) No \&...
6359 .It Ic set Ar name Ns Cm [ Ns Ar index Ns Cm ]= Ns Ar word No \&...
6360 .It Ic set Fl r No (+)
6361 .It Ic set Fl r Ar name No \&... No (+)
6362 .It Ic set Fl r Ar name Ns Cm = Ns Ar word No \&... No (+)
6363 The first form of the command prints the value of all shell variables.
6364 Variables which contain more than a single word print as a
6365 parenthesized word list.
6367 The second form sets
6376 The fourth form sets
6378 to the list of words in
6381 In all cases the value is command and filename expanded.
6384 is specified, the value is set read-only.
6389 are specified, set only unique words keeping their order.
6391 prefers the first occurrence of a word, and
6395 The fifth form sets the
6401 this component must already exist.
6403 The sixth form lists only the names of all shell variables that are read-only.
6405 The seventh form makes
6407 read-only, whether or not it has a value.
6409 The eighth form is the same as the third form, but
6412 read-only at the same time.
6414 These arguments can be repeated to set and/or make read-only multiple variables
6415 in a single set command.
6416 Note, however, that variable expansion
6417 happens for all arguments before any setting occurs.
6425 or separated from both by
6426 whitespace, but cannot be adjacent to only one or the other.
6434 .It Ic setenv Op Ar name Op Ar value
6435 Without arguments, prints the names and values of all environment variables.
6438 sets the environment variable
6446 .It Ic setpath Ar path No (+)
6451 .It Ic setspath Cm LOCAL Ns | Ns Ar site Ns | Ns Ar cpu No \&... No (+)
6452 Sets the system execution path.
6455 .It Ic settc Ar cap value No (+)
6456 Tells the shell to believe that the terminal capability
6462 No sanity checking is done.
6463 Concept terminal users may have to
6466 wrapping at the rightmost column.
6469 .Op Fl d Ns | Ns Fl q Ns | Ns Fl x
6471 .Op Oo Cm + Ns | Ns Cm \- Oc Ns Ar mode
6474 Controls which tty modes (see
6475 .Sx Terminal management )
6476 the shell does not allow to change.
6489 set of tty modes respectively; without
6497 Without other arguments,
6499 lists the modes in the chosen set
6501 .Pq Sq Cm + Ns Ar mode
6503 .Pq Sq Cm - Ns Ar mode .
6504 The available modes, and thus the display, vary from system to system.
6507 lists all tty modes in the chosen set
6508 whether or not they are fixed.
6517 or removes control from
6521 .Ql setty +echok echoe
6524 mode on and allows commands
6527 mode on or off, both when the shell is executing commands.
6529 .It Ic setxvers Oo Ar string Oc No (+)
6530 Set the experimental version prefix to
6538 .It Ic shift Op Ar variable
6539 Without arguments, discards
6541 and shifts the members of
6546 not to be set or to have
6547 less than one word as value.
6554 .It Ic source Oo Fl h Oc Ar name Op Ar args No \&...
6555 The shell reads and executes commands from
6557 The commands are not placed on the history list.
6560 are given, they are placed in
6564 commands may be nested;
6565 if they are nested too deeply the shell may run out of file descriptors.
6568 at any level terminates all nested
6573 commands are placed on the history list instead of being
6577 .It Ic stop % Ns Ar job Ns | Ns Ar pid No \&...
6578 Stops the specified jobs or processes which are executing in the background.
6580 may be a number, a string,
6596 Causes the shell to stop in its tracks, much as if it had
6597 been sent a stop signal with
6599 This is most often used to
6600 stop shells started by
6605 .Bl -tag -width 8n -compact
6607 .It Ic switch Cm \&( Ns Ar string Ns Cm \&)
6608 .It Ic case Ar str1 Ns :
6609 .It Ic \ \ \ \ \&...
6610 .It Ic \ \ \ \ breaksw
6613 .It Ic \ \ \ \ \&...
6614 .It Ic \ \ \ \ breaksw
6616 Each case label is successively matched, against the
6619 which is first command and filename expanded.
6620 The file metacharacters
6626 in the case labels, which are variable expanded.
6628 of the labels match before a
6630 label is found, then
6631 the execution begins after the
6637 label must appear at the beginning of
6641 causes execution to continue
6644 Otherwise control may fall through case
6645 labels and default labels as in C.
6646 If no label matches and
6647 there is no default, execution continues after the
6653 .It Ic telltc No (+)
6654 Lists the values of all terminal capabilities (see
6657 .It Ic termname Oo Ar termtype Oc No (+)
6660 (or the current value of
6664 is given) has an entry in the hosts
6668 database. Prints the terminal type to stdout and returns 0
6669 if an entry is present otherwise returns 1.
6671 .It Ic time Op Ar command
6674 (which must be a simple command, not an alias,
6675 a pipeline, a command list or a parenthesized command list)
6676 and prints a time summary as described under the
6679 If necessary, an extra shell is created to print the time statistic when
6680 the command completes.
6683 prints a time summary for the current shell and its
6686 .It Ic umask Op Ar value
6687 Sets the file creation mask to
6689 which is given in octal.
6690 Common values for the mask are
6691 002, giving all access to the group and read and execute access to others, and
6692 022, giving read and execute access to the group and others.
6695 prints the current file creation mask.
6697 .It Ic unalias Ar pattern
6698 Removes all aliases whose names match
6701 thus removes all aliases.
6702 It is not an error for nothing to be
6706 .It Ic uncomplete Ar pattern No (+)
6707 Removes all completions whose names match
6710 thus removes all completions.
6711 It is not an error for nothing to be
6716 Disables use of the internal hash table to speed location of
6719 .It Ic universe Ar universe No (+)
6720 Sets the universe to
6724 .It Ic unlimit Oo Fl hf Oc Op Ar resource
6725 Removes the limitation on
6735 the corresponding hard limits are removed.
6736 Only the super-user may do this.
6739 may not exit successful, since most systems
6747 .It Ic unset Ar pattern
6748 Removes all variables whose names match
6750 unless they are read-only.
6752 thus removes all variables unless they are read-only;
6754 It is not an error for nothing to be
6757 .It Ic unsetenv Ar pattern
6758 Removes all environment variables whose names match
6761 thus removes all environment variables;
6763 It is not an error for nothing to be
6767 .It Ic ver Oo Ar systype Oo Ar command Oc Oc No (+)
6768 Without arguments, prints
6792 The shell waits for all background jobs.
6793 If the shell is interactive, an
6794 interrupt will disrupt the wait and cause the shell to print the names and job
6795 numbers of all outstanding jobs.
6797 .It Ic warp Ar universe No (+)
6798 Sets the universe to
6802 .It Ic watchlog No (+)
6803 An alternate name for the
6805 builtin command (q.v.).
6806 Available only if the shell was so compiled;
6811 .It Ic where Ar command No (+)
6812 Reports all known instances of
6814 including aliases, builtins and
6818 .It Ic which Ar command No (+)
6819 Displays the command that will be executed by the shell after substitutions,
6822 The builtin command is just like
6824 but it correctly reports
6826 aliases and builtins and is 10 to 100 times faster.
6833 .Bl -tag -width 8n -compact
6836 .It Ic while Cm \&( Ns Ar expr Ns Cm \&)
6839 Executes the commands between the
6845 (an expression, as described under
6851 must appear alone on their input lines.
6855 may be used to terminate or continue the
6857 If the input is a terminal, the user is prompted the first time
6858 through the loop as with
6862 .Ss "Special aliases (+)"
6863 If set, each of these aliases executes automatically at the indicated time.
6864 They are all initially undefined.
6866 Supported special aliases are:
6871 Runs when the shell wants to ring the terminal bell.
6874 Runs after every change of working directory.
6875 For example, if the user is
6876 working on an X window system using
6878 and a re-parenting window
6879 manager that supports title bars such as
6882 .Bd -literal -offset indent
6883 > alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd ^G"'
6886 then the shell will change the title of the running
6888 to be the name of the host, a colon, and the full current working directory.
6889 A fancier way to do that is
6890 .Bd -literal -offset indent
6891 > alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
6894 This will put the hostname and working directory on the title bar but
6895 only the hostname in the icon manager menu.
6904 may cause an infinite loop.
6905 It is the author's opinion that anyone doing
6906 so will get what they deserve.
6909 Runs before each command gets executed, or when the command changes state.
6912 but it does not print builtins.
6913 .Bd -literal -offset indent
6914 > alias jobcmd 'echo \-n "^[]2\e;\e!#:q^G"'
6919 will put the command string in the xterm title bar.
6925 The command name for which help
6926 is sought is passed as sole argument.
6927 For example, if one does
6928 .Bd -literal -offset indent
6929 > alias helpcommand '\e!:1 --help'
6932 then the help display of the command itself will be invoked, using the GNU
6933 help calling convention.
6934 Currently there is no easy way to account for various calling conventions (e.g.,
6937 except by using a table of many commands.
6943 This provides a convenient means for
6944 checking on common but infrequent changes such as new mail.
6947 .Bd -literal -offset indent
6949 > alias periodic checknews
6954 program runs every 30 minutes.
6959 is unset or set to 0,
6965 Runs just before each prompt is printed.
6966 For example, if one does
6967 .Bd -literal -offset indent
6973 runs just before the shell prompts for each command.
6974 There are no limits on what
6976 can be set to do, but discretion
6980 Runs before each command gets executed.
6981 .Bd -literal -offset indent
6982 > alias postcmd 'echo \-n "^[]2\e;\e!#:q^G"'
6987 will put the command string in the xterm title bar.
6990 Specifies the interpreter for executable scripts which do not themselves
6991 specify an interpreter.
6992 The first word should be a full path name to the
6993 desired interpreter (e.g.,
6996 .Ql /usr/local/bin/tcsh ) .
7000 .Ss "Special shell variables"
7001 The variables described in this section have special meaning to the shell.
7030 startup; they do not change thereafter unless changed by the user.
7042 The shell synchronizes
7050 with the environment variables of the same names:
7051 whenever the environment variable changes the shell changes the corresponding
7052 shell variable to match (unless the shell variable is read-only) and vice
7058 have identical meanings, they
7059 are not synchronized in this manner, and that the shell automatically
7060 converts between the different formats of
7066 Supported special shell variables are:
7070 .It Ic addsuffix No (+)
7071 If set, filename completion adds
7073 to the end of directories and a space
7074 to the end of normal files when they are matched exactly.
7077 .It Ic afsuser No (+)
7080 \&'s autolock feature uses its value instead of
7081 the local username for kerberos authentication.
7084 If set, all times are shown in 12-hour AM/PM format.
7086 .It Ic anyerror No (+)
7087 This variable selects what is propagated to the value of the
7089 variable. For more information see the description of the
7094 The arguments to the shell.
7095 Positional parameters are taken from
7102 Set by default, but usually empty in interactive shells.
7104 .It Ic autocorrect No (+)
7107 editor command is invoked automatically before
7108 each completion attempt.
7110 .It Ic autoexpand No (+)
7113 editor command is invoked automatically
7114 before each completion attempt. If this is set to
7117 only history will be expanded and a second completion will expand filenames.
7119 .It Ic autolist No (+)
7120 If set, possibilities are listed after an ambiguous completion.
7123 possibilities are listed only when no new
7124 characters are added by completion.
7126 .It Ic autologout No (+)
7127 The first word is the number of minutes of inactivity before automatic
7129 The optional second word is the number of minutes of inactivity
7130 before automatic locking.
7131 When the shell automatically logs out, it prints
7139 When the shell automatically locks, the user is required to enter their password
7140 to continue working.
7141 Five incorrect attempts result in automatic logout.
7144 (automatic logout after 60 minutes, and no locking) by default
7145 in login and superuser shells, but not if the shell thinks it is running
7146 under a window system (i.e., the
7148 environment variable is set),
7149 the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
7156 to disable automatic logout.
7163 .It Ic autorehash No (+)
7164 If set, the internal hash table of the contents of the directories in the
7166 variable will be recomputed if a command is not found in the hash
7168 In addition, the list of available commands will be rebuilt for each
7169 command completion or spelling correction attempt if set to
7173 respectively; if set to
7175 this will be done for both
7178 .It Ic backslash_quote No (+)
7180 If set, backslashes (`\e') always quote
7186 complex quoting tasks easier, but it can cause syntax errors in
7191 The file name of the message catalog.
7196 as a message catalog instead of
7201 A list of directories in which
7204 subdirectories if they aren't found in the current directory.
7206 .It Ic cdtohome No (+)
7209 requires a directory
7211 and will not go to the
7213 directory if it's omitted.
7214 This is set by default.
7217 If set, it enables color display for the builtin
7223 Alternatively, it can be set to only
7227 to enable color to only one command.
7229 it to nothing is equivalent to setting it to
7233 If set, it enables color escape sequence for NLS message files.
7234 And display colorful NLS messages.
7236 .It Ic command No (+)
7237 If set, the command which was passed to the shell with the
7241 .It Ic compat_expr No (+)
7242 If set, the shell will evaluate expressions right to left, like the original
7245 .It Ic complete No (+)
7248 the completion becomes case insensitive.
7251 completion ignores case and considers
7252 hyphens and underscores to be equivalent; it will also treat
7253 periods, hyphens and underscores
7264 completion matches uppercase and underscore
7265 characters explicitly and matches lowercase and hyphens in a
7266 case-insensitive manner; it will treat periods, hyphens and underscores
7269 .It Ic continue No (+)
7270 If set to a list of commands, the shell will continue the listed
7271 commands, instead of starting a new one.
7273 .It Ic continue_args No (+)
7274 Same as continue, but the shell will execute:
7275 .Bd -literal -offset indent
7276 echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
7279 .It Ic correct No (+)
7282 commands are automatically spelling-corrected.
7285 commands are automatically completed.
7288 the entire command line is corrected.
7290 .It Ic csubstnonl No (+)
7291 If set, newlines and carriage returns in command substitution are
7296 The full pathname of the current directory.
7303 .It Ic dextract No (+)
7308 th directory from the directory
7309 stack rather than rotating it to the top.
7311 .It Ic dirsfile No (+)
7312 The default location in which
7323 is normally sourced before
7331 .It Ic dirstack No (+)
7332 An array of all the directories on the directory stack.
7334 is the current working directory,
7336 the first directory on the stack, etc.
7337 Note that the current working directory is
7342 directory stack substitutions, etc.
7343 One can change the stack arbitrarily by setting
7345 but the first element (the current working directory) is always correct.
7352 .It Ic dspmbyte No (+)
7353 Has an effect only if
7355 is listed as part of the
7360 it enables display and editing EUC-kanji(Japanese) code.
7363 it enables display and editing Shift-JIS(Japanese) code.
7366 it enables display and editing Big5(Chinese) code.
7369 it enables display and editing Utf8(Unicode) code.
7370 If set to the following format, it enables display and editing of original
7371 multi-byte code format:
7372 .Bd -literal -offset indent
7373 > set dspmbyte = 0000....(256 bytes)....0000
7379 Each character of 256 characters
7380 corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
7383 .\" (position in this table?)
7384 is set to number 0,1,2 and 3.
7385 Each number has the following meaning:
7386 .Bl -tag -width 3n -offset indent -compact
7388 Not used for multi-byte characters.
7390 Used for the first byte of a multi-byte character.
7392 Used for the second byte of a multi-byte character.
7394 Used for both the first byte and second byte of a multi-byte character.
7396 .\" SHK: I tried my best to get the following to be grammatically correct.
7397 .\" However, I still don't understand what's going on here. In the
7398 .\" following example, there are three bytes, but the text seems to refer to
7399 .\" each nybble as a character. What's going on here? It this 3-byte code
7400 .\" in the table? The text above seems to imply that there are 256
7401 .\" characters/bytes in the table. If I get some more info on this (perhaps
7402 .\" a complete example), I could fix the text to be grammatically correct.
7403 .\" (steve.kelem@xilinx.com 1999/09/13)
7409 the first character (means 0x00 of the ASCII code) and
7410 second character (means 0x01 of ASCII code) are set to
7413 used for multi-byte characters.
7414 The 3rd character (0x02) is set to
7416 indicating that it is used for the first byte of a multi-byte character.
7417 The 4th character (0x03) is set
7419 It is used for both the first byte and
7420 the second byte of a multi-byte character.
7421 The 5th and 6th characters
7422 (0x04,0x05) are set to
7424 indicating that they are used for the second
7425 byte of a multi-byte character.
7427 The GNU fileutils version of ls cannot display multi-byte
7428 filenames without the
7433 this version, set the second word of dspmbyte to
7438 cannot display multi-byte filenames.
7442 This variable can only be used if KANJI and DSPMBYTE has been defined at
7445 .It Ic dunique No (+)
7448 removes any instances of
7450 from the stack before pushing it onto the stack.
7453 If set, each command with its arguments is echoed just before it is
7455 For non-builtin commands all expansions occur before
7457 Builtin commands are echoed before command and filename
7458 substitution, because these substitutions are then done selectively.
7461 command line option.
7463 .It Ic echo_style No (+)
7469 .Bl -tag -width 4n -offset indent -compact
7471 Don't echo a newline if the first argument is
7477 Recognize backslashed escape sequences in echo strings.
7482 flag and backslashed escape sequences; the default
7490 Set by default to the local system default.
7491 The BSD and System V
7492 options are described in the
7494 man pages on the appropriate
7498 If set, the command-line editor is used.
7499 Set by default in interactive
7502 .It Ic editors No (+)
7503 A list of command names for the
7505 editor command to match.
7513 environment variables will be used instead.
7515 .It Ic ellipsis No (+)
7521 prompt sequences (see the
7523 shell variable) indicate skipped directories with an ellipsis
7526 .Ql /< Ns Ar skipped Ns Li > .
7529 The user's effective user ID.
7532 The first matching passwd entry name corresponding to the effective user ID.
7534 .It Ic fignore No (+)
7535 Lists file name suffixes to be ignored by completion.
7540 completion is always used and this variable is ignored
7543 is unset, then the traditional
7548 filename completion is used.
7551 The user's real group ID.
7553 .It Ic globdot No (+)
7554 If set, wild-card glob patterns will match files and directories beginning
7562 .It Ic globstar No (+)
7567 file glob patterns will match any string of
7568 characters including
7570 traversing any existing sub-directories.
7573 will list all the .c files in the current directory tree).
7574 If used by itself, it will match zero or more sub-directories
7576 .Ql ls /usr/include/**/time.h
7577 will list any file named
7581 directory tree; whereas
7582 .Ql ls /usr/include/**time.h
7583 will match any file in the
7585 directory tree ending in
7587 To prevent problems with recursion, the
7589 glob-pattern will not
7590 descend into a symbolic link containing a directory.
7596 The user's group name.
7599 If set, the incremental search match (in
7603 and the region between the mark and the cursor are
7604 highlighted in reverse video.
7606 Highlighting requires more frequent terminal writes, which introduces extra
7607 overhead. If you care about terminal performance, you may want to leave this
7611 A string value determining the characters used in
7612 .Sx History substitution
7614 The first character of its value is used as
7615 the history substitution character, replacing the default character
7617 The second character of its value replaces the character
7620 quick substitutions.
7622 .It Ic histdup No (+)
7623 Controls handling of duplicate entries in the history list.
7626 only unique history events are entered in the history list.
7630 and the last history event is the same as the current
7631 command, then the current command is not entered in the history.
7635 and the same event is found in the history list, that
7636 old event gets erased and the current one gets inserted.
7641 options renumber history events so there are no gaps.
7643 .It Ic histfile No (+)
7644 The default location in which
7655 useful when sharing the same home directory between different machines,
7656 or when saving separate histories on different terminals.
7659 is normally sourced before
7667 .It Ic histlit No (+)
7668 If set, builtin and editor commands and the
7671 use the literal (unexpanded) form of lines in the history list.
7674 .Ic toggle-literal-history
7678 The first word indicates the number of history events to save.
7680 optional second word (+) indicates the format in which history is
7681 printed; if not given,
7684 The format sequences
7685 are described below under
7687 note the variable meaning of
7694 Initialized to the home directory of the invoker.
7698 refers to this variable.
7701 If set to the empty string or
7703 and the input device is a terminal,
7706 command (usually generated by the user by typing
7708 on an empty line) causes the shell to print
7709 .Ql Use \&"exit\&" to leave tcsh.
7711 This prevents the shell from accidentally
7713 Historically this setting exited after 26 successive
7714 EOF's to avoid infinite loops.
7728 is used, i.e., the shell exits on a
7732 .It Ic implicitcd No (+)
7733 If set, the shell treats a directory name typed as a command as though
7734 it were a request to change to that directory.
7737 the change of directory is echoed to the standard output.
7739 is inhibited in non-interactive shell scripts, or for command strings
7740 with more than one word.
7741 Changing directory takes precedence over
7742 executing a like-named command, but it is done after alias
7744 Tilde and variable expansions work as expected.
7746 .It Ic inputmode No (+)
7751 puts the editor into that input mode
7752 at the beginning of each line.
7754 .It Ic killdup No (+)
7755 Controls handling of duplicate entries in the kill ring.
7758 only unique strings are entered in the kill ring.
7761 and the last killed string is the same as the current killed
7762 string, then the current string is not entered in the ring.
7766 and the same string is found in the kill ring, the old
7767 string is erased and the current one is inserted.
7769 .It Ic killring No (+)
7770 Indicates the number of killed strings to keep in memory.
7774 If unset or set to less than
7777 keep the most recently killed string.
7778 Strings are put in the killring by the editor commands that delete
7779 (kill) strings of text, e.g.
7780 .Ic backward-delete-word ,
7783 .Ic copy-region-as-kill
7787 editor command will yank the most recently killed string
7788 into the command-line, while
7791 .Sx Editor commands )
7792 can be used to yank earlier killed strings.
7794 .It Ic listflags No (+)
7800 or any combination thereof (e.g.,
7802 they are used as flags to
7808 or a combination (e.g.,
7812 files (even if they start with a
7821 sorts across instead of down.
7822 If the second word of
7824 is set, it is used as the path to
7827 .It Ic listjobs No (+)
7828 If set, all jobs are listed when a job is suspended.
7831 the listing is in long format.
7833 .It Ic listlinks No (+)
7836 builtin command shows the type of file to which
7837 each symbolic link points.
7839 .It Ic listmax No (+)
7840 The maximum number of items which the
7843 will list without asking first.
7845 .It Ic listmaxrows No (+)
7846 The maximum number of rows of items which the
7849 command will list without asking first.
7851 .It Ic loginsh No (+)
7852 Set by the shell if it is a login shell.
7853 Setting or unsetting it
7854 within a shell has no effect.
7858 .It Ic logout No (+)
7861 before a normal logout,
7864 an automatic logout, and
7866 if the shell was killed by a hangup
7868 .Sx Signal handling ) .
7874 A list of files and directories to check for incoming mail, optionally
7875 preceded by a numeric word.
7876 Before each prompt, if 10 minutes have
7877 passed since the last check, the shell checks each file and displays
7878 .Sq You have new mail.
7881 contains multiple files,
7882 .Sq You have new mail in Ar name Ns \&. )
7883 if the filesize is greater than zero in size
7884 and has a modification time greater than its access time.
7886 If you are in a login shell, then no mail file is reported unless it has
7887 been modified after the time the shell has started up, to prevent
7888 redundant notifications.
7889 Most login programs will tell you whether or not
7890 you have mail when you log in.
7892 If a file specified in
7894 is a directory, the shell will count each
7895 file within that directory as a separate message, and will report
7896 .Sq You have Ar n No mails.
7898 .Sq You have Ar n No mails in Ar name Ns No \&.
7900 This functionality is provided primarily for those systems which store mail
7901 in this manner, such as the Andrew Mail System.
7903 If the first word of
7905 is numeric it is taken as a different mail
7906 checking interval, in seconds.
7908 Under very rare circumstances, the shell may report
7912 .Sq You have new mail.
7914 .It Ic matchbeep No (+)
7917 completion never beeps.
7920 it beeps only when there is no match.
7923 it beeps when there are multiple matches.
7926 it beeps when there is one exact and other longer matches.
7931 .It Ic nobeep No (+)
7932 If set, beeping is completely disabled.
7937 If set, restrictions are placed on output redirection to insure that files
7938 are not accidentally destroyed and that
7940 redirections refer to existing
7941 files, as described in the
7946 an interacive confirmation is presented, rather than an
7951 is allowed on empty files.
7954 If set, disable the printing of
7959 specifiers at the change of hour.
7963 .Sx Filename substitution
7965 .Sx Directory stack substitution
7966 (q.v.) are inhibited.
7967 This is most useful in shell scripts which do not deal
7968 with filenames, or after a list of filenames has been obtained and further
7969 expansions are not desirable.
7971 .It Ic nokanji No (+)
7972 If set and the shell supports Kanji (see the
7975 it is disabled so that the meta key can be used.
7979 .Sx Filename substitution
7981 .Sx Directory stack substitution
7982 (q.v.) which does not match any
7983 existing files is left untouched rather than causing an error.
7984 It is still an error for the substitution to be
7987 still gives an error.
7989 .It Ic nostat No (+)
7990 A list of directories (or glob-patterns which match directories; see
7991 .Sx Filename substitution )
7995 completion operation.
7996 This is usually used to exclude directories which
7997 take too much time to
8003 If set, the shell announces job completions asynchronously.
8004 The default is to present job completions just before printing a prompt.
8007 The user's real organization ID.
8011 The old working directory, equivalent to the
8024 If set, enable the printing of padding '0' for hours, in 24 and 12 hour
8032 To retain compatibily with older versions numeric variables starting with
8033 0 are not interpreted as octal. Setting this variable enables proper octal
8037 A list of directories in which to look for executable commands.
8038 A null word specifies the current directory.
8041 variable then only full path names will execute.
8043 is set by the shell at startup from the
8048 does not exist, to a system-dependent default
8050 .Ql (/usr/local/bin /usr/bsd /bin /usr/bin .) .
8056 depending on how it was compiled; see the
8059 A shell which is given neither the
8064 hashes the contents of the directories in
8072 If one adds a new command to a directory in
8075 is active, one may need to do a
8077 for the shell to find it.
8079 .It Ic printexitvalue No (+)
8080 If set and an interactive program exits with a non-zero status, the shell
8082 .Sq Exit Ar status .
8085 The string which is printed before reading each command from the terminal.
8088 may include any of the following formatting sequences (+), which
8089 are replaced by the given information:
8091 .Bl -tag -width 4n -offset indent -compact
8094 The current working directory.
8097 The current working directory, but with one's home directory
8100 and other users' home directories represented by
8103 .Sx Filename substitution .
8106 happens only if the shell has already used
8109 in the current session.
8112 .Li %c[[0] Ns Ar n Ns Li ] ,
8113 .Li %.[[0] Ns Ar n Ns Li ]
8115 The trailing component of the current working directory, or
8117 trailing components if a digit
8124 the number of skipped components precede
8125 the trailing component(s) in the format
8126 .Ql /< Ns Ar skipped Ns Li >trailing .
8129 shell variable is set, skipped components
8130 are represented by an ellipsis so the whole becomes
8133 substitution is done as in
8138 is ignored when counting trailing components.
8147 .It Li %h , %! , \&!
8148 The current history event number.
8154 The hostname up to the first
8157 .It Li \&%S Pq Li %s
8158 Start (stop) standout mode.
8160 .It Li \&%B Pq Li %b
8161 Start (stop) boldfacing mode.
8164 Start (stop) underline mode.
8167 The time of day in 12-hour AM/PM format.
8172 but in 24-hour format (but see the
8179 time of day in 12-hour AM/PM format, with seconds.
8184 but in 24-hour format (but see the
8206 The effective user name.
8245 Clears from the end of the prompt to end of the display or the end of the line.
8248 Expands the shell or environment variable name immediately after the
8253 (or the first character of the
8258 (or the second character of
8262 .It Li %{ Ns Ar string Ns Li %}
8265 as a literal escape sequence.
8266 It should be used only to change terminal attributes and
8267 should not move the cursor location.
8269 cannot be the last sequence in
8273 The return code of the command executed just before the prompt.
8278 the status of the parser.
8281 the corrected string.
8293 .Ql %{ Ns Ar string Ns Li %}
8294 are available in only
8295 eight-bit-clean shells; see the
8299 The bold, standout and underline sequences are often used to distinguish a
8303 .\" Using Bl not Bd to allow bold formatting in the second line
8304 .Bl -tag -offset indent -compact
8305 .It Li > set prompt = \&"%m [%h] \&%B[%@]%b [%/] you rang? \&"
8306 .It Li tut [37] Cm [2:54pm] Li [/usr/accts/sys] you rang? _
8321 on the change of hour (i.e,
8328 in interactive shells.
8330 .It Ic prompt2 No (+)
8331 The string with which to prompt in
8336 after lines ending in
8338 The same format sequences may be used as in
8341 note the variable meaning of
8345 in interactive shells.
8347 .It Ic prompt3 No (+)
8348 The string with which to prompt when confirming automatic spelling correction.
8349 The same format sequences may be used as in
8352 note the variable meaning of
8355 .Ql CORRECT>%R (y|n|e|a)?\ \&
8356 in interactive shells.
8358 .It Ic promptchars No (+)
8359 If set (to a two-character string), the
8361 formatting sequence in the
8363 shell variable is replaced with the first character for
8364 normal users and the second character for the superuser.
8366 .It Ic pushdtohome No (+)
8369 without arguments does
8374 .It Ic pushdsilent No (+)
8379 do not print the directory stack.
8381 .It Ic recexact No (+)
8382 If set, completion completes on an exact match even if a longer match is
8385 .It Ic recognize_only_executables No (+)
8386 If set, command listing displays only files in the path that are
8390 .It Ic rmstar No (+)
8391 If set, the user is prompted before
8395 .It Ic rprompt No (+)
8396 The string to print on the right-hand side of the screen (after
8397 the command input) when the prompt is being displayed on the left.
8398 It recognizes the same formatting characters as
8400 It will automatically disappear and reappear as necessary, to ensure that
8401 command input isn't obscured, and will appear only if the prompt,
8402 command input, and itself will fit together on the first line.
8407 will be printed after
8408 the prompt and before the command input.
8410 .It Ic savedirs No (+)
8411 If set, the shell does
8414 If the first word is set to a number, at most that many directory stack
8418 If set, the shell does
8421 If the first word is set to a number, at most that many lines are saved.
8422 (The number should be less than or equal to the number
8425 if it is set to greater than the number of
8429 entries will be saved.)
8430 If the second word is set to
8432 the history list is merged with
8433 the existing history file instead of replacing it (if there is one) and
8434 sorted by time stamp and the most recent events are retained.
8435 If the second word of
8439 and the third word is set to
8441 the history file update will be serialized with other shell sessions
8442 that would possibly like to merge history at exactly the same time. (+)
8445 The format in which the
8447 builtin command prints scheduled events;
8451 The format sequences are described above under
8453 note the variable meaning of
8457 The file in which the shell resides.
8458 This is used in forking
8459 shells to interpret files which have execute bits set, but
8460 which are not executable by the system.
8461 (See the description
8463 .Sx "Builtin and non-builtin command execution" . )
8465 (system-dependent) home of the shell.
8468 The number of nested shells.
8469 Reset to 1 in login shells.
8474 The exit status from the last command or backquote expansion, or any
8475 command in a pipeline is propagated to
8481 This default does not match what POSIX mandates (to return the
8482 status of the last command only). To match the POSIX behavior, you need
8488 variable is unset, the exit status of a pipeline
8489 is determined only from the last command in the pipeline, and the exit
8490 status of a backquote expansion is
8495 If a command terminated abnormally, then 0200 is added to the status.
8496 Builtin commands which fail return exit status
8499 commands return status
8502 .It Ic symlinks No (+)
8503 Can be set to several different values to control symbolic link
8509 whenever the current directory changes to a directory
8510 containing a symbolic link, it is expanded to the real name of the directory
8511 to which the link points.
8512 This does not work for the user's home directory;
8517 the shell tries to construct a current directory
8518 relative to the current directory before the link was crossed.
8521 ing through a symbolic link and then
8524 returns one to the original directory.
8525 This affects only builtin commands
8526 and filename completion.
8530 the shell tries to fix symbolic links by actually expanding
8531 arguments which look like path names.
8532 This affects any command, not just
8534 Unfortunately, this does not work for hard-to-recognize filenames,
8535 such as those embedded in command options.
8536 Expansion may be prevented by
8538 While this setting is usually the most convenient, it is sometimes
8539 misleading and sometimes confusing when it fails to recognize an argument
8540 which should be expanded.
8541 A compromise is to use
8546 (bound by default to
8550 Some examples are in order.
8551 First, let's set up some play directories:
8552 .Bd -literal -offset indent
8554 > mkdir from from/src to
8555 > ln \-s from/src to/dst
8558 Here's the behavior with
8561 .Bd -literal -offset indent
8562 > cd /tmp/to/dst; echo $cwd
8568 here's the behavior with
8572 .Bd -literal -offset indent
8573 > cd /tmp/to/dst; echo $cwd
8579 here's the behavior with
8583 .Bd -literal -offset indent
8584 > cd /tmp/to/dst; echo $cwd
8590 and here's the behavior with
8594 .Bd -literal -offset indent
8595 > cd /tmp/to/dst; echo $cwd
8599 > cd /tmp/to/dst; echo $cwd
8601 > cd ".."; echo $cwd
8611 expansion 1) works just like
8616 2) is prevented by quoting, and 3) happens before
8617 filenames are passed to non-builtin commands.
8620 The version number of the shell in the format
8621 .Sq Ar R Ns No \&. Ns Ar VV Ns No \&. Ns Ar PP ,
8624 is the major release number,
8626 the current version,
8636 .Sx Startup and shutdown .
8639 If set to a number, then the
8641 builtin (q.v.) executes automatically
8642 after each command which takes more than that many CPU seconds.
8643 If there is a second word, it is used as a format string for the output
8648 (u) The following sequences may be used in the
8652 .Bl -tag -width 4n -offset indent -compact
8655 The time the process spent in user mode in cpu seconds.
8658 The time the process spent in kernel mode in cpu seconds.
8661 The elapsed (wall clock) time in seconds.
8664 The CPU percentage computed as (\&%U + \&%S) / \&%E.
8667 Number of times the process was swapped.
8670 The average amount in (shared) text space used in Kbytes.
8673 The average amount in (unshared) data/stack space used in Kbytes.
8676 The total space used (\&%X + \&%D) in Kbytes.
8679 The maximum memory the process had in use at any time in Kbytes.
8682 The number of major page faults (page needed to be brought from disk).
8685 The number of minor page faults.
8688 The number of input operations.
8691 The number of output operations.
8694 The number of socket messages received.
8697 The number of socket messages sent.
8700 The number of signals received.
8703 The number of voluntary context switches (waits).
8706 The number of involuntary context switches.
8710 Only the first four sequences are supported on systems without BSD resource
8712 The default time format is
8713 .Ql \&%Uu \&%Ss \&%E \&%P \&%X+%Dk \&%I+%Oio \&%Fpf+%Ww
8715 systems that support resource usage reporting and
8716 .Ql \&%Uu \&%Ss \&%E \&%P
8718 systems that do not.
8720 Under Sequent's DYNIX/ptx,
8728 available, but the following additional sequences are:
8730 .Bl -tag -width 4n -offset indent -compact
8733 The number of system calls performed.
8736 The number of pages which are zero-filled on demand.
8739 The number of times a process's resident set size was increased by the kernel.
8742 The number of times a process's resident set size was decreased by the kernel.
8745 The number of read system calls performed.
8748 The number of write system calls performed.
8751 The number of reads from raw disk devices.
8754 The number of writes to raw disk devices.
8758 and the default time format is
8759 .Ql \&%Uu \&%Ss \&%E \&%P \&%I+%Oio \&%Fpf+%Ww .
8760 Note that the CPU percentage can be higher than 100% on multi-processors.
8762 .It Ic tperiod No (+)
8763 The period, in minutes, between executions of the
8768 The name of the tty, or empty if not attached to one.
8771 The user's real user ID.
8774 The user's login name.
8777 If set, causes the words of each
8778 command to be printed, after history substitution (if any).
8781 command line option.
8783 .It Ic version No (+)
8784 The version ID stamp.
8785 It contains the shell's version number (see
8787 origin, release date, vendor, operating system and machine (see
8792 and a comma-separated
8793 list of options which were set at compile time.
8794 Options which are set by default in the distribution are noted.
8800 .Bl -tag -width 4n -offset indent -compact
8803 The shell is eight bit clean; default.
8806 The shell is not eight bit clean.
8809 The shell is multibyte encoding clean (like UTF-8).
8812 The system's NLS is used; default for systems with NLS.
8815 Login shells execute
8817 before instead of after
8821 before instead of after
8830 for security; default.
8840 \-style editing is the default rather than
8845 Login shells drop DTR when exiting.
8853 is an alternate name for
8858 is enabled; default.
8861 Kanji is used if appropriate according to locale settings,
8864 shell variable is set.
8873 .Ql #!<program> <args>
8874 convention is emulated when executing shell scripts.
8879 builtin is available.
8882 The shell attempts to set the
8884 environment variable.
8887 The shell verifies your password with the kerberos server if local
8888 authentication fails.
8891 shell variable or the
8893 environment variable override your local username if set.
8897 An administrator may enter additional strings to indicate differences
8898 in the local version.
8900 .It Ic vimode No (+)
8901 If unset, various key bindings change behavior to be more
8904 word boundaries are determined by
8906 versus other characters.
8908 If set, various key bindings change behavior to be more
8911 word boundaries are determined by
8914 versus other characters;
8915 cursor behavior depends upon current vi mode (command, delete, insert, replace).
8917 This variable is unset by
8923 may be explicitly set or unset by the user after those
8925 operations if required.
8927 .It Ic visiblebell No (+)
8928 If set, a screen flash is used rather than the audible bell.
8933 A list of user/terminal pairs to watch for logins and logouts.
8934 If either the user is
8936 all terminals are watched for the given user
8942 watches all users and terminals.
8944 .Bd -literal -offset indent
8945 set watch = (george ttyd1 any console $user any)
8948 reports activity of the user
8952 any user on the console, and
8953 oneself (or a trespasser) on any terminal.
8955 Logins and logouts are checked every 10 minutes by default, but the first
8958 can be set to a number to check every so many minutes.
8960 .Bd -literal -offset indent
8961 set watch = (1 any any)
8964 reports any login/logout once every minute.
8965 For the impatient, the
8967 builtin command triggers a
8971 are reported (as with the
8979 shell variable controls the format of
8984 The format string for
8987 The following sequences
8988 are replaced by the given information:
8990 .Bl -tag -width 4n -offset indent -compact
8993 The name of the user who logged in/out.
8996 The observed action, i.e.,
9000 .Sq replaced Ar olduser No on .
9003 The terminal (tty) on which the user logged in/out.
9006 The full hostname of the remote host, or
9008 if the login/logout was
9009 from the local host.
9012 The hostname of the remote host up to the first
9014 The full name is printed if it is an IP address or an X Window System display.
9021 are available on only systems that store the remote hostname in
9024 .Ql %n has %a %l from %m.
9028 which don't store the remote hostname.
9030 .It Ic wordchars No (+)
9031 A list of non-alphanumeric characters to be considered part of a word by the
9034 etc., editor commands.
9035 If unset, the default value is determined based on the state of
9041 is used as the default;
9046 is used as the default.
9053 .It Ev AFSUSER No (+)
9061 to the current command line when invoking programs
9070 .Sq Builtin commands .
9073 The number of columns in the terminal.
9075 .Sx Terminal management .
9078 Used by X Window System (see
9080 If set, the shell does not set
9085 The pathname to a default editor.
9088 editor command if the
9091 shell variable is unset.
9094 environment variable.
9107 Initialized to the name of the machine on which the shell
9108 is running, as determined by the
9112 .It Ev HOSTTYPE No (+)
9113 Initialized to the type of machine on which the shell
9114 is running, as determined at compile time.
9115 This variable is obsolete and
9116 will be removed in a future version.
9119 A colon-separated list of directories in which the
9122 command looks for command documentation.
9125 Gives the preferred character environment.
9127 .Sx Native Language System support .
9130 If set, only ctype character handling is changed.
9132 .Sx Native Language System support .
9135 The number of lines in the terminal.
9137 .Sx Terminal management .
9140 The format of this variable is reminiscent of the
9142 file format; a colon-separated list of expressions of the form
9143 .Li \&" Ns Ar xx Ns Li = Ns Ar string Ns Li \&" ,
9145 .Li \&" Ns Ar xx Ns Li \&"
9146 is a two-character variable name.
9149 variables with their associated defaults are:
9151 .Bl -column -offset indent "Li XX" "Li XXXXX" 20n
9153 .It Li no Ta Li 0 Ta Normal (non-filename) text.
9155 .It Li fi Ta Li 0 Ta Regular file.
9157 .It Li di Ta Li 01;34 Ta Directory.
9159 .It Li ln Ta Li 01;36 Ta Symbolic link.
9161 .It Li pi Ta Li 33 Ta Named pipe (FIFO).
9163 .It Li so Ta Li 01;35 Ta Socket.
9165 .It Li do Ta Li 01;35 Ta Door.
9167 .It Li bd Ta Li 01;33 Ta Block device.
9169 .It Li cd Ta Li 01;32 Ta Character device.
9171 .It Li ex Ta Li 01;32 Ta Executable file.
9173 .It Li mi Ta (none) Ta Missing file (defaults to Li fi Ns ) .
9175 .It Li or Ta (none) Ta Orphaned symbolic link (defaults to Li ln Ns ) .
9177 .It Li lc Ta Li ^[[ Ta Left code.
9179 .It Li rc Ta Li m Ta Right code.
9181 .It Li ec Ta (none) Ta End code (replaces Li lc Ns + Ns Li no Ns + Ns Li rc Ns ) .
9185 You need to include only the variables you want to change from
9188 File names can also be colorized based on filename extension.
9189 This is specified in the
9191 variable using the syntax
9192 .Li \&"* Ns Ar ext Ns Li = Ns Ar string Ns Li \&" .
9193 For example, using ISO 6429 codes, to color
9194 all C\-language source files blue you would specify
9196 This would color all files ending in
9200 Control characters can be written either in C\-style\-escaped
9201 notation, or in stty\-like ^\-notation.
9202 The C\-style notation
9207 for a normal space character,
9214 can be used to override the default interpretation of
9221 Each file will be written as
9222 .Ql <lc> <color-code> <rc> <filename> <ec> .
9225 code is undefined, the sequence
9227 will be used instead.
9228 This is generally more convenient
9229 to use, but less general.
9230 The left, right and end codes are
9231 provided so you don't have to type common parts over and over
9232 again and to support weird terminals; you will generally not
9233 need to change them at all unless your terminal does not use
9234 ISO 6429 color sequences but a different system.
9236 If your terminal does use ISO 6429 color codes, you can
9237 compose the type codes (i.e., all except the
9242 codes) from numerical commands separated by semicolons.
9245 most common commands are:
9247 .Bl -tag -width 4n -offset indent -compact
9250 To restore default color.
9253 For brighter colors.
9256 For underlined text.
9262 For black foreground.
9268 For green foreground.
9271 For yellow (or brown) foreground.
9274 For blue foreground.
9277 For purple foreground.
9280 For cyan foreground.
9283 For white (or gray) foreground.
9286 For black background.
9292 For green background.
9295 For yellow (or brown) background.
9298 For blue background.
9301 For purple background.
9304 For cyan background.
9307 For white (or gray) background.
9311 Not all commands will work on all systems or display devices.
9313 A few terminal programs do not recognize the default end code
9315 If all text gets colorized after you do a directory
9316 listing, try changing the
9321 numerical codes for your standard fore- and background colors.
9323 For symbolic links the
9325 keyword can be set to
9328 the file color the same as the color of the link target.
9330 .It Ev MACHTYPE No (+)
9331 The machine type (microprocessor class or machine model), as determined at compile time.
9333 .It Ev NOREBIND No (+)
9334 If set, printable characters are not rebound to
9335 .Ic self-insert-command .
9337 .Sx Native Language System support .
9339 .It Ev OSTYPE No (+)
9340 The operating system, as determined at compile time.
9343 A colon-separated list of directories in which to look for executables.
9346 shell variable, but in a different format.
9351 shell variable, but not synchronized to it;
9352 updated only after an actual directory change.
9354 .It Ev REMOTEHOST No (+)
9355 The host from which the user has logged in remotely, if this is the case and
9356 the shell is able to determine it.
9357 Set only if the shell was so compiled;
9367 .It Ev SYSTYPE No (+)
9368 The current system type.
9377 The terminal capability string.
9379 .Sx Terminal management .
9386 .It Ev VENDOR No (+)
9387 The vendor, as determined at compile time.
9390 The pathname to a default full-screen editor.
9393 editor command if the
9396 shell variable is unset.
9399 environment variable.
9406 .It Pa /etc/csh.cshrc
9407 Read first by every shell.
9408 ConvexOS, Stellix and Intel use
9412 .Pa /etc/cshrc.std .
9413 A/UX, AMIX, Cray and IRIX have no equivalent in
9415 but read this file in
9418 Solaris 2.x does not have it either, but
9424 .It Pa /etc/csh.login
9425 Read by login shells after
9426 .Pa /etc/csh.cshrc .
9427 ConvexOS, Stellix and Intel use
9430 .Pa /etc/login.std ,
9434 A/UX, AMIX, Cray and IRIX use
9437 .It Pa ~/.tcshrc No (+)
9438 Read by every shell after
9443 Read by every shell, if
9462 Read by login shells after
9466 is set, but see also
9470 Read by login shells after
9474 The shell may be compiled to read
9476 before instead of after
9484 .It Pa ~/.cshdirs No (+)
9485 Read by login shells after
9489 is set, but see also
9492 .It Pa /etc/csh.logout
9493 Read by login shells at logout.
9494 ConvexOS, Stellix and Intel use
9498 .Pa /etc/logout.std .
9499 A/UX, AMIX, Cray and IRIX have no equivalent in
9501 but read this file in
9504 Solaris 2.x does not have it either, but
9511 Read by login shells at logout after
9516 Used to interpret shell scripts not starting with a
9524 Source of home directories for
9530 The order in which startup files are read may differ if the shell was so
9532 .Sx Startup and shutdown
9537 .Sh "NEW FEATURES (+)"
9538 This manual describes
9543 users will want to pay special attention to
9547 A command-line editor, which supports
9552 \-style key bindings.
9554 .Sx The command-line editor
9556 .Sx Editor commands .
9558 Programmable, interactive word completion and listing.
9560 .Sx Completion and listing
9567 .Sx Spelling correction
9568 (q.v.) of filenames, commands and variables.
9571 (q.v.) which perform other useful functions in the middle of
9572 typed commands, including documentation lookup
9574 quick editor restarting
9575 .Ic ( run-fg-editor ) ,
9578 .Ic ( which-command ) .
9580 An enhanced history mechanism.
9581 Events in the history list are time-stamped.
9584 command and its associated shell variables,
9585 the previously undocumented
9587 event specifier and new modifiers
9589 .Sx History substitution ,
9592 .Ic expand-history ,
9593 .Ic history-search-backward ,
9594 .Ic history-search-forward ,
9597 .Ic toggle-literal-history ,
9598 .Ic vi-search-back ,
9607 Enhanced directory parsing and directory stack handling.
9614 commands and their associated
9615 shell variables, the description of
9616 .Sx Directory stack substitution ,
9624 .Ic normalize-command
9629 Negation in glob-patterns.
9631 .Sx Filename substitution .
9634 .Sx File inquiry operators
9637 builtin which uses them.
9640 .Sx Automatic, periodic and timed events
9642 scheduled events, special aliases, automatic logout and terminal locking,
9643 command timing and watching for logins and logouts.
9645 Support for the Native Language System
9647 .Sx Native Language System support ) ,
9650 .Sx OS variant support
9654 and system-dependent file locations (see
9657 Extensive terminal-management capabilities.
9659 .Sx Terminal management .
9661 New builtin commands including
9672 New variables that make useful information easily available to the shell.
9683 shell variables and the
9693 A new syntax for including useful information in the prompt string
9696 and special prompts for loops and spelling correction
9702 Read-only variables.
9704 .Sx Variable substitution .
9707 When a suspended command is restarted, the shell prints the directory
9708 it started in if this is different from the current directory.
9710 be misleading (i.e., wrong) as the job may have changed directories internally.
9712 Shell builtin functions are not stoppable/restartable.
9716 are also not handled gracefully when stopping is
9720 the shell will then immediately execute
9722 This is especially noticeable if this expansion results from an
9724 It suffices to place the sequence of commands in
9727 to a subshell, i.e.,
9728 .Ql \&( a \&; b \&; c \&) .
9730 Control over tty output after processes are started is primitive; perhaps
9731 this will inspire someone to work on a good virtual terminal interface.
9732 In a virtual terminal interface much more interesting things could be
9733 done with output control.
9735 Alias substitution is most often used to clumsily simulate shell procedures;
9736 shell procedures should be provided rather than aliases.
9738 Control structures should be parsed rather than being recognized as
9740 This would allow control commands to be placed anywhere,
9750 doesn't ignore here documents when looking for its
9753 It should be possible to use the
9755 modifiers on the output of command
9758 The screen update for lines longer than the screen width is very poor
9759 if the terminal cannot move the cursor up (i.e., terminal type
9765 don't need to be environment variables.
9767 Glob-patterns which do not use
9776 are not negated correctly.
9778 The single-command form of
9780 does output redirection even if
9781 the expression is false and the command is not executed.
9784 includes file identification characters when sorting filenames
9785 and does not handle control characters in filenames well.
9789 Command substitution supports multiple commands and conditions, but not
9795 .Lk https://bugs.astron.com/
9796 preferably with fixes.
9798 help maintain and test tcsh, add yourself to the mailing list in
9799 .Lk https://mailman.astron.com/
9802 In 1964, DEC produced the PDP-6.
9803 The PDP-10 was a later re-implementation.
9805 was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
9806 second model, the KI10.
9808 TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
9810 1972 as an experiment in demand-paged virtual memory operating systems.
9812 built a new pager for the DEC PDP-10 and created the OS to go with it.
9814 extremely successful in academia.
9816 In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
9817 have only a version of TENEX, which they had licensed from BBN, for the new
9819 They called their version TOPS-20 (their capitalization is trademarked).
9820 A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
9821 found themselves supporting two incompatible systems on the same hardware--but
9822 then there were 6 on the PDP-11!
9824 TENEX, and TOPS-20 to version 3, had command completion
9825 via a user-code-level subroutine library called ULTCMD.
9827 moved all that capability and more into the monitor (`kernel' for you Unix
9828 types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
9829 supervisor call mechanism [are my IBM roots also showing?]).
9831 The creator of tcsh was impressed by this feature and several others of TENEX
9832 and TOPS-20, and created a version of csh which mimicked them.
9835 The system limits argument lists to ARG_MAX characters.
9837 The number of arguments to a command which involves filename expansion is
9838 limited to 1/6th the number of characters allowed in an argument list.
9840 Command substitutions may substitute no more characters than are allowed in
9843 To detect looping, the shell restricts the number of
9845 substitutions on a single line to 20.
9877 .Em Introduction to the C Shell
9880 .\" UPDATE NEXT LINE FOR RELEASE
9881 This manual documents tcsh 6.24.02 (Astron) 2022-11-24.
9885 .Bl -tag -width 2n -compact
9891 .It J.E. Kulp, IIASA, Laxenburg, Austria
9892 Job control and directory stack features
9894 .It Ken Greer, HP Labs, 1981
9895 File name completion
9897 .It Mike Ellis, Fairchild, 1983
9898 Command name recognition/completion
9900 .It Paul Placeway, Ohio State CIS Dept., 1983-1993
9901 Command line editor, prompt routines, new glob syntax and numerous fixes
9904 .It Karl Kleinpaste, CCI 1983-4
9905 Special aliases, directory stack extraction stuff, login/logout watch,
9906 scheduled events, and the idea of the new prompt format
9908 .It Rayan Zachariassen, University of Toronto, 1984
9912 builtins and numerous bug fixes, modifications
9915 .It Chris Kingsley, Caltech
9916 Fast storage allocator routines
9918 .It Chris Grevstad, TRW, 1987
9924 .It Christos S. Zoulas, Cornell U. EE Dept., 1987-94
9925 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
9926 and a new version of sh.glob.c
9928 .It James J Dempsey, BBN, and Paul Placeway, OSU, 1988
9931 .It Daniel Long, NNSC, 1988
9934 .It Patrick Wolfe, Kuck and Associates, Inc., 1988
9938 .It David C Lawrence, Rensselaer Polytechnic Institute, 1989
9940 and ambiguous completion listing
9942 .It Alec Wolman, DEC, 1989
9943 Newlines in the prompt
9945 .It Matt Landau, BBN, 1989
9948 .It Ray Moody, Purdue Physics, 1989
9949 Magic space bar history expansion
9951 .It Mordechai ????, Intel, 1989
9952 printprompt() fixes and additions
9954 .It Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
9955 Automatic spelling correction and
9958 .It Per Hedeland, Ellemtel, Sweden, 1990-
9959 Various bugfixes, improvements and manual updates
9961 .It Hans J. Albertsson (Sun Sweden)
9968 Interrupt handling fixes
9970 .It Michael Fine, Digital Equipment Corp
9971 Extended key support
9973 .It Eric Schnoebelen, Convex, 1990
9974 Convex support, lots of
9977 save and restore of directory stack
9979 .It Ron Flax, Apple, 1990
9982 .It Dan Oscarsson, LTH Sweden, 1990
9983 NLS support and simulated NLS support for non NLS sites, fixes
9985 .It Johan Widen, SICS Sweden, 1990
9991 .It Matt Day, Sanyo Icon, 1990
9992 POSIX termio support, SysV limit fixes
9994 .It Jaap Vermeulen, Sequent, 1990-91
9995 Vi mode fixes, expand-line, window change fixes, Symmetry port
9997 .It Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
9999 beeping options, modified the history search to search for
10000 the whole string from the beginning of the line to the cursor.
10002 .It Scott Krotz, Motorola, 1991
10005 .It David Dawes, Sydney U. Australia, Physics Dept., 1991
10006 SVR4 job control fixes
10008 .It Jose Sousa, Interactive Systems Corp., 1991
10015 .It Marc Horowitz, MIT, 1991
10016 ANSIfication fixes, new exec hashing code, imake fixes,
10019 .It Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995
10020 ETA and Pyramid port, Makefile and lint fixes,
10023 various other portability changes and bug fixes
10025 .It Jeff Fink, 1992
10026 .Ic complete-word-fwd
10028 .Ic complete-word-back
10030 .It Harry C. Pulley, 1992
10033 .It Andy Phillips, Mullard Space Science Lab U.K., 1992
10036 .It Beto Appleton, IBM Corp., 1992
10037 Walking process group fixes,
10040 POSIX file tests, POSIX SIGHUP
10042 .It Scott Bolte, Cray Computer Corp., 1992
10045 .It Kaveh R. Ghazi, Rutgers University, 1992
10046 Tek, m88k, Titan and Masscomp ports and fixes.
10047 Added autoconf support.
10049 .It Mark Linderman, Cornell University, 1992
10052 .It Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992
10055 .It Tim P. Starrin, NASA Langley Research Center Operations, 1993
10056 Read-only variables
10058 .It Dave Schweisguth, Yale University, 1993-4
10059 New man page and tcsh.man2html
10061 .It Larry Schwimmer, Stanford University, 1993
10062 AFS and HESIOD patches
10064 .It Luke Mewburn, 1991-
10065 Enhanced directory printing in prompt.
10072 Manual page improvements.
10074 .It Edward Hutchins, Silicon Graphics Inc., 1996
10077 .It Martin Kraemer, 1997
10078 Ported to Siemens Nixdorf EBCDIC machine
10080 .It Amol Deshpande, Microsoft, 1997
10081 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
10082 and message catalog code to interface to Windows.
10084 .It Taga Nayuta, 1998
10085 Color ls additions.
10090 Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
10091 Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
10092 the other people at Ohio State for suggestions and encouragement
10094 All the people on the net, for putting up with,
10095 reporting bugs in, and suggesting new additions to each and every version
10097 Richard M. Alderson III, for writing the