TCSH(1) TCSH(1) NNAAMMEE tcsh - C shell with file name completion and command line editing SSYYNNOOPPSSIISS ttccsshh [--bbccddeeffFFiimmnnqqssttvvVVxxXX] [--DDnnaammee[==vvaalluuee]] [arg ...] ttccsshh --ll DDEESSCCRRIIPPTTIIOONN _t_c_s_h is an enhanced but completely compatible version of the Berkeley UNIX C shell, _c_s_h(1). It is a command lan- guage interpreter usable both as an interactive login shell and a shell script command processor. It includes a command-line editor (see TThhee ccoommmmaanndd--lliinnee eeddiittoorr), pro- grammable word completion (see CCoommpplleettiioonn aanndd lliissttiinngg), spelling correction (see SSppeelllliinngg ccoorrrreeccttiioonn), a history mechanism (see HHiissttoorryy ssuubbssttiittuuttiioonn), job control (see JJoobbss) and a C-like syntax. The NNEEWW FFEEAATTUURREESS section describes major enhancements of _t_c_s_h over _c_s_h(1). Throughout this manual, features of _t_c_s_h not found in most _c_s_h(1) implementations (specifically, the 4.4BSD _c_s_h) are labeled with `(+)', and features which are present in _c_s_h(1) but not usually documented are labeled with `(u)'. AArrgguummeenntt lliisstt pprroocceessssiinngg If the first argument (argument 0) to the shell is `-' then it is a login shell. A login shell can be also spec- ified by invoking the shell with the --ll flag as the only argument. The rest of the flag arguments are interpreted as follows: --bb Forces a ``break'' from option processing, causing any further shell arguments to be treated as non-option arguments. The remaining arguments will not be inter- preted as shell options. This may be used to pass options to a shell script without confusion or possi- ble subterfuge. The shell will not run a set-user ID script without this option. --cc Commands are read from the following argument (which must be present, and must be a single argument), stored in the ccoommmmaanndd shell variable for reference, and executed. Any remaining arguments are placed in the aarrggvv shell variable. --dd The shell loads the directory stack from _~_/_._c_s_h_d_i_r_s as described under SSttaarrttuupp aanndd sshhuuttddoowwnn, whether or not it is a login shell. (+) --DD_n_a_m_e[=_v_a_l_u_e] Sets the environment variable _n_a_m_e to _v_a_l_u_e. (Domain/OS only) (+) --ee The shell exits if any invoked command terminates abnormally or yields a non-zero exit status. --ff The shell ignores _~_/_._t_c_s_h_r_c, and thus starts faster. --FF The shell uses _f_o_r_k(2) instead of _v_f_o_r_k(2) to spawn processes. (Convex/OS only) (+) --ii The shell is interactive and prompts for its top-level input, even if it appears to not be a terminal. Shells are interactive without this option if their inputs and outputs are terminals. --ll The shell is a login shell. Applicable only if --ll is the only flag specified. --mm The shell loads _~_/_._t_c_s_h_r_c even if it does not belong to the effective user. Newer versions of _s_u(1) can pass --mm to the shell. (+) --nn The shell parses commands but does not execute them. This aids in debugging shell scripts. --qq The shell accepts SIGQUIT (see SSiiggnnaall hhaannddlliinngg) and behaves when it is used under a debugger. Job control is disabled. (u) --ss Command input is taken from the standard input. --tt The shell reads and executes a single line of input. A `\' may be used to escape the newline at the end of this line and continue onto another line. --vv Sets the vveerrbboossee shell variable, so that command input is echoed after history substitution. --xx Sets the eecchhoo shell variable, so that commands are echoed immediately before execution. --VV Sets the vveerrbboossee shell variable even before executing _~_/_._t_c_s_h_r_c. --XX Is to --xx as --VV is to --vv. After processing of flag arguments, if arguments remain but none of the --cc, --ii, --ss, or --tt options were given, the first argument is taken as the name of a file of commands, or ``script'', to be executed. The shell opens this file and saves its name for possible resubstitution by `$0'. Because many systems use either the standard version 6 or version 7 shells whose shell scripts are not compatible with this shell, the shell uses such a `standard' shell to execute a script whose first character is not a `#', i.e., that does not start with a comment. Remaining arguments are placed in the aarrggvv shell variable. SSttaarrttuupp aanndd sshhuuttddoowwnn A login shell begins by executing commands from the system files _/_e_t_c_/_c_s_h_._c_s_h_r_c and _/_e_t_c_/_c_s_h_._l_o_g_i_n. It then executes commands from files in the user's hhoommee directory: first _~_/_._t_c_s_h_r_c (+) or, if _~_/_._t_c_s_h_r_c is not found, _~_/_._c_s_h_r_c, then _~_/_._h_i_s_t_o_r_y (or the value of the hhiissttffiillee shell vari- able), then _~_/_._l_o_g_i_n, and finally _~_/_._c_s_h_d_i_r_s (or the value of the ddiirrssffiillee shell variable) (+). The shell may read _/_e_t_c_/_c_s_h_._l_o_g_i_n before instead of after _/_e_t_c_/_c_s_h_._c_s_h_r_c, and _~_/_._l_o_g_i_n before instead of after _~_/_._t_c_s_h_r_c or _~_/_._c_s_h_r_c and _~_/_._h_i_s_t_o_r_y, if so compiled; see the vveerrssiioonn shell vari- able. (+) Non-login shells read only _/_e_t_c_/_c_s_h_._c_s_h_r_c and _~_/_._t_c_s_h_r_c or _~_/_._c_s_h_r_c on startup. Commands like _s_t_t_y(1) and _t_s_e_t(1), which need be run only once per login, usually go in one's _~_/_._l_o_g_i_n file. Users who need to use the same set of files with both _c_s_h(1) and _t_c_s_h can have only a _~_/_._c_s_h_r_c which checks for the exis- tence of the ttccsshh shell variable (q.v.) before using _t_c_s_h- specific commands, or can have both a _~_/_._c_s_h_r_c and a _~_/_._t_c_s_h_r_c which _s_o_u_r_c_es (see the builtin command) _~_/_._c_s_h_r_c. The rest of this manual uses `_~_/_._t_c_s_h_r_c' to mean `_~_/_._t_c_s_h_r_c or, if _~_/_._t_c_s_h_r_c is not found, _~_/_._c_s_h_r_c'. In the normal case, the shell begins reading commands from the terminal, prompting with `> '. (Processing of argu- ments and the use of the shell to process files containing command scripts are described later.) The shell repeat- edly reads a line of command input, breaks it into words, places it on the command history list, parses it and exe- cutes each command in the line. One can log out by typing `^D' on an empty line, `logout' or `login' or via the shell's autologout mechanism (see the aauuttoollooggoouutt shell variable). When a login shell termi- nates it sets the llooggoouutt shell variable to `normal' or `automatic' as appropriate, then executes commands from the files _/_e_t_c_/_c_s_h_._l_o_g_o_u_t and _~_/_._l_o_g_o_u_t. The shell may drop DTR on logout if so compiled; see the vveerrssiioonn shell variable. The names of the system login and logout files vary from system to system for compatibility with different _c_s_h(1) variants; see FFIILLEESS. EEddiittiinngg We first describe TThhee ccoommmmaanndd--lliinnee eeddiittoorr. The CCoommpplleettiioonn aanndd lliissttiinngg and SSppeelllliinngg ccoorrrreeccttiioonn sections describe two sets of functionality that are implemented as editor com- mands but which deserve their own treatment. Finally, EEddiittoorr ccoommmmaannddss lists and describes the editor commands specific to the shell and their default bindings. TThhee ccoommmmaanndd--lliinnee eeddiittoorr ((++)) Command-line input can be edited using key sequences much like those used in GNU Emacs or _v_i(1). The editor is active only when the eeddiitt shell variable is set, which it is by default in interactive shells. The _b_i_n_d_k_e_y builtin can display and change key bindings. Emacs-style key bindings are used by default (unless the shell was com- piled otherwise; see the vveerrssiioonn shell variable), but _b_i_n_d_k_e_y can change the key bindings to _v_i-style bindings en masse. The shell always binds the arrow keys (as defined in the TTEERRMMCCAAPP environment variable) to down _d_o_w_n_-_h_i_s_t_o_r_y up _u_p_-_h_i_s_t_o_r_y left _b_a_c_k_w_a_r_d_-_c_h_a_r right _f_o_r_w_a_r_d_-_c_h_a_r unless doing so would alter another single-character bind- ing. One can set the arrow key escape sequences to the empty string with _s_e_t_t_c to prevent these bindings. The ANSI/VT100 sequences for arrow keys are always bound. Other key bindings are, for the most part, what Emacs and _v_i(1) users would expect and can easily be displayed by _b_i_n_d_k_e_y, so there is no need to list them here. Likewise, _b_i_n_d_k_e_y can list the editor commands with a short description of each. Note that editor commands do not have the same notion of a ``word'' as does the shell. The editor delimits words with any non-alphanumeric characters not in the shell variable wwoorrddcchhaarrss, while the shell recognizes only whitespace and some of the characters with special mean- ings to it, listed under LLeexxiiccaall ssttrruuccttuurree. CCoommpplleettiioonn aanndd lliissttiinngg ((++)) The shell is often able to complete words when given a unique abbreviation. Type part of a word (for example `ls /usr/lost') and hit the tab key to run the _c_o_m_p_l_e_t_e_-_w_o_r_d editor command. The shell completes the filename `/usr/lost' to `/usr/lost+found/', replacing the incom- plete word with the complete word in the input buffer. (Note the terminal `/'; completion adds a `/' to the end of completed directories and a space to the end of other completed words, to speed typing and provide a visual indicator of successful completion. The aaddddssuuffffiixx shell variable can be unset to prevent this.) If no match is found (perhaps `/usr/lost+found' doesn't exist), the ter- minal bell rings. If the word is already complete (per- haps there is a `/usr/lost' on your system, or perhaps you were thinking too far ahead and typed the whole thing) a `/' or space is added to the end if it isn't already there. Completion works anywhere in the line, not at just the end; completed text pushes the rest of the line to the right. Completion in the middle of a word often results in leftover characters to the right of the cursor that need to be deleted. Commands and variables can be completed in much the same way. For example, typing `em[tab]' would complete `em' to `emacs' if _e_m_a_c_s were the only command on your system beginning with `em'. Completion can find a command in any directory in ppaatthh or if given a full pathname. Typing `echo $ar[tab]' would complete `$ar' to `$argv' if no other variable began with `ar'. The shell parses the input buffer to determine whether the word you want to complete should be completed as a file- name, command or variable. The first word in the buffer and the first word following `;', `|', `|&', `&&' or `||' is considered to be a command. A word beginning with `$' is considered to be a variable. Anything else is a file- name. An empty line is `completed' as a filename. You can list the possible completions of a word at any time by typing `^D' to run the _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f editor command. The shell lists the possible completions using the _l_s_-_F builtin (q.v.) and reprints the prompt and unfinished command line, for example: > ls /usr/l[^D] lbin/ lib/ local/ lost+found/ > ls /usr/l If the aauuttoolliisstt shell variable is set, the shell lists the remaining choices (if any) whenever completion fails: > set autolist > nm /usr/lib/libt[tab] libtermcap.a@ libtermlib.a@ > nm /usr/lib/libterm If aauuttoolliisstt is set to `ambiguous', choices are listed only when completion fails and adds no new characters to the word being completed. A filename to be completed can contain variables, your own or others' home directories abbreviated with `~' (see FFiilleennaammee ssuubbssttiittuuttiioonn) and directory stack entries abbre- viated with `=' (see DDiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn). For example, > ls ~k[^D] kahn kas kellogg > ls ~ke[tab] > ls ~kellogg/ or > set local = /usr/local > ls $lo[tab] > ls $local/[^D] bin/ etc/ lib/ man/ src/ > ls $local/ Note that variables can also be expanded explicitly with the _e_x_p_a_n_d_-_v_a_r_i_a_b_l_e_s editor command. _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f lists at only the end of the line; in the middle of a line it deletes the character under the cursor and on an empty line it logs one out or, if iiggnnoorreeeeooff is set, does nothing. `M-^D', bound to the editor command _l_i_s_t_-_c_h_o_i_c_e_s, lists completion possibili- ties anywhere on a line, and _l_i_s_t_-_c_h_o_i_c_e_s (or any one of the related editor commands that do or don't delete, list and/or log out, listed under _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f) can be bound to `^D' with the _b_i_n_d_k_e_y builtin command if so desired. The _c_o_m_p_l_e_t_e_-_w_o_r_d_-_f_w_d and _c_o_m_p_l_e_t_e_-_w_o_r_d_-_b_a_c_k editor com- mands (not bound to any keys by default) can be used to cycle up and down through the list of possible comple- tions, replacing the current word with the next or previ- ous word in the list. The shell variable ffiiggnnoorree can be set to a list of suf- fixes to be ignored by completion. Consider the follow- ing: > ls Makefile condiments.h~ main.o side.c README main.c meal side.o condiments.h main.c~ > set fignore = (.o \~) > emacs ma[^D] main.c main.c~ main.o > emacs ma[tab] > emacs main.c `main.c~' and `main.o' are ignored by completion (but not listing), because they end in suffixes in ffiiggnnoorree. Note that a `\' was needed in front of `~' to prevent it from being expanded to hhoommee as described under FFiilleennaammee ssuubbssttii-- ttuuttiioonn. ffiiggnnoorree is ignored if only one completion is pos- sible. If the ccoommpplleettee shell variable is set to `enhance', com- pletion 1) ignores case and 2) considers periods, hyphens and underscores (`.', `-' and `_') to be word separators and hyphens and underscores to be equivalent. If you had the following files comp.lang.c comp.lang.perl comp.std.c++ comp.lang.c++ comp.std.c and typed `mail -f c.l.c[tab]', it would be completed to `mail -f comp.lang.c', and ^D would list `comp.lang.c' and `comp.lang.c++'. `mail -f c..c++[^D]' would list `comp.lang.c++' and `comp.std.c++'. Typing `rm a--file[^D]' in the following directory A_silly_file a-hyphenated-file another_silly_file would list all three files, because case is ignored and hyphens and underscores are equivalent. Periods, however, are not equivalent to hyphens or underscores. Completion and listing are affected by several other shell variables: rreecceexxaacctt can be set to complete on the shortest possible unique match, even if more typing might result in a longer match: > ls fodder foo food foonly > set recexact > rm fo[tab] just beeps, because `fo' could expand to `fod' or `foo', but if we type another `o', > rm foo[tab] > rm foo the completion completes on `foo', even though `food' and `foonly' also match. aauuttooeexxppaanndd can be set to run the _e_x_p_a_n_d_-_h_i_s_t_o_r_y editor command before each completion attempt, aauuttooccoorrrreecctt can be set to spelling-correct the word to be completed (see SSppeelllliinngg ccoorrrreeccttiioonn) before each completion attempt and ccoorrrreecctt can be set to complete com- mands automatically after one hits `return'. mmaattcchhbbeeeepp can be set to make completion beep or not beep in a vari- ety of situations, and nnoobbeeeepp can be set to never beep at all. nnoossttaatt can be set to a list of directories and/or patterns that match directories to prevent the completion mechanism from _s_t_a_t(2)ing those directories. lliissttmmaaxx and lliissttmmaaxxrroowwss can be set to limit the number of items and rows (respectively) that are listed without asking first. rreeccooggnniizzee__oonnllyy__eexxeeccuuttaabblleess can be set to make the shell list only executables when listing commands, but it is quite slow. Finally, the _c_o_m_p_l_e_t_e builtin command can be used to tell the shell how to complete words other than filenames, com- mands and variables. Completion and listing do not work on glob-patterns (see FFiilleennaammee ssuubbssttiittuuttiioonn), but the _l_i_s_t_-_g_l_o_b and _e_x_p_a_n_d_-_g_l_o_b editor commands perform equiva- lent functions for glob-patterns. SSppeelllliinngg ccoorrrreeccttiioonn ((++)) The shell can sometimes correct the spelling of filenames, commands and variable names as well as completing and listing them. Individual words can be spelling-corrected with the _s_p_e_l_l_- _w_o_r_d editor command (usually bound to M-s and M-S) and the entire input buffer with _s_p_e_l_l_-_l_i_n_e (usually bound to M-$). The ccoorrrreecctt shell variable can be set to `cmd' to correct the command name or `all' to correct the entire line each time return is typed, and aauuttooccoorrrreecctt can be set to correct the word to be completed before each completion attempt. When spelling correction is invoked in any of these ways and the shell thinks that any part of the command line is misspelled, it prompts with the corrected line: > set correct = cmd > lz /usr/bin CORRECT>ls /usr/bin (y|n|e|a)? One can answer `y' or space to execute the corrected line, `e' to leave the uncorrected command in the input buffer, `a' to abort the command as if `^C' had been hit, and any- thing else to execute the original line unchanged. Spelling correction recognizes user-defined completions (see the _c_o_m_p_l_e_t_e builtin command). If an input word in a position for which a completion is defined resembles a word in the completion list, spelling correction registers a misspelling and suggests the latter word as a correc- tion. However, if the input word does not match any of the possible completions for that position, spelling cor- rection does not register a misspelling. Like completion, spelling correction works anywhere in the line, pushing the rest of the line to the right and possi- bly leaving extra characters to the right of the cursor. Beware: spelling correction is not guaranteed to work the way one intends, and is provided mostly as an experimental feature. Suggestions and improvements are welcome. EEddiittoorr ccoommmmaannddss ((++)) `bindkey' lists key bindings and `bindkey -l' lists and briefly describes editor commands. Only new or especially interesting editor commands are described here. See _e_m_a_c_s(1) and _v_i(1) for descriptions of each editor's key bindings. The character or characters to which each command is bound by default is given in parentheses. `^_c_h_a_r_a_c_t_e_r' means a control character and `M-_c_h_a_r_a_c_t_e_r' a meta character, typed as escape-_c_h_a_r_a_c_t_e_r on terminals without a meta key. Case counts, but commands that are bound to letters by default are bound to both lower- and uppercase letters for convenience. ccoommpplleettee--wwoorrdd (tab) Completes a word as described under CCoommpplleettiioonn aanndd lliissttiinngg. ccoommpplleettee--wwoorrdd--bbaacckk (not bound) Like _c_o_m_p_l_e_t_e_-_w_o_r_d_-_f_w_d, but steps up from the end of the list. ccoommpplleettee--wwoorrdd--ffwwdd (not bound) Replaces the current word with the first word in the list of possible completions. May be repeated to step down through the list. At the end of the list, beeps and reverts to the incomplete word. ccoommpplleettee--wwoorrdd--rraaww (^X-tab) Like _c_o_m_p_l_e_t_e_-_w_o_r_d, but ignores user-defined com- pletions. ccooppyy--pprreevv--wwoorrdd (M-^_) Copies the previous word in the current line into the input buffer. See also _i_n_s_e_r_t_-_l_a_s_t_-_w_o_r_d. ddaabbbbrreevv--eexxppaanndd (M-/) Expands the current word to the most recent pre- ceding one for which the current is a leading sub- string, wrapping around the history list (once) if necessary. Repeating _d_a_b_b_r_e_v_-_e_x_p_a_n_d without any intervening typing changes to the next previous word etc., skipping identical matches much like _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_b_a_c_k_w_a_r_d does. ddeelleettee--cchhaarr (not bound) Deletes the character under the cursor. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f. ddeelleettee--cchhaarr--oorr--eeooff (not bound) Does _d_e_l_e_t_e_-_c_h_a_r if there is a character under the cursor or _e_n_d_-_o_f_-_f_i_l_e on an empty line. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f. ddeelleettee--cchhaarr--oorr--lliisstt (not bound) Does _d_e_l_e_t_e_-_c_h_a_r if there is a character under the cursor or _l_i_s_t_-_c_h_o_i_c_e_s at the end of the line. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f. ddeelleettee--cchhaarr--oorr--lliisstt--oorr--eeooff (^D) Does _d_e_l_e_t_e_-_c_h_a_r if there is a character under the cursor, _l_i_s_t_-_c_h_o_i_c_e_s at the end of the line or _e_n_d_-_o_f_-_f_i_l_e on an empty line. See also those three commands, each of which does only a single action, and _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_e_o_f, _d_e_l_e_t_e_-_c_h_a_r_-_o_r_- _l_i_s_t and _l_i_s_t_-_o_r_-_e_o_f, each of which does a differ- ent two out of the three. ddoowwnn--hhiissttoorryy (down-arrow, ^N) Like _u_p_-_h_i_s_t_o_r_y, but steps down, stopping at the original input line. eenndd--ooff--ffiillee (not bound) Signals an end of file, causing the shell to exit unless the iiggnnoorreeeeooff shell variable (q.v.) is set to prevent this. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_- _e_o_f. eexxppaanndd--hhiissttoorryy (M-space) Expands history substitutions in the current word. See HHiissttoorryy ssuubbssttiittuuttiioonn. See also _m_a_g_i_c_-_s_p_a_c_e, _t_o_g_g_l_e_-_l_i_t_e_r_a_l_-_h_i_s_t_o_r_y and the aauuttooeexxppaanndd shell variable. eexxppaanndd--gglloobb (^X-*) Expands the glob-pattern to the left of the cur- sor. See FFiilleennaammee ssuubbssttiittuuttiioonn. eexxppaanndd--lliinnee (not bound) Like _e_x_p_a_n_d_-_h_i_s_t_o_r_y, but expands history substitutions in each word in the input buffer, eexxppaanndd--vvaarriiaabblleess (^X-$) Expands the variable to the left of the cursor. See VVaarriiaabbllee ssuubbssttiittuuttiioonn. hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd (M-p, M-P) Searches backwards through the history list for a command beginning with the current contents of the input buffer up to the cursor and copies it into the input buffer. The search string may be a glob-pattern (see FFiilleennaammee ssuubbssttiittuuttiioonn) contain- ing `*', `?', `[]' or `{}'. _u_p_-_h_i_s_t_o_r_y and _d_o_w_n_- _h_i_s_t_o_r_y will proceed from the appropriate point in the history list. Emacs mode only. See also _h_i_s_- _t_o_r_y_-_s_e_a_r_c_h_-_f_o_r_w_a_r_d and _i_-_s_e_a_r_c_h_-_b_a_c_k. hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd (M-n, M-N) Like _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_b_a_c_k_w_a_r_d, but searches for- ward. ii--sseeaarrcchh--bbaacckk (not bound) Searches backward like _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_b_a_c_k_w_a_r_d, copies the first match into the input buffer with the cursor positioned at the end of the pattern, and prompts with `bck: ' and the first match. Additional characters may be typed to extend the search, _i_-_s_e_a_r_c_h_-_b_a_c_k may be typed to continue searching with the same pattern, wrapping around the history list if necessary, (_i_-_s_e_a_r_c_h_-_b_a_c_k must be bound to a single character for this to work) or one of the following special characters may be typed: ^W Appends the rest of the word under the cursor to the search pattern. delete (or any character bound to _b_a_c_k_w_a_r_d_- _d_e_l_e_t_e_-_c_h_a_r) Undoes the effect of the last charac- ter typed and deletes a character from the search pattern if appropriate. ^G If the previous search was successful, aborts the entire search. If not, goes back to the last successful search. escape Ends the search, leaving the current line in the input buffer. Any other character not bound to _s_e_l_f_-_i_n_s_e_r_t_-_c_o_m_- _m_a_n_d terminates the search, leaving the current line in the input buffer, and is then interpreted as normal input. In particular, a carriage return causes the current line to be executed. Emacs mode only. See also _i_-_s_e_a_r_c_h_-_f_w_d and _h_i_s_t_o_r_y_- _s_e_a_r_c_h_-_b_a_c_k_w_a_r_d. ii--sseeaarrcchh--ffwwdd (not bound) Like _i_-_s_e_a_r_c_h_-_b_a_c_k, but searches forward. iinnsseerrtt--llaasstt--wwoorrdd (M-_) Inserts the last word of the previous input line (`!$') into the input buffer. See also _c_o_p_y_-_p_r_e_v_- _w_o_r_d. lliisstt--cchhooiicceess (M-^D) Lists completion possibilities as described under CCoommpplleettiioonn aanndd lliissttiinngg. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_- _l_i_s_t_-_o_r_-_e_o_f and _l_i_s_t_-_c_h_o_i_c_e_s_-_r_a_w. lliisstt--cchhooiicceess--rraaww (^X-^D) Like _l_i_s_t_-_c_h_o_i_c_e_s, but ignores user-defined com- pletions. lliisstt--gglloobb (^X-g, ^X-G) Lists (via the _l_s_-_F builtin) matches to the glob- pattern (see FFiilleennaammee ssuubbssttiittuuttiioonn) to the left of the cursor. lliisstt--oorr--eeooff (not bound) Does _l_i_s_t_-_c_h_o_i_c_e_s or _e_n_d_-_o_f_-_f_i_l_e on an empty line. See also _d_e_l_e_t_e_-_c_h_a_r_-_o_r_-_l_i_s_t_-_o_r_-_e_o_f. mmaaggiicc--ssppaaccee (not bound) Expands history substitutions in the current line, like _e_x_p_a_n_d_-_h_i_s_t_o_r_y, and appends a space. _m_a_g_i_c_- _s_p_a_c_e is designed to be bound to the space bar, but is not bound by default. nnoorrmmaalliizzee--ccoommmmaanndd (^X-?) Searches for the current word in PATH and, if it is found, replaces it with the full path to the executable. Special characters are quoted. Aliases are expanded and quoted but commands within aliases are not. This command is useful with commands that take commands as arguments, e.g., `dbx' and `sh -x'. nnoorrmmaalliizzee--ppaatthh (^X-n, ^X-N) Expands the current word as described under the `expand' setting of the ssyymmlliinnkkss shell variable. oovveerrwwrriittee--mmooddee (unbound) Toggles between input and overwrite modes. rruunn--ffgg--eeddiittoorr (M-^Z) Saves the current input line and looks for a stopped job with a name equal to the last compo- nent of the file name part of the EEDDIITTOORR or VVIISSUUAALL environment variables, or, if neither is set, `ed' or `vi'. If such a job is found, it is restarted as if `fg %_j_o_b' had been typed. This is used to toggle back and forth between an editor and the shell easily. Some people bind this command to `^Z' so they can do this even more easily. rruunn--hheellpp (M-h, M-H) Searches for documentation on the current command, using the same notion of `current command' as the completion routines, and prints it. There is no way to use a pager; _r_u_n_-_h_e_l_p is designed for short help files. If the special alias hheellppccoommmmaanndd is defined, it is run with the command name as a sole argument. Else, documentation should be in a file named _c_o_m_m_a_n_d.help, _c_o_m_m_a_n_d.1, _c_o_m_m_a_n_d.6, _c_o_m_- _m_a_n_d.8 or _c_o_m_m_a_n_d, which should be in one of the directories listed in the HHPPAATTHH environment vari- able. If there is more than one help file only the first is printed. sseellff--iinnsseerrtt--ccoommmmaanndd (text characters) In insert mode (the default), inserts the typed character into the input line after the character under the cursor. In overwrite mode, replaces the character under the cursor with the typed charac- ter. The input mode is normally preserved between lines, but the iinnppuuttmmooddee shell variable can be set to `insert' or `overwrite' to put the editor in that mode at the beginning of each line. See also _o_v_e_r_w_r_i_t_e_-_m_o_d_e. sseeqquueennccee--lleeaadd--iinn (arrow prefix, meta prefix, ^X) Indicates that the following characters are part of a multi-key sequence. Binding a command to a multi-key sequence really creates two bindings: the first character to _s_e_q_u_e_n_c_e_-_l_e_a_d_-_i_n and the whole sequence to the command. All sequences beginning with a character bound to _s_e_q_u_e_n_c_e_-_l_e_a_d_- _i_n are effectively bound to _u_n_d_e_f_i_n_e_d_-_k_e_y unless bound to another command. ssppeellll--lliinnee (M-$) Attempts to correct the spelling of each word in the input buffer, like _s_p_e_l_l_-_w_o_r_d, but ignores words whose first character is one of `-', `!', `^' or `%', or which contain `\', `*' or `?', to avoid problems with switches, substitutions and the like. See SSppeelllliinngg ccoorrrreeccttiioonn. ssppeellll--wwoorrdd (M-s, M-S) Attempts to correct the spelling of the current word as described under SSppeelllliinngg ccoorrrreeccttiioonn. Checks each component of a word which appears to be a pathname. ttooggggllee--lliitteerraall--hhiissttoorryy (M-r, M-R) Expands or `unexpands' history substitutions in the input buffer. See also _e_x_p_a_n_d_-_h_i_s_t_o_r_y and the aauuttooeexxppaanndd shell variable. uunnddeeffiinneedd--kkeeyy (any unbound key) Beeps. uupp--hhiissttoorryy (up-arrow, ^P) Copies the previous entry in the history list into the input buffer. If hhiissttlliitt is set, uses the literal form of the entry. May be repeated to step up through the history list, stopping at the top. vvii--sseeaarrcchh--bbaacckk (?) Prompts with `?' for a search string (which may be a glob-pattern, as with _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_b_a_c_k_w_a_r_d), searches for it and copies it into the input buffer. The bell rings if no match is found. Hitting return ends the search and leaves the last match in the input buffer. Hitting escape ends the search and executes the match. _v_i mode only. vvii--sseeaarrcchh--ffwwdd (/) Like _v_i_-_s_e_a_r_c_h_-_b_a_c_k, but searches forward. wwhhiicchh--ccoommmmaanndd (M-?) Does a _w_h_i_c_h (see the description of the builtin command) on the first word of the input buffer. LLeexxiiccaall ssttrruuccttuurree The shell splits input lines into words at blanks and tabs. The special characters `&', `|', `;', `<', `>', `(', and `)' and the doubled characters `&&', `||', `<<' and `>>' are always separate words, whether or not they are surrounded by whitespace. When the shell's input is not a terminal, the character `#' is taken to begin a comment. Each `#' and the rest of the input line on which it appears is discarded before further parsing. A special character (including a blank or tab) may be pre- vented from having its special meaning, and possibly made part of another word, by preceding it with a backslash (`\') or enclosing it in single (`''), double (`"') or backward (``') quotes. When not otherwise quoted a new- line preceded by a `\' is equivalent to a blank, but inside quotes this sequence results in a newline. Furthermore, all SSuubbssttiittuuttiioonnss (see below) except HHiissttoorryy ssuubbssttiittuuttiioonn can be prevented by enclosing the strings (or parts of strings) in which they appear with single quotes or by quoting the crucial character(s) (e.g., `$' or ``' for VVaarriiaabbllee ssuubbssttiittuuttiioonn or CCoommmmaanndd ssuubbssttiittuuttiioonn respec- tively) with `\'. (AAlliiaass ssuubbssttiittuuttiioonn is no exception: quoting in any way any character of a word for which an _a_l_i_a_s has been defined prevents substitution of the alias. The usual way of quoting an alias is to precede it with a backslash.) HHiissttoorryy ssuubbssttiittuuttiioonn is prevented by back- slashes but not by single quotes. Strings quoted with double or backward quotes undergo VVaarriiaabbllee ssuubbssttiittuuttiioonn and CCoommmmaanndd ssuubbssttiittuuttiioonn, but other substitutions are pre- vented. Text inside single or double quotes becomes a single word (or part of one). Metacharacters in these strings, including blanks and tabs, do not form separate words. Only in one special case (see CCoommmmaanndd ssuubbssttiittuuttiioonn below) can a double-quoted string yield parts of more than one word; single-quoted strings never do. Backward quotes are special: they signal CCoommmmaanndd ssuubbssttiittuuttiioonn (q.v.), which may result in more than one word. Quoting complex strings, particularly strings which them- selves contain quoting characters, can be confusing. Remember that quotes need not be used as they are in human writing! It may be easier to quote not an entire string, but only those parts of the string which need quoting, using different types of quoting to do so if appropriate. The bbaacckkssllaasshh__qquuoottee shell variable (q.v.) can be set to make backslashes always quote `\', `'', and `"'. (+) This may make complex quoting tasks easier, but it can cause syntax errors in _c_s_h(1) scripts. SSuubbssttiittuuttiioonnss We now describe the various transformations the shell per- forms on the input in the order in which they occur. We note in passing the data structures involved and the com- mands and variables which affect them. Remember that sub- stitutions can be prevented by quoting as described under LLeexxiiccaall ssttrruuccttuurree. HHiissttoorryy ssuubbssttiittuuttiioonn Each command, or ``event'', input from the terminal is saved in the history list. The previous command is always saved, and the hhiissttoorryy shell variable can be set to a num- ber to save that many commands. The hhiissttdduupp shell variable can be set to not save duplicate events or con- secutive duplicate events. Saved commands are numbered sequentially from 1 and stamped with the time. It is not usually necessary to use event numbers, but the current event number can be made part of the prompt by placing an `!' in the pprroommpptt shell variable. The shell actually saves history in expanded and literal (unexpanded) forms. If the hhiissttlliitt shell variable is set, commands that display and store history use the literal form. The _h_i_s_t_o_r_y builtin command can print, store in a file, restore and clear the history list at any time, and the ssaavveehhiisstt and hhiissttffiillee shell variables can be can be set to store the history list automatically on logout and restore it on login. History substitutions introduce words from the history list into the input stream, making it easy to repeat com- mands, repeat arguments of a previous command in the cur- rent command, or fix spelling mistakes in the previous command with little typing and a high degree of confi- dence. History substitutions begin with the character `!'. They may begin anywhere in the input stream, but they do not nest. The `!' may be preceded by a `\' to prevent its special meaning; for convenience, a `!' is passed unchanged when it is followed by a blank, tab, newline, `=' or `('. History substitutions also occur when an input line begins with `^'. This special abbreviation will be described later. The characters used to signal history substitution (`!' and `^') can be changed by set- ting the hhiissttcchhaarrss shell variable. Any input line which contains a history substitution is printed before it is executed. A history substitution may have an ``event specifica- tion'', which indicates the event from which words are to be taken, a ``word designator'', which selects particular words from the chosen event, and/or a ``modifier'', which manipulates the selected words. An event specification can be _n A number, referring to a particular event -_n An offset, referring to the event _n before the current event # The current event. This should be used care- fully in _c_s_h(1), where there is no check for recursion. _t_c_s_h allows 10 levels of recur- sion. (+) ! The previous event (equivalent to `-1') _s The most recent event whose first word begins with the string _s ?_s? The most recent event which contains the string _s. The second `?' can be omitted if it is immediately followed by a newline. For example, consider this bit of someone's history list: 9 8:30 nroff -man wumpus.man 10 8:31 cp wumpus.man wumpus.man.old 11 8:36 vi wumpus.man 12 8:37 diff wumpus.man.old wumpus.man The commands are shown with their event numbers and time stamps. The current event, which we haven't typed in yet, is event 13. `!11' and `!-2' refer to event 11. `!!' refers to the previous event, 12. `!!' can be abbreviated `!' if it is followed by `:' (`:' is described below). `!n' refers to event 9, which begins with `n'. `!?old?' also refers to event 12, which contains `old'. Without word designators or modifiers history references simply expand to the entire event, so we might type `!cp' to redo the copy command or `!!|more' if the `diff' output scrolled off the top of the screen. History references may be insulated from the surrounding text with braces if necessary. For example, `!vdoc' would look for a command beginning with `vdoc', and, in this example, not find one, but `!{v}doc' would expand unam- biguously to `vi wumpus.mandoc'. Even in braces, history substitutions do not nest. (+) While _c_s_h(1) expands, for example, `!3d' to event 3 with the letter `d' appended to it, _t_c_s_h expands it to the last event beginning with `3d'; only completely numeric arguments are treated as event numbers. This makes it possible to recall events beginning with numbers. To expand `!3d' as in _c_s_h(1) say `!\3d'. To select words from an event we can follow the event specification by a `:' and a designator for the desired words. The words of an input line are numbered from 0, the first (usually command) word being 0, the second word (first argument) being 1, etc. The basic word designators are: 0 The first (command) word _n The _nth argument ^ The first argument, equivalent to `1' $ The last argument % The word matched by an ?_s? search _x_-_y A range of words _-_y Equivalent to _`_0_-_y_' * Equivalent to `^-$', but returns nothing if the event contains only 1 word _x_* Equivalent to _`_x_-_$_' _x_- Equivalent to _`_x_*_', but omitting the last word (`$') Selected words are inserted into the command line sepa- rated by single blanks. For example, the `diff' command in the previous example might have been typed as `diff !!:1.old !!:1' (using `:1' to select the first argument from the previous event) or `diff !-2:2 !-2:1' to select and swap the arguments from the `cp' command. If we didn't care about the order of the `diff' we might have said `diff !-2:1-2' or simply `diff !-2:*'. The `cp' com- mand might have been written `cp wumpus.man !#:1.old', using `#' to refer to the current event. `!n:- hurkle.man' would reuse the first two words from the `nroff' command to say `nroff -man hurkle.man'. The `:' separating the event specification from the word designator can be omitted if the argument selector begins with a `^', `$', `*', `%' or `-'. For example, our `diff' command might have been `diff !!^.old !!^' or, equivalently, `diff !!$.old !!$'. However, if `!!' is abbreviated `!', an argument selector beginning with `-' will be interpreted as an event specification. A history reference may have a word designator but no event specification. It then references the previous com- mand. Continuing our `diff' example, we could have said simply `diff !^.old !^' or, to get the arguments in the opposite order, just `diff !*'. The word or words in a history reference can be edited, or ``modified'', by following it with one or more modifiers, each preceded by a `:': h Remove a trailing pathname component, leaving the head. t Remove all leading pathname components, leav- ing the tail. r Remove a filename extension `.xxx', leaving the root name. e Remove all but the extension. u Uppercase the first lowercase letter. l Lowercase the first uppercase letter. s_/_l_/_r_/ Substitute _l for _r. _l is simply a string like _r, not a regular expression as in the epony- mous _e_d(1) command. Any character may be used as the delimiter in place of `/'; a `\' can be used to quote the delimiter inside _l and _r. The character `&' in the _r is replaced by _l; `\' also quotes `&'. If _l is empty (``''), the _l from a previous substitution or the _s from a previous `?_s?' event specification is used. The trailing delimiter may be omitted if it is immediately followed by a newline. & Repeat the previous substitution. g Apply the following modifier once to each word. a (+) Apply the following modifier as many times as possible to a single word. `a' and `g' can be used together to apply a modifier globally. In the current implementation, using the `a' and `s' modifiers together can lead to an infinite loop. For example, `:as/f/ff/' will never terminate. This behavior might change in the future. p Print the new command line but do not execute it. q Quote the substituted words, preventing fur- ther substitutions. x Like q, but break into words at blanks, tabs and newlines. Modifiers are applied to only the first modifiable word (unless `g' is used). It is an error for no word to be modifiable. For example, the `diff' command might have been written as `diff wumpus.man.old !#^:r', using `:r' to remove `.old' from the first argument on the same line (`!#^'). We could say `echo hello out there', then `echo !*:u' to cap- italize `hello', `echo !*:au' to say it out loud, or `echo !*:agu' to really shout. We might follow `mail -s "I for- got my password" rot' with `!:s/rot/root' to correct the spelling of `root' (but see SSppeelllliinngg ccoorrrreeccttiioonn for a dif- ferent approach). There is a special abbreviation for substitutions. `^', when it is the first character on an input line, is equiv- alent to `!:s^'. Thus we might have said `^rot^root' to make the spelling correction in the previous example. This is the only history substitution which does not explicitly begin with `!'. (+) In _c_s_h as such, only one modifier may be applied to each history or variable expansion. In _t_c_s_h, more than one may be used, for example % mv wumpus.man /usr/man/man1/wumpus.1 % man !$:t:r man wumpus In _c_s_h, the result would be `wumpus.1:r'. A substitution followed by a colon may need to be insulated from it with braces: > mv a.out /usr/games/wumpus > setenv PATH !$:h:$PATH Bad ! modifier: $. > setenv PATH !{-2$:h}:$PATH setenv PATH /usr/games:/bin:/usr/bin:. The first attempt would succeed in _c_s_h but fails in _t_c_s_h, because _t_c_s_h expects another modifier after the second colon rather than `$'. Finally, history can be accessed through the editor as well as through the substitutions just described. The _u_p_- and _d_o_w_n_-_h_i_s_t_o_r_y, _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_b_a_c_k_w_a_r_d and _-_f_o_r_w_a_r_d, _i_- _s_e_a_r_c_h_-_b_a_c_k and _-_f_w_d, _v_i_-_s_e_a_r_c_h_-_b_a_c_k and _-_f_w_d, _c_o_p_y_-_p_r_e_v_- _w_o_r_d and _i_n_s_e_r_t_-_l_a_s_t_-_w_o_r_d editor commands search for events in the history list and copy them into the input buffer. The _t_o_g_g_l_e_-_l_i_t_e_r_a_l_-_h_i_s_t_o_r_y editor command switches between the expanded and literal forms of history lines in the input buffer. _e_x_p_a_n_d_-_h_i_s_t_o_r_y and _e_x_p_a_n_d_-_l_i_n_e expand history substitutions in the current word and in the entire input buffer respectively. AAlliiaass ssuubbssttiittuuttiioonn The shell maintains a list of aliases which can be set, unset and printed by the _a_l_i_a_s and _u_n_a_l_i_a_s commands. After a command line is parsed into simple commands (see CCoommmmaannddss) the first word of each command, left-to-right, is checked to see if it has an alias. If so, the first word is replaced by the alias. If the alias contains a history reference, it undergoes HHiissttoorryy ssuubbssttiittuuttiioonn (q.v.) as though the original command were the previous input line. If the alias does not contain a history ref- erence, the argument list is left untouched. Thus if the alias for `ls' were `ls -l' the command `ls /usr' would become `ls -l /usr', the argument list here being undisturbed. If the alias for `lookup' were `grep !^ /etc/passwd' then `lookup bill' would become `grep bill /etc/passwd'. Aliases can be used to introduce parser metasyntax. For example, `alias print 'pr \!* | lpr'' defines a ``command'' (`print') which _p_r(1)s its arguments to the line printer. Alias substitution is repeated until the first word of the command has no alias. If an alias substitution does not change the first word (as in the previous example) it is flagged to prevent a loop. Other loops are detected and cause an error. Some aliases are referred to by the shell; see SSppeecciiaall aalliiaasseess. VVaarriiaabbllee ssuubbssttiittuuttiioonn The shell maintains a list of variables, each of which has as value a list of zero or more words. The values of shell variables can be displayed and changed with the _s_e_t and _u_n_s_e_t commands. The system maintains its own list of ``environment'' variables. These can be displayed and changed with _p_r_i_n_t_e_n_v, _s_e_t_e_n_v and _u_n_s_e_t_e_n_v. (+) Variables may be made read-only with `set -r' (q.v.) Read-only variables may not be modified or unset; attempt- ing to do so will cause an error. Once made read-only, a variable cannot be made writable, so `set -r' should be used with caution. Environment variables cannot be made read-only. Some variables are set by the shell or referred to by it. For instance, the aarrggvv variable is an image of the shell's argument list, and words of this variable's value are referred to in special ways. Some of the variables referred to by the shell are toggles; the shell does not care what their value is, only whether they are set or not. For instance, the vveerrbboossee variable is a toggle which causes command input to be echoed. The --vv command line option sets this variable. SSppeecciiaall sshheellll vvaarriiaabblleess lists all variables which are referred to by the shell. Other operations treat variables numerically. The `@' command permits numeric calculations to be performed and the result assigned to a variable. Variable values are, however, always represented as (zero or more) strings. For the purposes of numeric operations, the null string is considered to be zero, and the second and subsequent words of multi-word values are ignored. After the input line is aliased and parsed, and before each command is executed, variable substitution is per- formed keyed by `$' characters. This expansion can be prevented by preceding the `$' with a `\' except within `"'s where it _a_l_w_a_y_s occurs, and within `''s where it _n_e_v_e_r occurs. Strings quoted by ``' are interpreted later (see CCoommmmaanndd ssuubbssttiittuuttiioonn below) so `$' substitution does not occur there until later, if at all. A `$' is passed unchanged if followed by a blank, tab, or end-of-line. Input/output redirections are recognized before variable expansion, and are variable expanded separately. Other- wise, the command name and entire argument list are expanded together. It is thus possible for the first (command) word (to this point) to generate more than one word, the first of which becomes the command name, and the rest of which become arguments. Unless enclosed in `"' or given the `:q' modifier the results of variable substitution may eventually be command and filename substituted. Within `"', a variable whose value consists of multiple words expands to a (portion of a) single word, with the words of the variable's value separated by blanks. When the `:q' modifier is applied to a substitution the variable will expand to multiple words with each word separated by a blank and quoted to prevent later command or filename substitution. The following metasequences are provided for introducing variable values into the shell input. Except as noted, it is an error to reference a variable which is not set. $_n_a_m_e ${_n_a_m_e} Substitutes the words of the value of variable _n_a_m_e, each separated by a blank. Braces insulate _n_a_m_e from following characters which would other- wise be part of it. Shell variables have names consisting of up to 20 letters and digits starting with a letter. The underscore character is con- sidered a letter. If _n_a_m_e is not a shell vari- able, but is set in the environment, then that value is returned (but `:' modifiers and the other forms given below are not available in this case). $_n_a_m_e[_s_e_l_e_c_t_o_r] ${_n_a_m_e[_s_e_l_e_c_t_o_r]} Substitutes only the selected words from the value of _n_a_m_e. The _s_e_l_e_c_t_o_r is subjected to `$' substi- tution and may consist of a single number or two numbers separated by a `-'. The first word of a variable's value is numbered `1'. If the first number of a range is omitted it defaults to `1'. If the last member of a range is omitted it defaults to `$#_n_a_m_e'. The _s_e_l_e_c_t_o_r `*' selects all words. It is not an error for a range to be empty if the second argument is omitted or in range. $0 Substitutes the name of the file from which com- mand input is being read. An error occurs if the name is not known. $_n_u_m_b_e_r ${_n_u_m_b_e_r} Equivalent to `$argv[_n_u_m_b_e_r]'. $* Equivalent to `$argv', which is equivalent to `$argv[*]'. The `:' modifiers described under HHiissttoorryy ssuubbssttiittuuttiioonn, except for `:p', can be applied to the substitutions above. More than one may be used. (+) Braces may be needed to insulate a variable substitution from a literal colon just as with HHiissttoorryy ssuubbssttiittuuttiioonn (q.v.); any modi- fiers must appear within the braces. The following substitutions can not be modified with `:' modifiers. $?_n_a_m_e ${?_n_a_m_e} Substitutes the string `1' if _n_a_m_e is set, `0' if it is not. $?0 Substitutes `1' if the current input filename is known, `0' if it is not. Always `0' in interac- tive shells. $#_n_a_m_e ${#_n_a_m_e} Substitutes the number of words in _n_a_m_e. $# Equivalent to `$#argv'. (+) $%_n_a_m_e ${%_n_a_m_e} Substitutes the number of characters in _n_a_m_e. (+) $%_n_u_m_b_e_r ${%_n_u_m_b_e_r} Substitutes the number of characters in $argv[_n_u_m_- _b_e_r]. (+) $? Equivalent to `$status'. (+) $$ Substitutes the (decimal) process number of the (parent) shell. $! Substitutes the (decimal) process number of the last background process started by this shell. (+) $_ Substitutes the command line of the last command executed. (+) $< Substitutes a line from the standard input, with no further interpretation thereafter. It can be used to read from the keyboard in a shell script. (+) While _c_s_h always quotes $<, as if it were equivalent to `$<:q', _t_c_s_h does not. Furthermore, when _t_c_s_h is waiting for a line to be typed the user may type an interrupt to interrupt the sequence into which the line is to be substituted, but _c_s_h does not allow this. The editor command _e_x_p_a_n_d_-_v_a_r_i_a_b_l_e_s, normally bound to `^X-$', can be used to interactively expand individual variables. CCoommmmaanndd,, ffiilleennaammee aanndd ddiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn The remaining substitutions are applied selectively to the arguments of builtin commands. This means that portions of expressions which are not evaluated are not subjected to these expansions. For commands which are not internal to the shell, the command name is substituted separately from the argument list. This occurs very late, after input-output redirection is performed, and in a child of the main shell. CCoommmmaanndd ssuubbssttiittuuttiioonn Command substitution is indicated by a command enclosed in ``'. The output from such a command is broken into sepa- rate words at blanks, tabs and newlines, and null words are discarded. The output is variable and command substi- tuted and put in place of the original string. Command substitutions inside double quotes (`"') retain blanks and tabs; only newlines force new words. The sin- gle final newline does not force a new word in any case. It is thus possible for a command substitution to yield only part of a word, even if the command outputs a com- plete line. FFiilleennaammee ssuubbssttiittuuttiioonn If a word contains any of the characters `*', `?', `[' or `{' or begins with the character `~' it is a candidate for filename substitution, also known as ``globbing''. This word is then regarded as a pattern (``glob-pattern''), and replaced with an alphabetically sorted list of file names which match the pattern. In matching filenames, the character `.' at the beginning of a filename or immediately following a `/', as well as the character `/' must be matched explicitly. The charac- ter `*' matches any string of characters, including the null string. The character `?' matches any single charac- ter. The sequence `[...]' matches any one of the charac- ters enclosed. Within `[...]', a pair of characters sepa- rated by `-' matches any character lexically between the two. (+) Some glob-patterns can be negated: The sequence `[^...]' matches any single character _n_o_t specified by the characters and/or ranges of characters in the braces. An entire glob-pattern can also be negated with `^': > echo * bang crash crunch ouch > echo ^cr* bang ouch Glob-patterns which do not use `?', `*', or `[]' or which use `{}' or `~' (below) are not negated correctly. The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'. Left-to-right order is preserved: `/usr/source/s1/{oldls,ls}.c' expands to `/usr/source/s1/oldls.c /usr/source/s1/ls.c'. The results of matches are sorted separately at a low level to pre- serve this order: `../{memo,*box}' might expand to `../memo ../box ../mbox'. (Note that `memo' was not sorted with the results of matching `*box'.) It is not an error when this construct expands to files which do not exist, but it is possible to get an error from a command to which the expanded list is passed. This construct may be nested. As a special case the words `{', `}' and `{}' are passed undisturbed. The character `~' at the beginning of a filename refers to home directories. Standing alone, i.e., `~', it expands to the invoker's home directory as reflected in the value of the hhoommee shell variable. When followed by a name con- sisting of letters, digits and `-' characters the shell searches for a user with that name and substitutes their home directory; thus `~ken' might expand to `/usr/ken' and `~ken/chmach' to `/usr/ken/chmach'. If the character `~' is followed by a character other than a letter or `/' or appears elsewhere than at the beginning of a word, it is left undisturbed. A command like `setenv MANPATH /usr/man:/usr/local/man:~/lib/man' does not, therefore, do home directory substitution as one might hope. It is an error for a glob-pattern containing `*', `?', `[' or `~', with or without `^', not to match any files. How- ever, only one pattern in a list of glob-patterns must match a file (so that, e.g., `rm *.a *.c *.o' would fail only if there were no files in the current directory end- ing in `.a', `.c', or `.o'), and if the nnoonnoommaattcchh shell variable is set a pattern (or list of patterns) which matches nothing is left unchanged rather than causing an error. The nnoogglloobb shell variable can be set to prevent filename substitution, and the _e_x_p_a_n_d_-_g_l_o_b editor command, normally bound to `^X-*', can be used to interactively expand indi- vidual filename substitutions. DDiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn ((++)) The directory stack is a list of directories, numbered from zero, used by the _p_u_s_h_d, _p_o_p_d and _d_i_r_s builtin com- mands (q.v.). _d_i_r_s can print, store in a file, restore and clear the directory stack at any time, and the ssaavveeddiirrss and ddiirrssffiillee shell variables can be set to store the directory stack automatically on logout and restore it on login. The ddiirrssttaacckk shell variable can be examined to see the directory stack and set to put arbitrary directo- ries into the directory stack. The character `=' followed by one or more digits expands to an entry in the directory stack. The special case `=-' expands to the last directory in the stack. For example, > dirs -v 0 /usr/bin 1 /usr/spool/uucp 2 /usr/accts/sys > echo =1 /usr/spool/uucp > echo =0/calendar /usr/bin/calendar > echo =- /usr/accts/sys The nnoogglloobb and nnoonnoommaattcchh shell variables and the _e_x_p_a_n_d_- _g_l_o_b editor command apply to directory stack as well as filename substitutions. OOtthheerr ssuubbssttiittuuttiioonnss ((++)) There are several more transformations involving file- names, not strictly related to the above but mentioned here for completeness. _A_n_y filename may be expanded to a full path when the ssyymmlliinnkkss variable (q.v.) is set to `expand'. Quoting prevents this expansion, and the _n_o_r_- _m_a_l_i_z_e_-_p_a_t_h editor command does it on demand. The _n_o_r_m_a_l_- _i_z_e_-_c_o_m_m_a_n_d editor command expands commands in PATH into full paths on demand. Finally, _c_d and _p_u_s_h_d interpret `-' as the old working directory (equivalent to the shell variable oowwdd). This is not a substitution at all, but an abbreviation recognized by only those commands. Nonethe- less, it too can be prevented by quoting. CCoommmmaannddss The next three sections describe how the shell executes commands and deals with their input and output. SSiimmppllee ccoommmmaannddss,, ppiippeelliinneess aanndd sseeqquueenncceess A simple command is a sequence of words, the first of which specifies the command to be executed. A series of simple commands joined by `|' characters forms a pipeline. The output of each command in a pipeline is connected to the input of the next. Simple commands and pipelines may be joined into sequences with `;', and will be executed sequentially. Commands and pipelines can also be joined into sequences with `||' or `&&', indicating, as in the C language, that the second is to be executed only if the first fails or succeeds respec- tively. A simple command, pipeline or sequence may be placed in parentheses, `()', to form a simple command, which may in turn be a component of a pipeline or sequence. A command, pipeline or sequence can be executed without waiting for it to terminate by following it with an `&'. BBuuiillttiinn aanndd nnoonn--bbuuiillttiinn ccoommmmaanndd eexxeeccuuttiioonn Builtin commands are executed within the shell. If any component of a pipeline except the last is a builtin com- mand, the pipeline is executed in a subshell. Parenthesized commands are always executed in a subshell. (cd; pwd); pwd thus prints the hhoommee directory, leaving you where you were (printing this after the home directory), while cd; pwd leaves you in the hhoommee directory. Parenthesized commands are most often used to prevent _c_d from affecting the cur- rent shell. When a command to be executed is found not to be a builtin command the shell attempts to execute the command via _e_x_e_c_v_e(2). Each word in the variable ppaatthh names a direc- tory in which the shell will look for the command. If it is given neither a --cc nor a --tt option, the shell hashes the names in these directories into an internal table so that it will try an _e_x_e_c_v_e(2) in only a directory where there is a possibility that the command resides there. This greatly speeds command location when a large number of directories are present in the search path. If this mechanism has been turned off (via _u_n_h_a_s_h), if the shell was given a --cc or --tt argument or in any case for each directory component of ppaatthh which does not begin with a `/', the shell concatenates the current working directory with the given command name to form a path name of a file which it then attempts to execute. If the file has execute permissions but is not an exe- cutable to the system (i.e., it is neither an executable binary nor a script that specifies its interpreter), then it is assumed to be a file containing shell commands and a new shell is spawned to read it. The _s_h_e_l_l special alias may be set to specify an interpreter other than the shell itself. On systems which do not understand the `#!' script inter- preter convention the shell may be compiled to emulate it; see the vveerrssiioonn shell variable. If so, the shell checks the first line of the file to see if it is of the form `#!_i_n_t_e_r_p_r_e_t_e_r _a_r_g ...'. If it is, the shell starts _i_n_t_e_r_p_r_e_t_e_r with the given _a_r_gs and feeds the file to it on standard input. IInnppuutt//oouuttppuutt The standard input and standard output of a command may be redirected with the following syntax: < _n_a_m_e Open file _n_a_m_e (which is first variable, command and filename expanded) as the standard input. << _w_o_r_d Read the shell input up to a line which is identi- cal to _w_o_r_d. _w_o_r_d is not subjected to variable, filename or command substitution, and each input line is compared to _w_o_r_d before any substitutions are done on this input line. Unless a quoting `\', `"', `' or ``' appears in _w_o_r_d variable and command substitution is performed on the interven- ing lines, allowing `\' to quote `$', `\' and ``'. Commands which are substituted have all blanks, tabs, and newlines preserved, except for the final newline which is dropped. The resultant text is placed in an anonymous temporary file which is given to the command as standard input. > _n_a_m_e _>_! _n_a_m_e _>_& _n_a_m_e _>_&_! _n_a_m_e The file _n_a_m_e is used as standard output. If the file does not exist then it is created; if the file exists, it is truncated, its previous con- tents being lost. If the shell variable nnoocclloobbbbeerr is set, then the file must not exist or be a character special file (e.g., a terminal or `/dev/null') or an error results. This helps prevent accidental destruc- tion of files. In this case the `!' forms can be used to suppress this check. The forms involving `&' route the diagnostic out- put into the specified file as well as the stan- dard output. _n_a_m_e is expanded in the same way as `<' input filenames are. >> _n_a_m_e _>_>_& _n_a_m_e _>_>_! _n_a_m_e _>_>_&_! _n_a_m_e Like `>', but appends output to the end of _n_a_m_e. If the shell variable nnoocclloobbbbeerr is set, then it is an error for the file _n_o_t to exist, unless one of the `!' forms is given. A command receives the environment in which the shell was invoked as modified by the input-output parameters and the presence of the command in a pipeline. Thus, unlike some previous shells, commands run from a file of shell com- mands have no access to the text of the commands by default; rather they receive the original standard input of the shell. The `<<' mechanism should be used to pre- sent inline data. This permits shell command scripts to function as components of pipelines and allows the shell to block read its input. Note that the default standard input for a command run detached is _n_o_t the empty file _/_d_e_v_/_n_u_l_l, but the original standard input of the shell. If this is a terminal and if the process attempts to read from the terminal, then the process will block and the user will be notified (see JJoobbss). Diagnostic output may be directed through a pipe with the standard output. Simply use the form `|&' rather than just `|'. The shell cannot presently redirect diagnostic output without also redirecting standard output, but `(_c_o_m_m_a_n_d > _o_u_t_p_u_t_-_f_i_l_e) >& _e_r_r_o_r_-_f_i_l_e' is often an acceptable workaround. Either _o_u_t_p_u_t_-_f_i_l_e or _e_r_r_o_r_-_f_i_l_e may be `/dev/tty' to send output to the terminal. FFeeaattuurreess Having described how the shell accepts, parses and exe- cutes command lines, we now turn to a variety of its use- ful features. CCoonnttrrooll ffllooww The shell contains a number of commands which can be used to regulate the flow of control in command files (shell scripts) and (in limited but useful ways) from terminal input. These commands all operate by forcing the shell to reread or skip in its input and, due to the implementa- tion, restrict the placement of some of the commands. The _f_o_r_e_a_c_h, _s_w_i_t_c_h, and _w_h_i_l_e statements, as well as the _i_f_-_t_h_e_n_-_e_l_s_e form of the _i_f statement, require that the major keywords appear in a single simple command on an input line as shown below. If the shell's input is not seekable, the shell buffers up input whenever a loop is being read and performs seeks in this internal buffer to accomplish the rereading implied by the loop. (To the extent that this allows, backward _g_o_t_os will succeed on non-seekable inputs.) EExxpprreessssiioonnss The _i_f, _w_h_i_l_e and _e_x_i_t builtin commands use expressions with a common syntax. The expressions can include any of the operators described in the next three sections. Note that the _@ builtin command (q.v.) has its own separate syntax. LLooggiiccaall,, aarriitthhmmeettiiccaall aanndd ccoommppaarriissoonn ooppeerraattoorrss These operators are similar to those of C and have the same precedence. They include || && | ^ & == != =~ !~ <= >= < > << >> + - * / % ! ~ ( ) Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<=' `>=' `<' and `>', `<<' and `>>', `+' and `-', `*' `/' and `%' being, in groups, at the same level. The `==' `!=' `=~' and `!~' operators compare their argu- ments as strings; all others operate on numbers. The operators `=~' and `!~' are like `!=' and `==' except that the right hand side is a glob-pattern (see FFiilleennaammee ssuubb-- ssttiittuuttiioonn) against which the left hand operand is matched. This reduces the need for use of the _s_w_i_t_c_h builtin com- mand in shell scripts when all that is really needed is pattern matching. Strings which begin with `0' are considered octal numbers. Null or missing arguments are considered `0'. The results of all expressions are strings, which represent decimal numbers. It is important to note that no two components of an expression can appear in the same word; except when adjacent to components of expressions which are syntacti- cally significant to the parser (`&' `|' `<' `>' `(' `)') they should be surrounded by spaces. CCoommmmaanndd eexxiitt ssttaattuuss Commands can be executed in expressions and their exit status returned by enclosing them in braces (`{}'). Remember that the braces should be separated from the words of the command by spaces. Command executions suc- ceed, returning true, i.e., `1', if the command exits with status 0, otherwise they fail, returning false, i.e., `0'. If more detailed status information is required then the command should be executed outside of an expression and the ssttaattuuss shell variable examined. FFiillee iinnqquuiirryy ooppeerraattoorrss Some of these operators perform true/false tests on files and related objects. They are of the form --_o_p _f_i_l_e, where _o_p is one of rr Read access ww Write access xx Execute access XX Executable in the path or shell builtin, e.g., `-X ls' and `-X ls-F' are generally true, but `-X /bin/ls' is not (+) ee Existence oo Ownership zz Zero size ss Non-zero size (+) ff Plain file dd Directory ll Symbolic link (+) * bb Block special file (+) cc Character special file (+) pp Named pipe (fifo) (+) * SS Socket special file (+) * uu Set-user-ID bit is set (+) gg Set-group-ID bit is set (+) kk Sticky bit is set (+) tt _f_i_l_e (which must be a digit) is an open file descriptor for a terminal device (+) RR Has been migrated (convex only) (+) LL Applies subsequent operators in a multiple-opera- tor test to a symbolic link rather than to the file to which the link points (+) * _f_i_l_e is command and filename expanded and then tested to see if it has the specified relationship to the real user. If _f_i_l_e does not exist or is inaccessible or, for the operators indicated by `*', if the specified file type does not exist on the current system, then all enquiries return false, i.e., `0'. These operators may be combined for conciseness: `-_x_y _f_i_l_e' is equivalent to `-_x _f_i_l_e && -_y _f_i_l_e'. (+) For example, `-fx' is true (returns `1') for plain executable files, but not for directories. LL may be used in a multiple-operator test to apply subse- quent operators to a symbolic link rather than to the file to which the link points. For example, `-lLo' is true for links owned by the invoking user. LLrr, LLww and LLxx are always true for links and false for non-links. LL has a different meaning when it is the last operator in a multi- ple-operator test; see below. It is possible but not useful, and sometimes misleading, to combine operators which expect _f_i_l_e to be a file with operators which do not, (e.g., XX and tt). Following LL with a non-file operator can lead to particularly strange results. Other operators return other information, i.e., not just `0' or `1'. (+) They have the same format as before; _o_p may be one of AA Last file access time, as the number of sec- onds since the epoch AA:: Like AA, but in timestamp format, e.g., `Fri May 14 16:36:10 1993' MM Last file modification time MM:: Like MM, but in timestamp format CC Last inode modification time CC:: Like CC, but in timestamp format DD Device number II Inode number FF Composite ffile identifier, in the form _d_e_v_i_c_e:_i_n_o_d_e LL The name of the file pointed to by a symbolic link NN Number of (hard) links PP Permissions, in octal, without leading zero PP:: Like PP, with leading zero PP_m_o_d_e Equivalent to `-P _f_i_l_e & _m_o_d_e', e.g., `-P22 _f_i_l_e' returns `22' if _f_i_l_e is writable by group and other, `20' if by group only, and `0' if by neither PP_m_o_d_e:: Like PP_m_o_d_e::, with leading zero UU Numeric userid UU:: Username, or the numeric userid if the user- name is unknown GG Numeric groupid GG:: Groupname, or the numeric groupid if the groupname is unknown ZZ Size, in bytes Only one of these operators may appear in a multiple-oper- ator test, and it must be the last. Note that LL has a different meaning at the end of and elsewhere in a multi- ple-operator test. Because `0' is a valid return value for many of these operators, they do not return `0' when they fail: most return `-1', and FF returns `:'. If the shell is compiled with POSIX defined (see the vveerr-- ssiioonn shell variable), the result of a file inquiry is based on the permission bits of the file and not on the result of the _a_c_c_e_s_s(2) system call. For example, if one tests a file with --ww whose permissions would ordinarily allow writing but which is on a file system mounted read- only, the test will succeed in a POSIX shell but fail in a non-POSIX shell. File inquiry operators can also be evaluated with the _f_i_l_e_t_e_s_t builtin command (q.v.) (+). JJoobbss The shell associates a _j_o_b with each pipeline. It keeps a table of current jobs, printed by the _j_o_b_s command, and assigns them small integer numbers. When a job is started asynchronously with `&', the shell prints a line which looks like [1] 1234 indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process id was 1234. If you are running a job and wish to do something else you may hit the suspend key (usually `^Z'), which sends a STOP signal to the current job. The shell will then normally indicate that the job has been `Suspended' and print another prompt. If the lliissttjjoobbss shell variable is set, all jobs will be listed like the _j_o_b_s builtin command; if it is set to `long' the listing will be in long format, like `jobs -l'. You can then manipulate the state of the suspended job. You can put it in the ``background'' with the _b_g command or run some other commands and eventually bring the job back into the ``foreground'' with _f_g. (See also the _r_u_n_-_f_g_-_e_d_i_t_o_r editor command.) A `^Z' takes effect immediately and is like an interrupt in that pend- ing output and unread input are discarded when it is typed. The _w_a_i_t builtin command causes the shell to wait for all background jobs to complete. The `^]' key sends a delayed suspend signal, which does not generate a STOP signal until a program attempts to _r_e_a_d(2) it, to the current job. This can usefully be typed ahead when you have prepared some commands for a job which you wish to stop after it has read them. The `^Y' key performs this function in _c_s_h(1); in _t_c_s_h, `^Y' is an editing command. (+) A job being run in the background stops if it tries to read from the terminal. Background jobs are normally allowed to produce output, but this can be disabled by giving the command `stty tostop'. If you set this tty option, then background jobs will stop when they try to produce output like they do when they try to read input. There are several ways to refer to jobs in the shell. The character `%' introduces a job name. If you wish to refer to job number 1, you can name it as `%1'. Just naming a job brings it to the foreground; thus `%1' is a synonym for `fg %1', bringing job 1 back into the foreground. Similarly, saying `%1 &' resumes job 1 in the background, just like `bg %1'. A job can also be named by an unam- biguous prefix of the string typed in to start it: `%ex' would normally restart a suspended _e_x(1) job, if there were only one suspended job whose name began with the string `ex'. It is also possible to say `%?_s_t_r_i_n_g' to specify a job whose text contains _s_t_r_i_n_g, if there is only one such job. The shell maintains a notion of the current and previous jobs. In output pertaining to jobs, the current job is marked with a `+' and the previous job with a `-'. The abbreviations `%+', `%', and (by analogy with the syntax of the _h_i_s_t_o_r_y mechanism) `%%' all refer to the current job, and `%-' refers to the previous job. The job control mechanism requires that the _s_t_t_y(1) option `new' be set on some systems. It is an artifact from a `new' implementation of the tty driver which allows gener- ation of interrupt characters from the keyboard to tell jobs to stop. See _s_t_t_y(1) and the _s_e_t_t_y builtin command for details on setting options in the new tty driver. SSttaattuuss rreeppoorrttiinngg The shell learns immediately whenever a process changes state. It normally informs you whenever a job becomes blocked so that no further progress is possible, but only right before it prints a prompt. This is done so that it does not otherwise disturb your work. If, however, you set the shell variable nnoottiiffyy, the shell will notify you immediately of changes of status in background jobs. There is also a shell command _n_o_t_i_f_y which marks a single process so that its status changes will be immediately reported. By default _n_o_t_i_f_y marks the current process; simply say `notify' after starting a background job to mark it. When you try to leave the shell while jobs are stopped, you will be warned that `You have stopped jobs.' You may use the _j_o_b_s command to see what they are. If you do this or immediately try to exit again, the shell will not warn you a second time, and the suspended jobs will be termi- nated. AAuuttoommaattiicc,, ppeerriiooddiicc aanndd ttiimmeedd eevveennttss ((++)) There are various ways to run commands and take other actions automatically at various times in the ``life cycle'' of the shell. They are summarized here, and described in detail under the appropriate BBuuiillttiinn ccoommmmaannddss, SSppeecciiaall sshheellll vvaarriiaabblleess and SSppeecciiaall aalliiaasseess. The _s_c_h_e_d builtin command puts commands in a scheduled- event list, to be executed by the shell at a given time. The _b_e_e_p_c_m_d, _c_w_d_c_m_d, _p_e_r_i_o_d_i_c, _p_r_e_c_m_d, and _p_o_s_t_c_m_d SSppeecciiaall aalliiaasseess can be set, respectively, to execute commands when the shell wants to ring the bell, when the working direc- tory changes, every ttppeerriioodd minutes, before each prompt, and before each command gets executed. The aauuttoollooggoouutt shell variable can be set to log out or lock the shell after a given number of minutes of inactiv- ity. The mmaaiill shell variable can be set to check for new mail periodically. The pprriinntteexxiittvvaalluuee shell variable can be set to print the exit status of commands which exit with a status other than zero. The rrmmssttaarr shell variable can be set to ask the user, when `rm *' is typed, if that is really what was meant. The ttiimmee shell variable can be set to execute the _t_i_m_e builtin command after the completion of any process that takes more than a given number of CPU seconds. The wwaattcchh and wwhhoo shell variables can be set to report when selected users log in or out, and the _l_o_g builtin command reports on those users at any time. NNaattiivvee LLaanngguuaaggee SSyysstteemm ssuuppppoorrtt ((++)) The shell is eight bit clean (if so compiled; see the vveerr-- ssiioonn shell variable) and thus supports character sets needing this capability. NLS support differs depending on whether or not the shell was compiled to use the system's NLS (again, see vveerrssiioonn). In either case, 7-bit ASCII is the default for character classification (e.g., which characters are printable) and sorting, and changing the LLAANNGG or LLCC__CCTTYYPPEE environment variables causes a check for possible changes in these respects. When using the system's NLS, the _s_e_t_l_o_c_a_l_e(3) function is called to determine appropriate character classification and sorting. This function typically examines the LLAANNGG and LLCC__CCTTYYPPEE environment variables; refer to the system documentation for further details. When not using the system's NLS, the shell simulates it by assuming that the ISO 8859-1 character set is used whenever either of the LLAANNGG and LLCC__CCTTYYPPEE variables are set, regardless of their values. Sorting is not affected for the simulated NLS. In addition, with both real and simulated NLS, all print- able characters in the range \200-\377, i.e., those that have M-_c_h_a_r bindings, are automatically rebound to _s_e_l_f_- _i_n_s_e_r_t_-_c_o_m_m_a_n_d. The corresponding binding for the escape- _c_h_a_r sequence, if any, is left alone. These characters are not rebound if the NNOORREEBBIINNDD environment variable is set. This may be useful for the simulated NLS or a primi- tive real NLS which assumes full ISO 8859-1. Otherwise, all M-_c_h_a_r bindings in the range \240-\377 are effectively undone. Explicitly rebinding the relevant keys with _b_i_n_d_- _k_e_y is of course still possible. Unknown characters (i.e., those that are neither printable nor control characters) are printed in the format \nnn. If the tty is not in 8 bit mode, other 8 bit characters are printed by converting them to ASCII and using standout mode. The shell never changes the 7/8 bit mode of the tty and tracks user-initiated changes of 7/8 bit mode. NLS users (or, for that matter, those who want to use a meta key) may need to explicitly set the tty in 8 bit mode through the appropriate _s_t_t_y(1) command in, e.g., the _~_/_._l_o_g_i_n file. OOSS vvaarriiaanntt ssuuppppoorrtt ((++)) A number of new builtin commands are provided to support features in particular operating systems. All are described in detail in the BBuuiillttiinn ccoommmmaannddss section. On systems that support TCF (aix-ibm370, aix-ps2), _g_e_t_s_p_a_t_h and _s_e_t_s_p_a_t_h get and set the system execution path, _g_e_t_x_v_e_r_s and _s_e_t_x_v_e_r_s get and set the experimental version prefix and _m_i_g_r_a_t_e migrates processes between sites. The _j_o_b_s builtin prints the site on which each job is executing. Under Domain/OS, _i_n_l_i_b adds shared libraries to the cur- rent environment, _r_o_o_t_n_o_d_e changes the rootnode and _v_e_r changes the systype. Under Mach, _s_e_t_p_a_t_h is equivalent to Mach's _s_e_t_p_a_t_h(1). Under Masscomp/RTU and Harris CX/UX, _u_n_i_v_e_r_s_e sets the universe. Under Harris CX/UX, _u_c_b or _a_t_t runs a command under the specified universe. Under Convex/OS, _w_a_r_p prints or sets the universe. The VVEENNDDOORR, OOSSTTYYPPEE and MMAACCHHTTYYPPEE environment variables indicate respectively the vendor, operating system and machine type (microprocessor class or machine model) of the system on which the shell thinks it is running. These are particularly useful when sharing one's home directory between several types of machines; one can, for example, set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .) in one's _~_/_._l_o_g_i_n and put executables compiled for each machine in the appropriate directory. The vveerrssiioonn shell variable indicates what options were chosen when the shell was compiled. Note also the _n_e_w_g_r_p builtin, the aaffssuusseerr and eecchhoo__ssttyyllee shell variables and the system-dependent locations of the shell's input files (see FFIILLEESS). SSiiggnnaall hhaannddlliinngg Login shells ignore interrupts when reading the file _~_/_._l_o_g_o_u_t. The shell ignores quit signals unless started with --qq. Login shells catch the terminate signal, but non-login shells inherit the terminate behavior from their parents. Other signals have the values which the shell inherited from its parent. In shell scripts, the shell's handling of interrupt and terminate signals can be controlled with _o_n_i_n_t_r, and its handling of hangups can be controlled with _h_u_p and _n_o_h_u_p. The shell exits on a hangup (see also the llooggoouutt shell variable). By default, the shell's children do too, but the shell does not send them a hangup when it exits. _h_u_p arranges for the shell to send a hangup to a child when it exits, and _n_o_h_u_p sets a child to ignore hangups. TTeerrmmiinnaall mmaannaaggeemmeenntt ((++)) The shell uses three different sets of terminal (``tty'') modes: `edit', used when editing, `quote', used when quot- ing literal characters, and `execute', used when executing commands. The shell holds some settings in each mode con- stant, so commands which leave the tty in a confused state do not interfere with the shell. The shell also matches changes in the speed and padding of the tty. The list of tty modes that are kept constant can be examined and modi- fied with the _s_e_t_t_y builtin. Note that although the edi- tor uses CBREAK mode (or its equivalent), it takes typed- ahead characters anyway. The _e_c_h_o_t_c, _s_e_t_t_c and _t_e_l_l_t_c commands can be used to manipulate and debug terminal capabilities from the com- mand line. On systems that support SIGWINCH or SIGWINDOW, the shell adapts to window resizing automatically and adjusts the environment variables LLIINNEESS and CCOOLLUUMMNNSS if set. If the environment variable TTEERRMMCCAAPP contains li# and co# fields, the shell adjusts them to reflect the new window size. RREEFFEERREENNCCEE The next sections of this manual describe all of the available BBuuiillttiinn ccoommmmaannddss, SSppeecciiaall aalliiaasseess and SSppeecciiaall sshheellll vvaarriiaabblleess. BBuuiillttiinn ccoommmmaannddss %%_j_o_b A synonym for the _f_g builtin command. %%_j_o_b && A synonym for the _b_g builtin command. :: Does nothing, successfully. @@ @@ _n_a_m_e == _e_x_p_r @@ _n_a_m_e[_i_n_d_e_x] == _e_x_p_r @@ _n_a_m_e++++|---- @@ _n_a_m_e[_i_n_d_e_x]++++|---- The first form prints the values of all shell variables. The second form assigns the value of _e_x_p_r to _n_a_m_e. The third form assigns the value of _e_x_p_r to the _i_n_d_e_x'th component of _n_a_m_e; both _n_a_m_e and its _i_n_d_e_x'th component must already exist. _e_x_p_r may contain the operators `*', `+', etc., as in C. If _e_x_p_r contains `<', `>', `&' or `' then at least that part of _e_x_p_r must be placed within `()'. Note that the syntax of _e_x_p_r has nothing to do with that described under EExxpprreessssiioonnss. The fourth and fifth forms increment (`++') or decrement (`--') _n_a_m_e or its _i_n_d_e_x'th component. The space between `@' and _n_a_m_e is required. The spaces between _n_a_m_e and `=' and between `=' and _e_x_p_r are optional. Components of _e_x_p_r must be separated by spaces. aalliiaass [_n_a_m_e [_w_o_r_d_l_i_s_t]] Without arguments, prints all aliases. With _n_a_m_e, prints the alias for name. With _n_a_m_e and _w_o_r_d_l_i_s_t, assigns _w_o_r_d_l_i_s_t as the alias of _n_a_m_e. _w_o_r_d_l_i_s_t is command and filename substituted. _n_a_m_e may not be `alias' or `unalias'. See also the _u_n_a_l_i_a_s builtin command. aalllloocc Shows the amount of dynamic memory acquired, bro- ken down into used and free memory. With an argu- ment shows the number of free and used blocks in each size category. The categories start at size 8 and double at each step. This command's output may vary across system types, because systems other than the VAX may use a different memory allocator. bbgg [%%_j_o_b ...] Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. _j_o_b may be a number, a string, `', `%', `+' or `-' as described under JJoobbss. bbiinnddkkeeyy [--ll|--dd|--ee|--vv|--uu] (+) bbiinnddkkeeyy [--aa] [--bb] [--kk] [--rr] [----] _k_e_y (+) bbiinnddkkeeyy [--aa] [--bb] [--kk] [--cc|--ss] [----] _k_e_y _c_o_m_m_a_n_d (+) Without options, the first form lists all bound keys and the editor command to which each is bound, the second form lists the editor command to which _k_e_y is bound and the third form binds the editor command _c_o_m_m_a_n_d to _k_e_y. Options include: --ll Lists all editor commands and a short descrip- tion of each. --dd Binds all keys to the standard bindings for the default editor. --ee Binds all keys to the standard GNU Emacs-like bindings. --vv Binds all keys to the standard _v_i(1)-like bindings. --aa Lists or changes key-bindings in the alterna- tive key map. This is the key map used in _v_i command mode. --bb _k_e_y is interpreted as a control character written ^_c_h_a_r_a_c_t_e_r (e.g., `^A') or C-_c_h_a_r_a_c_t_e_r (e.g., `C-A'), a meta character written M- _c_h_a_r_a_c_t_e_r (e.g., `M-A'), a function key writ- ten F-_s_t_r_i_n_g (e.g., `F-string'), or an extended prefix key written X-_c_h_a_r_a_c_t_e_r (e.g., `X-A'). --kk _k_e_y is interpreted as a symbolic arrow key name, which may be one of `down', `up', `left' or `right'. --rr Removes _k_e_y's binding. Be careful: `bindkey -r' does _n_o_t bind _k_e_y to _s_e_l_f_-_i_n_s_e_r_t_-_c_o_m_m_a_n_d (q.v.), it unbinds _k_e_y completely. --cc _c_o_m_m_a_n_d is interpreted as a builtin or exter- nal command instead of an editor command. --ss _c_o_m_m_a_n_d is taken as a literal string and treated as terminal input when _k_e_y is typed. Bound keys in _c_o_m_m_a_n_d are themselves reinterpreted, and this continues for ten lev- els of interpretation. ---- Forces a break from option processing, so the next word is taken as _k_e_y even if it begins with '-'. --uu (or any invalid option) Prints a usage message. _k_e_y may be a single character or a string. If a command is bound to a string, the first character of the string is bound to _s_e_q_u_e_n_c_e_-_l_e_a_d_-_i_n and the entire string is bound to the command. Control characters in _k_e_y can be literal (they can be typed by preceding them with the editor command _q_u_o_t_e_d_-_i_n_s_e_r_t, normally bound to `^V') or written caret-character style, e.g., `^A'. Delete is written `^?' (caret-question mark). _k_e_y and _c_o_m_- _m_a_n_d can contain backslashed escape sequences (in the style of System V _e_c_h_o(1)) as follows: \\aa Bell \\bb Backspace \\ee Escape \\ff Form feed \\nn Newline \\rr Carriage return \\tt Horizontal tab \\vv Vertical tab \\_n_n_n The ASCII character corresponding to the octal number _n_n_n `\' nullifies the special meaning of the following character, if it has any, notably `\' and `^'. bbrreeaakk Causes execution to resume after the _e_n_d of the nearest enclosing _f_o_r_e_a_c_h or _w_h_i_l_e. The remaining commands on the current line are executed. Multi- level breaks are thus possible by writing them all on one line. bbrreeaakkssww Causes a break from a _s_w_i_t_c_h, resuming after the _e_n_d_s_w. bbuuiillttiinnss (+) Prints the names of all builtin commands. bbyyee (+) A synonym for the _l_o_g_o_u_t builtin command. Avail- able only if the shell was so compiled; see the vveerrssiioonn shell variable. ccaassee _l_a_b_e_l:: A label in a _s_w_i_t_c_h statement as discussed below. ccdd [--pp] [--ll] [--nn|--vv] [_n_a_m_e] If a directory _n_a_m_e is given, changes the shell's working directory to _n_a_m_e. If not, changes to hhoommee. If _n_a_m_e is `-' it is interpreted as the previous working directory (see OOtthheerr ssuubbssttiittuu-- ttiioonnss). (+) If _n_a_m_e is not a subdirectory of the current directory (and does not begin with `/', `./' or `../'), each component of the variable ccddppaatthh is checked to see if it has a subdirectory _n_a_m_e. Finally, if all else fails but _n_a_m_e is a shell variable whose value begins with `/', then this is tried to see if it is a directory. With --pp, prints the final directory stack, just like _d_i_r_s. The --ll, --nn and --vv flags have the same effect on _c_d as on _d_i_r_s, and they imply --pp. (+) See also the iimmpplliicciittccdd shell variable. cchhddiirr A synonym for the _c_d builtin command. ccoommpplleettee [_c_o_m_m_a_n_d [_w_o_r_d//_p_a_t_t_e_r_n//_l_i_s_t[::_s_e_l_e_c_t]//[[_s_u_f_f_i_x]//] ...]] (+) Without arguments, lists all completions. With _c_o_m_m_a_n_d, lists completions for _c_o_m_m_a_n_d. With _c_o_m_- _m_a_n_d and _w_o_r_d etc., defines completions. _c_o_m_m_a_n_d may be a full command name or a glob-pat- tern (see FFiilleennaammee ssuubbssttiittuuttiioonn). It can begin with `-' to indicate that completion should be used only when _c_o_m_m_a_n_d is ambiguous. _w_o_r_d specifies which word relative to the current word is to be completed, and may be one of the following: cc Current-word completion. _p_a_t_t_e_r_n is a glob-pattern which must match the begin- ning of the current word on the command line. _p_a_t_t_e_r_n is ignored when completing the current word. CC Like cc, but includes _p_a_t_t_e_r_n when complet- ing the current word. nn Next-word completion. _p_a_t_t_e_r_n is a glob- pattern which must match the beginning of the previous word on the command line. NN Like nn, but must match the beginning of the word two before the current word. pp Position-dependent completion. _p_a_t_t_e_r_n is a numeric range, with the same syntax used to index shell variables, which must include the current word. _l_i_s_t, the list of possible completions, may be one of the following: aa Aliases bb Bindings (editor commands) cc Commands (builtin or external com- mands) CC External commands which begin with the supplied path prefix dd Directories DD Directories which begin with the sup- plied path prefix ee Environment variables ff Filenames FF Filenames which begin with the sup- plied path prefix gg Groupnames jj Jobs ll Limits nn Nothing ss Shell variables SS Signals tt Plain (``text'') files TT Plain (``text'') files which begin with the supplied path prefix vv Any variables uu Usernames xx Like nn, but prints _s_e_l_e_c_t when _l_i_s_t_- _c_h_o_i_c_e_s is used. XX Completions $_v_a_r Words from the variable _v_a_r (...) Words from the given list `...` Words from the output of command _s_e_l_e_c_t is an optional glob-pattern. If given, words from only _l_i_s_t that match _s_e_l_e_c_t are consid- ered and the ffiiggnnoorree shell variable is ignored. The last three types of completion may not have a _s_e_l_e_c_t pattern, and xx uses _s_e_l_e_c_t as an explana- tory message when the _l_i_s_t_-_c_h_o_i_c_e_s editor command is used. _s_u_f_f_i_x is a single character to be appended to a successful completion. If null, no character is appended. If omitted (in which case the fourth delimiter can also be omitted), a slash is appended to directories and a space to other words. Now for some examples. Some commands take only directories as arguments, so there's no point com- pleting plain files. > complete cd 'p/1/d/' completes only the first word following `cd' (`p/1') with a directory. pp-type completion can also be used to narrow down command completion: > co[^D] complete compress > complete -co* 'p/0/(compress)/' > co[^D] > compress This completion completes commands (words in posi- tion 0, `p/0') which begin with `co' (thus match- ing `co*') to `compress' (the only word in the list). The leading `-' indicates that this com- pletion is to be used with only ambiguous com- mands. > complete find 'n/-user/u/' is an example of nn-type completion. Any word fol- lowing `find' and immediately following `-user' is completed from the list of users. > complete cc 'c/-I/d/' demonstrates cc-type completion. Any word follow- ing `cc' and beginning with `-I' is completed as a directory. `-I' is not taken as part of the directory because we used lowercase cc. Different _l_i_s_ts are useful with different com- mands. > complete alias 'p/1/a/' > complete man 'p/*/c/' > complete set 'p/1/s/' > complete true 'p/1/x:Truth has no options./' These complete words following `alias' with aliases, `man' with commands, and `set' with shell variables. `true' doesn't have any options, so xx does nothing when completion is attempted and prints `Truth has no options.' when completion choices are listed. Note that the _m_a_n example, and several other exam- ples below, could just as well have used 'c/*' or 'n/*' as 'p/*'. Words can be completed from a variable evaluated at completion time, > complete ftp 'p/1/$hostnames/' > set hostnames = (rtfm.mit.edu tesla.ee.cor- nell.edu) > ftp [^D] rtfm.mit.edu tesla.ee.cornell.edu > ftp [^C] > set hostnames = (rtfm.mit.edu tesla.ee.cor- nell.edu uunet.uu.net) > ftp [^D] rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net or from a command run at completion time: > complete kill 'p/*/`ps | awk \{print\ \$1\}`/' > kill -9 [^D] 23113 23377 23380 23406 23429 23529 23530 PID Note that the _c_o_m_p_l_e_t_e command does not itself quote its arguments, so the braces, space and `$' in `{print $1}' must be quoted explicitly. One command can have multiple completions: > complete dbx 'p/2/(core)/' 'p/*/c/' completes the second argument to `dbx' with the word `core' and all other arguments with commands. Note that the positional completion is specified before the next-word completion. Because comple- tions are evaluated from left to right, if the next-word completion were specified first it would always match and the positional completion would never be executed. This is a common mistake when defining a completion. The _s_e_l_e_c_t pattern is useful when a command takes files with only particular forms as arguments. For example, > complete cc 'p/*/f:*.[cao]/' completes `cc' arguments to files ending in only `.c', `.a', or `.o'. _s_e_l_e_c_t can also exclude files, using negation of a glob-pattern as described under FFiilleennaammee ssuubbssttiittuuttiioonn. One might use > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/' to exclude precious source code from `rm' comple- tion. Of course, one could still type excluded names manually or override the completion mecha- nism using the _c_o_m_p_l_e_t_e_-_w_o_r_d_-_r_a_w or _l_i_s_t_-_c_h_o_i_c_e_s_- _r_a_w editor commands (q.v.). The `C', `D', `F' and `T' _l_i_s_ts are like `c', `d', `f' and `t' respectively, but they use the _s_e_l_e_c_t argument in a different way: to restrict comple- tion to files beginning with a particular path prefix. For example, the Elm mail program uses `=' as an abbreviation for one's mail directory. One might use > complete elm c@=@F:$HOME/Mail/@ to complete `elm -f =' as if it were `elm -f ~/Mail/'. Note that we used `@' instead of `/' to avoid confusion with the _s_e_l_e_c_t argument, and we used `$HOME' instead of `~' because home directory substitution works at only the beginning of a word. _s_u_f_f_i_x is used to add a nonstandard suffix (not space or `/' for directories) to completed words. > complete finger 'c/*@/$hostnames/' 'p/1/u/@' completes arguments to `finger' from the list of users, appends an `@', and then completes after the `@' from the `hostnames' variable. Note again the order in which the completions are specified. Finally, here's a complex example for inspiration: > complete find \ 'n/-name/f/' 'n/-newer/f/' 'n/-{,n}cpio/f/' \ 'n/-exec/c/' 'n/-ok/c/' 'n/-user/u/' \ 'n/-group/g/' 'n/-fstype/(nfs 4.2)/' \ 'n/-type/(b c d f l p s)/' \ 'c/-/(name newer cpio ncpio exec ok user \ group fstype type atime ctime depth inum \ ls mtime nogroup nouser perm print prune \ size xdev)/' \ 'p/*/d/' This completes words following `-name', `-newer', `-cpio' or `ncpio' (note the pattern which matches both) to files, words following `-exec' or `-ok' to commands, words following `user' and `group' to users and groups respectively and words following `-fstype' or `-type' to members of the given lists. It also completes the switches themselves from the given list (note the use of cc-type com- pletion) and completes anything not otherwise com- pleted to a directory. Whew. Remember that programmed completions are ignored if the word being completed is a tilde substitu- tion (beginning with `~') or a variable (beginning with `$'). _c_o_m_p_l_e_t_e is an experimental feature, and the syntax may change in future versions of the shell. See also the _u_n_c_o_m_p_l_e_t_e builtin com- mand. ccoonnttiinnuuee Continues execution of the nearest enclosing _w_h_i_l_e or _f_o_r_e_a_c_h. The rest of the commands on the cur- rent line are executed. ddeeffaauulltt:: Labels the default case in a _s_w_i_t_c_h statement. It should come after all _c_a_s_e labels. ddiirrss [--ll] [--nn|--vv] ddiirrss --SS|--LL [_f_i_l_e_n_a_m_e] (+) ddiirrss --cc (+) The first form prints the directory stack. The top of the stack is at the left and the first directory in the stack is the current directory. With --ll, `~' or `~_n_a_m_e' in the output is expanded explicitly to hhoommee or the pathname of the home directory for user _n_a_m_e. (+) With --nn, entries are wrapped before they reach the edge of the screen. (+) With --vv, entries are printed one per line, preceded by their stack positions. (+) If more than one of --nn or --vv is given, --vv takes prece- dence. --pp is accepted but does nothing. With --SS, the second form saves the directory stack to _f_i_l_e_n_a_m_e as a series of _c_d and _p_u_s_h_d commands. With --LL, the shell sources _f_i_l_e_n_a_m_e, which is pre- sumably a directory stack file saved by the --SS option or the ssaavveeddiirrss mechanism. In either case, ddiirrssffiillee is used if _f_i_l_e_n_a_m_e is not given and _~_/_._c_s_h_d_i_r_s is used if ddiirrssffiillee is unset. Note that login shells do the equivalent of `dirs -L' on startup and, if ssaavveeddiirrss is set, `dirs -S' before exiting. Because only _~_/_._t_c_s_h_r_c is nor- mally sourced before _~_/_._c_s_h_d_i_r_s, ddiirrssffiillee should be set in _~_/_._t_c_s_h_r_c rather than _~_/_._l_o_g_i_n. The last form clears the directory stack. eecchhoo [--nn] _w_o_r_d ... Writes each _w_o_r_d to the shell's standard output, separated by spaces and terminated with a newline. The eecchhoo__ssttyyllee shell variable may be set to emu- late (or not) the flags and escape sequences of the BSD and/or System V versions of _e_c_h_o; see _e_c_h_o(1). eecchhoottcc [--ssvv] _a_r_g ... (+) Exercises the terminal capabilities (see _t_e_r_m_- _c_a_p(5)) in _a_r_g_s. For example, 'echotc home' sends the cursor to the home position, 'echotc cm 3 10' sends it to column 3 and row 10, and 'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test." in the status line. If _a_r_g is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the value of that capability ("yes" or "no" indicating that the terminal does or does not have that capability). One might use this to make the output from a shell script less verbose on slow terminals, or limit command output to the number of lines on the screen: > set history=`echotc lines` > @ history-- Termcap strings may contain wildcards which will not echo correctly. One should use double quotes when setting a shell variable to a terminal capa- bility string, as in the following example that places the date in the status line: > set tosl="`echotc ts 0`" > set frsl="`echotc fs`" > echo -n "$tosl";date; echo -n "$frsl" With --ss, nonexistent capabilities return the empty string rather than causing an error. With --vv, messages are verbose. eellssee eenndd eennddiiff eennddssww See the description of the _f_o_r_e_a_c_h, _i_f, _s_w_i_t_c_h, and _w_h_i_l_e statements below. eevvaall _a_r_g ... Treats the arguments as input to the shell and executes the resulting command(s) in the context of the current shell. This is usually used to execute commands generated as the result of com- mand or variable substitution, because parsing occurs before these substitutions. See _t_s_e_t(1) for a sample use of _e_v_a_l. eexxeecc _c_o_m_m_a_n_d Executes the specified command in place of the current shell. eexxiitt [_e_x_p_r] The shell exits either with the value of the spec- ified _e_x_p_r (an expression, as described under EExxpprreessssiioonnss) or, without _e_x_p_r, with the value of the ssttaattuuss variable. ffgg [%%_j_o_b ...] Brings the specified jobs (or, without arguments, the current job) into the foreground, continuing each if it is stopped. _j_o_b may be a number, a string, `', `%', `+' or `-' as described under JJoobbss. See also the _r_u_n_-_f_g_-_e_d_i_t_o_r editor command. ffiilleetteesstt --_o_p _f_i_l_e ... (+) Applies _o_p (which is a file inquiry operator as described under FFiillee iinnqquuiirryy ooppeerraattoorrss) to each _f_i_l_e and returns the results as a space-separated list. ffoorreeaacchh _n_a_m_e ((_w_o_r_d_l_i_s_t)) ... eenndd Successively sets the variable _n_a_m_e to each member of _w_o_r_d_l_i_s_t and executes the sequence of commands between this command and the matching _e_n_d. (Both _f_o_r_e_a_c_h and _e_n_d must appear alone on separate lines.) The builtin command _c_o_n_t_i_n_u_e may be used to continue the loop prematurely and the builtin command _b_r_e_a_k to terminate it prematurely. When this command is read from the terminal, the loop is read once prompting with `foreach? ' (or pprroommpptt22) before any statements in the loop are executed. If you make a mistake typing in a loop at the terminal you can rub it out. ggeettssppaatthh (+) Prints the system execution path. (TCF only) ggeettxxvveerrss (+) Prints the experimental version prefix. (TCF only) gglloobb _w_o_r_d_l_i_s_t Like _e_c_h_o, but no `\' escapes are recognized and words are delimited by null characters in the out- put. Useful for programs which wish to use the shell to filename expand a list of words. ggoottoo _w_o_r_d _w_o_r_d is filename and command-substituted to yield a string of the form `label'. The shell rewinds its input as much as possible, searches for a line of the form `label:', possibly preceded by blanks or tabs, and continues execution after that line. hhaasshhssttaatt Prints a statistics line indicating how effective the internal hash table has been at locating com- mands (and avoiding _e_x_e_c's). An _e_x_e_c is attempted for each component of the ppaatthh where the hash function indicates a possible hit, and in each component which does not begin with a `/'. On machines without _v_f_o_r_k(2), prints only the num- ber and size of hash buckets. hhiissttoorryy [--hhTTrr] [_n] hhiissttoorryy --SS|--LL||--MM [_f_i_l_e_n_a_m_e] (+) hhiissttoorryy --cc (+) The first form prints the history event list. If _n is given only the _n most recent events are printed or saved. With --hh, the history list is printed without leading numbers. If --TT is speci- fied, timestamps are printed also in comment form. (This can be used to produce files suitable for loading with 'history -L' or 'source -h'.) With --rr, the order of printing is most recent first rather than oldest first. With --SS, the second form saves the history list to _f_i_l_e_n_a_m_e. If the first word of the ssaavveehhiisstt shell variable is set to a number, at most that many lines are saved. If the second word of ssaavveehhiisstt is set to `merge', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp. (+) Merging is intended for an environment like the X Window System with several shells in simultaneous use. Currently it succeeds only when the shells quit nicely one after another. With --LL, the shell appends _f_i_l_e_n_a_m_e, which is pre- sumably a history list saved by the --SS option or the ssaavveehhiisstt mechanism, to the history list. --MM is like --LL, but the contents of _f_i_l_e_n_a_m_e are merged into the history list and sorted by times- tamp. In either case, hhiissttffiillee is used if _f_i_l_e_- _n_a_m_e is not given and _~_/_._h_i_s_t_o_r_y is used if hhiisstt-- ffiillee is unset. `history -L' is exactly like 'source -h' except that it does not require a filename. Note that login shells do the equivalent of `his- tory -L' on startup and, if ssaavveehhiisstt is set, `his- tory -S' before exiting. Because only _~_/_._t_c_s_h_r_c is normally sourced before _~_/_._h_i_s_t_o_r_y, hhiissttffiillee should be set in _~_/_._t_c_s_h_r_c rather than _~_/_._l_o_g_i_n. If hhiissttlliitt is set, the first and second forms print and save the literal (unexpanded) form of the history list. The last form clears the history list. hhuupp [_c_o_m_m_a_n_d] (+) With _c_o_m_m_a_n_d, runs _c_o_m_m_a_n_d such that it will exit on a hangup signal and arranges for the shell to send it a hangup signal when the shell exits. Note that commands may set their own response to hangups, overriding _h_u_p. Without an argument (allowed in only a shell script), causes the shell to exit on a hangup for the remainder of the script. See also SSiiggnnaall hhaannddlliinngg and the _n_o_h_u_p builtin command. iiff ((_e_x_p_r)) _c_o_m_m_a_n_d If _e_x_p_r (an expression, as described under EExxpprreess-- ssiioonnss) evaluates true, then _c_o_m_m_a_n_d is executed. Variable substitution on _c_o_m_m_a_n_d happens early, at the same time it does for the rest of the _i_f com- mand. _c_o_m_m_a_n_d must be a simple command, not an alias, a pipeline, a command list or a parenthe- sized command list, but it may have arguments. Input/output redirection occurs even if _e_x_p_r is false and _c_o_m_m_a_n_d is thus _n_o_t executed; this is a bug. iiff ((_e_x_p_r)) tthheenn ... eellssee iiff ((_e_x_p_r_2)) tthheenn ... eellssee ... eennddiiff If the specified _e_x_p_r is true then the commands to the first _e_l_s_e are executed; otherwise if _e_x_p_r_2 is true then the commands to the second _e_l_s_e are exe- cuted, etc. Any number of _e_l_s_e_-_i_f pairs are pos- sible; only one _e_n_d_i_f is needed. The _e_l_s_e part is likewise optional. (The words _e_l_s_e and _e_n_d_i_f must appear at the beginning of input lines; the _i_f must appear alone on its input line or after an _e_l_s_e.) iinnlliibb _s_h_a_r_e_d_-_l_i_b_r_a_r_y ... (+) Adds each _s_h_a_r_e_d_-_l_i_b_r_a_r_y to the current environ- ment. There is no way to remove a shared library. (Domain/OS only) jjoobbss [--ll] Lists the active jobs. With --ll, lists process IDs in addition to the normal information. On TCF systems, prints the site on which each job is exe- cuting. kkiillll [--_s_i_g_n_a_l] %%_j_o_b|_p_i_d ... kkiillll --ll The first form sends the specified _s_i_g_n_a_l (or, if none is given, the TERM (terminate) signal) to the specified jobs or processes. _j_o_b may be a number, a string, `', `%', `+' or `-' as described under JJoobbss. Signals are either given by number or by name (as given in _/_u_s_r_/_i_n_c_l_u_d_e_/_s_i_g_n_a_l_._h, stripped of the prefix `SIG'). There is no default _j_o_b; saying just `kill' does not send a signal to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or pro- cess is sent a CONT (continue) signal as well. The second form lists the signal names. lliimmiitt [--hh] [_r_e_s_o_u_r_c_e [_m_a_x_i_m_u_m_-_u_s_e]] Limits the consumption by the current process and each process it creates to not individually exceed _m_a_x_i_m_u_m_-_u_s_e on the specified _r_e_s_o_u_r_c_e. If no _m_a_x_- _i_m_u_m_-_u_s_e is given, then the current limit is printed; if no _r_e_s_o_u_r_c_e is given, then all limita- tions are given. If the --hh flag is given, the hard limits are used instead of the current lim- its. The hard limits impose a ceiling on the val- ues of the current limits. Only the super-user may raise the hard limits, but a user may lower or raise the current limits within the legal range. Controllable resources currently include _c_p_u_t_i_m_e (the maximum number of cpu-seconds to be used by each process), _f_i_l_e_s_i_z_e (the largest single file which can be created), _d_a_t_a_s_i_z_e (the maximum growth of the data+stack region via sbrk(2) beyond the end of the program text), _s_t_a_c_k_s_i_z_e (the maxi- mum size of the automatically-extended stack region), _c_o_r_e_d_u_m_p_s_i_z_e (the size of the largest core dump that will be created), and _m_e_m_o_r_y_u_s_e, the maximum amount of physical memory a process may have allocated to it at a given time. _m_a_x_i_m_u_m_-_u_s_e may be given as a (floating point or integer) number followed by a scale factor. For all limits other than _c_p_u_t_i_m_e the default scale is `k' or `kilobytes' (1024 bytes); a scale factor of `m' or `megabytes' may also be used. For _c_p_u_t_i_m_e the default scaling is `seconds', while `m' for minutes or `h' for hours, or a time of the form `mm:ss' giving minutes and seconds may be used. For both _r_e_s_o_u_r_c_e names and scale factors, unam- biguous prefixes of the names suffice. lloogg (+) Prints the wwaattcchh shell variable and reports on each user indicated in wwaattcchh who is logged in, regardless of when they last logged in. See also _w_a_t_c_h_l_o_g. llooggiinn Terminates a login shell, replacing it with an instance of _/_b_i_n_/_l_o_g_i_n_. This is one way to log off, included for compatibility with _s_h(1). llooggoouutt Terminates a login shell. Especially useful if iiggnnoorreeeeooff is set. llss--FF [-_s_w_i_t_c_h ...] [_f_i_l_e ...] (+) Lists files like `ls -F', but much faster. It identifies each type of special file in the list- ing with a special character: / Directory * Executable # Block device % Character device | Named pipe (systems with named pipes only) = Socket (systems with sockets only) @ Symbolic link (systems with symbolic links only) + Hidden directory (AIX only) or context depen- dent (HP/UX only) : Network special (HP/UX only) If the lliissttlliinnkkss shell variable is set, symbolic links are identified in more detail (on only sys- tems that have them, of course): @ Symbolic link to a non-directory > Symbolic link to a directory & Symbolic link to nowhere lliissttlliinnkkss also slows down _l_s_-_F and causes parti- tions holding files pointed to by symbolic links to be mounted. If the lliissttffllaaggss shell variable is set to `x', `a' or `A', or any combination thereof (e.g., `xA'), they are used as flags to _l_s_-_F, making it act like `ls -xF', `ls -Fa', `ls -FA' or a combination (e.g., `ls -FxA'). On machines where `ls -C' is not the default, _l_s_-_F acts like `ls -CF', unless lliissttffllaaggss contains an `x', in which case it acts like `ls -xF'. _l_s_-_F passes its arguments to _l_s(1) if it is given any switches, so `alias ls ls-F' generally does the right thing. The llss--FF builtin can list files using different colors depending on the filetype or extension. See the ccoolloorr _t_c_s_h variable and the LLSS__CCOOLLOORRSS environment variable. mmiiggrraattee [--_s_i_t_e] _p_i_d|%%_j_o_b_i_d ... (+) mmiiggrraattee --_s_i_t_e (+) The first form migrates the process or job to the site specified or the default site determined by the system path. The second form is equivalent to `migrate -_s_i_t_e $$': it migrates the current pro- cess to the specified site. Migrating the shell itself can cause unexpected behavior, because the shell does not like to lose its tty. (TCF only) nneewwggrrpp [--] _g_r_o_u_p (+) Equivalent to `exec newgrp'; see _n_e_w_g_r_p(1). Available only if the shell was so compiled; see the vveerrssiioonn shell variable. nniiccee [++_n_u_m_b_e_r] [_c_o_m_m_a_n_d] Sets the scheduling priority for the shell to _n_u_m_- _b_e_r, or, without _n_u_m_b_e_r, to 4. With _c_o_m_m_a_n_d, runs _c_o_m_m_a_n_d at the appropriate priority. The greater the _n_u_m_b_e_r, the less cpu the process gets. The super-user may specify negative priority by using `nice -number ...'. Command is always executed in a sub-shell, and the restrictions placed on com- mands in simple _i_f statements apply. nnoohhuupp [_c_o_m_m_a_n_d] With _c_o_m_m_a_n_d, runs _c_o_m_m_a_n_d such that it will ignore hangup signals. Note that commands may set their own response to hangups, overriding _n_o_h_u_p. Without an argument (allowed in only a shell script), causes the shell to ignore hangups for the remainder of the script. See also SSiiggnnaall hhaann-- ddlliinngg and the _h_u_p builtin command. nnoottiiffyy [%%_j_o_b ...] Causes the shell to notify the user asynchronously when the status of any of the specified jobs (or, without %_j_o_b, the current job) changes, instead of waiting until the next prompt as is usual. _j_o_b may be a number, a string, `', `%', `+' or `-' as described under JJoobbss. See also the nnoottiiffyy shell variable. oonniinnttrr [--|_l_a_b_e_l] Controls the action of the shell on interrupts. Without arguments, restores the default action of the shell on interrupts, which is to terminate shell scripts or to return to the terminal command input level. With `-', causes all interrupts to be ignored. With _l_a_b_e_l, causes the shell to exe- cute a `goto _l_a_b_e_l' when an interrupt is received or a child process terminates because it was interrupted. _o_n_i_n_t_r is ignored if the shell is running detached and in system startup files (see FFIILLEESS), where interrupts are disabled anyway. ppooppdd [--pp] [--ll] [--nn|--vv] [++_n] Without arguments, pops the directory stack and returns to the new top directory. With a number `+_n', discards the _n'th entry in the stack. Finally, all forms of _p_o_p_d print the final direc- tory stack, just like _d_i_r_s. The ppuusshhddssiilleenntt shell variable can be set to prevent this and the --pp flag can be given to override ppuusshhddssiilleenntt. The --ll, --nn and --vv flags have the same effect on _p_o_p_d as on _d_i_r_s. (+) pprriinntteennvv [_n_a_m_e] (+) Prints the names and values of all environment variables or, with _n_a_m_e, the value of the environ- ment variable _n_a_m_e. ppuusshhdd [--pp] [--ll] [--nn|--vv] [_n_a_m_e|++_n] Without arguments, exchanges the top two elements of the directory stack. If ppuusshhddttoohhoommee is set, _p_u_s_h_d without arguments does `pushd ~', like _c_d. (+) With _n_a_m_e, pushes the current working direc- tory onto the directory stack and changes to _n_a_m_e. If _n_a_m_e is `-' it is interpreted as the previous working directory (see FFiilleennaammee ssuubbssttiittuuttiioonn). (+) If dduunniiqquuee is set, _p_u_s_h_d removes any instances of _n_a_m_e from the stack before pushing it onto the stack. (+) With a number `+_n', rotates the _nth element of the directory stack around to be the top element and changes to it. If ddeexxttrraacctt is set, however, `pushd +_n' extracts the _nth direc- tory, pushes it onto the top of the stack and changes to it. (+) Finally, all forms of _p_u_s_h_d print the final direc- tory stack, just like _d_i_r_s. The ppuusshhddssiilleenntt shell variable can be set to prevent this and the --pp flag can be given to override ppuusshhddssiilleenntt. The --ll, --nn and --vv flags have the same effect on _p_u_s_h_d as on _d_i_r_s. (+) rreehhaasshh Causes the internal hash table of the contents of the directories in the ppaatthh variable to be recom- puted. This is needed if new commands are added to directories in ppaatthh while you are logged in. This should be necessary only if you add commands to one of your own directories, or if a systems programmer changes the contents of one of the sys- tem directories. Also flushes the cache of home directories built by tilde expansion. rreeppeeaatt _c_o_u_n_t _c_o_m_m_a_n_d The specified _c_o_m_m_a_n_d, which is subject to the same restrictions as the _c_o_m_m_a_n_d in the one line _i_f statement above, is executed _c_o_u_n_t times. I/O redirections occur exactly once, even if _c_o_u_n_t is 0. rroooottnnooddee ////_n_o_d_e_n_a_m_e (+) Changes the rootnode to //_n_o_d_e_n_a_m_e, so that `/' will be interpreted as `//_n_o_d_e_n_a_m_e'. (Domain/OS only) sscchheedd (+) sscchheedd [++]_h_h_:_m_m _c_o_m_m_a_n_d (+) sscchheedd --_n (+) The first form prints the scheduled-event list. The sscchheedd shell variable may be set to define the format in which the scheduled-event list is printed. The second form adds _c_o_m_m_a_n_d to the scheduled-event list. For example, > sched 11:00 echo It\'s eleven o\'clock. causes the shell to echo `It's eleven o'clock.' at 11 AM. The time may be in 12-hour AM/PM format > sched 5pm set prompt='[%h] It\'s after 5; go home: >' or may be relative to the current time: > sched +2:15 /usr/lib/uucp/uucico -r1 -sother A relative time specification may not use AM/PM format. The third form removes item _n from the event list: > sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: > > sched -2 > sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother A command in the scheduled-event list is executed just before the first prompt is printed after the time when the command is scheduled. It is possi- ble to miss the exact time when the command is to be run, but an overdue command will execute at the next prompt. A command which comes due while the shell is waiting for user input is executed imme- diately. However, normal operation of an already- running command will not be interrupted so that a scheduled-event list element may be run. This mechanism is similar to, but not the same as, the _a_t(1) command on some Unix systems. Its major disadvantage is that it may not run a command at exactly the specified time. Its major advantage is that because _s_c_h_e_d runs directly from the shell, it has access to shell variables and other structures. This provides a mechanism for chang- ing one's working environment based on the time of day. sseett sseett _n_a_m_e ... sseett _n_a_m_e==_w_o_r_d ... sseett [[--rr]] [[--ff||--ll]] _n_a_m_e==((_w_o_r_d_l_i_s_t)) ... (+) sseett _n_a_m_e_[_i_n_d_e_x_]==_w_o_r_d ... sseett --rr (+) sseett --rr _n_a_m_e ... (+) sseett --rr _n_a_m_e==_w_o_r_d ... (+) The first form of the command prints the value of all shell variables. Variables which contain more than a single word print as a parenthesized word list. The second form sets _n_a_m_e to the null string. The third form sets _n_a_m_e to the single _w_o_r_d. The fourth form sets _n_a_m_e to the list of words in _w_o_r_d_l_i_s_t. In all cases the value is com- mand and filename expanded. If -r is specified, the value is set read-only. If -f or -l are spec- ified, set only unique words keeping their order. -f prefers the first occurrence of a word, and -l the last. The fifth form sets the _i_n_d_e_x'th compo- nent of name to _w_o_r_d; this component must already exist. The sixth form lists only the names of all shell variables that are read-only. The seventh form makes _n_a_m_e read-only, whether or not it has a value. The second form sets _n_a_m_e to the null string. The eighth form is the same as the third form, but make _n_a_m_e read-only at the same time. These arguments can be repeated to set and/or make read-only multiple variables in a single set com- mand. Note, however, that variable expansion hap- pens for all arguments before any setting occurs. Note also that `=' can be adjacent to both _n_a_m_e and _w_o_r_d or separated from both by whitespace, but cannot be adjacent to only one or the other. See also the _u_n_s_e_t builtin command. sseetteennvv [_n_a_m_e [_v_a_l_u_e]] Without arguments, prints the names and values of all environment variables. Given _n_a_m_e, sets the environment variable _n_a_m_e to _v_a_l_u_e or, without _v_a_l_u_e, to the null string. sseettppaatthh _p_a_t_h (+) Equivalent to _s_e_t_p_a_t_h(1). (Mach only) sseettssppaatthh LOCAL|_s_i_t_e|_c_p_u ... (+) Sets the system execution path. (TCF only) sseettttcc _c_a_p _v_a_l_u_e (+) Tells the shell to believe that the terminal capa- bility _c_a_p (as defined in _t_e_r_m_c_a_p(5)) has the value _v_a_l_u_e. No sanity checking is done. Concept terminal users may have to `settc xn no' to get proper wrapping at the rightmost column. sseettttyy [--dd|--qq|--xx] [--aa] [[++|--]_m_o_d_e] (+) Controls which tty modes (see TTeerrmmiinnaall mmaannaaggeemmeenntt) the shell does not allow to change. --dd, --qq or --xx tells _s_e_t_t_y to act on the `edit', `quote' or `exe- cute' set of tty modes respectively; without --dd, --qq or --xx, `execute' is used. Without other arguments, _s_e_t_t_y lists the modes in the chosen set which are fixed on (`+mode') or off (`-mode'). The available modes, and thus the dis- play, vary from system to system. With --aa, lists all tty modes in the chosen set whether or not they are fixed. With ++_m_o_d_e, --_m_o_d_e or _m_o_d_e, fixes _m_o_d_e on or off or removes control from _m_o_d_e in the chosen set. For example, `setty +echok echoe' fixes `echok' mode on and allows commands to turn `echoe' mode on or off, both when the shell is executing commands. sseettxxvveerrss [_s_t_r_i_n_g] (+) Set the experimental version prefix to _s_t_r_i_n_g, or removes it if _s_t_r_i_n_g is omitted. (TCF only) sshhiifftt [_v_a_r_i_a_b_l_e] Without arguments, discards aarrggvv[1] and shifts the members of aarrggvv to the left. It is an error for aarrggvv not to be set or to have less than one word as value. With _v_a_r_i_a_b_l_e, performs the same func- tion on _v_a_r_i_a_b_l_e. ssoouurrccee [--hh] _n_a_m_e [_a_r_g_s ...] The shell reads and executes commands from _n_a_m_e. The commands are not placed on the history list. If any _a_r_g_s are given, they are placed in aarrggvv. (+) _s_o_u_r_c_e commands may be nested; if they are nested too deeply the shell may run out of file descriptors. An error in a _s_o_u_r_c_e at any level terminates all nested _s_o_u_r_c_e commands. With --hh, commands are placed on the history list instead of being executed, much like `history -L'. ssttoopp %%_j_o_b|_p_i_d ... Stops the specified jobs or processes which are executing in the background. _j_o_b may be a number, a string, `', `%', `+' or `-' as described under JJoobbss. There is no default _j_o_b; saying just `stop' does not stop the current job. ssuussppeenndd Causes the shell to stop in its tracks, much as if it had been sent a stop signal with ^^ZZ. This is most often used to stop shells started by _s_u(1). sswwiittcchh ((_s_t_r_i_n_g)) ccaassee _s_t_r_1:: ... bbrreeaakkssww ... ddeeffaauulltt:: ... bbrreeaakkssww eennddssww Each case label is successively matched, against the specified _s_t_r_i_n_g which is first command and filename expanded. The file metacharacters `*', `?' and `[...]' may be used in the case labels, which are variable expanded. If none of the labels match before a `default' label is found, then the execution begins after the default label. Each case label and the default label must appear at the beginning of a line. The command _b_r_e_a_k_s_w causes execution to continue after the _e_n_d_s_w. Otherwise control may fall through case labels and default labels as in C. If no label matches and there is no default, execution continues after the _e_n_d_s_w. tteellllttcc (+) Lists the values of all terminal capabilities (see _t_e_r_m_c_a_p(5)). ttiimmee [_c_o_m_m_a_n_d] Executes _c_o_m_m_a_n_d (which must be a simple command, not an alias, a pipeline, a command list or a parenthesized command list) and prints a time sum- mary as described under the ttiimmee variable. If necessary, an extra shell is created to print the time statistic when the command completes. With- out _c_o_m_m_a_n_d, prints a time summary for the current shell and its children. uummaasskk [_v_a_l_u_e] Sets the file creation mask to _v_a_l_u_e, which is given in octal. Common values for the mask are 002, giving all access to the group and read and execute access to others, and 022, giving read and execute access to the group and others. Without _v_a_l_u_e, prints the current file creation mask. uunnaalliiaass _p_a_t_t_e_r_n Removes all aliases whose names match _p_a_t_t_e_r_n. `unalias *' thus removes all aliases. It is not an error for nothing to be _u_n_a_l_i_a_sed. uunnccoommpplleettee _p_a_t_t_e_r_n (+) Removes all completions whose names match _p_a_t_t_e_r_n. `uncomplete *' thus removes all completions. It is not an error for nothing to be _u_n_c_o_m_p_l_e_t_ed. uunnhhaasshh Disables use of the internal hash table to speed location of executed programs. uunniivveerrssee _u_n_i_v_e_r_s_e (+) Sets the universe to _u_n_i_v_e_r_s_e. (Masscomp/RTU only) uunnlliimmiitt [--hh] [_r_e_s_o_u_r_c_e] Removes the limitation on _r_e_s_o_u_r_c_e or, if no _r_e_s_o_u_r_c_e is specified, all _r_e_s_o_u_r_c_e limitations. With --hh, the corresponding hard limits are removed. Only the super-user may do this. uunnsseett _p_a_t_t_e_r_n Removes all variables whose names match _p_a_t_t_e_r_n, unless they are read-only. `unset *' thus removes all variables unless they are read-only; this is a bad idea. It is not an error for nothing to be _u_n_s_e_t. uunnsseetteennvv _p_a_t_t_e_r_n Removes all environment variables whose names match _p_a_t_t_e_r_n. `unsetenv *' thus removes all environment variables; this is a bad idea. It is not an error for nothing to be _u_n_s_e_t_e_n_ved. vveerr [_s_y_s_t_y_p_e [_c_o_m_m_a_n_d]] (+) Without arguments, prints SSYYSSTTYYPPEE. With _s_y_s_t_y_p_e, sets SSYYSSTTYYPPEE to _s_y_s_t_y_p_e. With _s_y_s_t_y_p_e and _c_o_m_- _m_a_n_d, executes _c_o_m_m_a_n_d under _s_y_s_t_y_p_e. _s_y_s_t_y_p_e may be `bsd4.3' or `sys5.3'. (Domain/OS only) wwaaiitt The shell waits for all background jobs. If the shell is interactive, an interrupt will disrupt the wait and cause the shell to print the names and job numbers of all outstanding jobs. wwaarrpp _u_n_i_v_e_r_s_e (+) Sets the universe to _u_n_i_v_e_r_s_e. (Convex/OS only) wwaattcchhlloogg (+) An alternate name for the _l_o_g builtin command (q.v.). Available only if the shell was so com- piled; see the vveerrssiioonn shell variable. wwhheerree _c_o_m_m_a_n_d (+) Reports all known instances of _c_o_m_m_a_n_d, including aliases, builtins and executables in ppaatthh. wwhhiicchh _c_o_m_m_a_n_d (+) Displays the command that will be executed by the shell after substitutions, ppaatthh searching, etc. The builtin command is just like _w_h_i_c_h(1), but it correctly reports _t_c_s_h aliases and builtins and is 10 to 100 times faster. See also the _w_h_i_c_h_-_c_o_m_- _m_a_n_d editor command. wwhhiillee ((_e_x_p_r)) ... eenndd Executes the commands between the _w_h_i_l_e and the matching _e_n_d while _e_x_p_r (an expression, as described under EExxpprreessssiioonnss) evaluates non-zero. _w_h_i_l_e and _e_n_d must appear alone on their input lines. _b_r_e_a_k and _c_o_n_t_i_n_u_e may be used to termi- nate or continue the loop prematurely. If the input is a terminal, the user is prompted the first time through the loop as with _f_o_r_e_a_c_h. SSppeecciiaall aalliiaasseess ((++)) If set, each of these aliases executes automatically at the indicated time. They are all initially undefined. bbeeeeppccmmdd Runs when the shell wants to ring the terminal bell. ccwwddccmmdd Runs after every change of working directory. For example, if the user is working on an X window system using _x_t_e_r_m(1) and a re-parenting window manager that supports title bars such as _t_w_m(1) and does > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"' then the shell will change the title of the run- ning _x_t_e_r_m(1) to be the name of the host, a colon, and the full current working directory. A fancier way to do that is > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"' This will put the hostname and working directory on the title bar but only the hostname in the icon manager menu. Note that putting a _c_d, _p_u_s_h_d or _p_o_p_d in _c_w_d_c_m_d may cause an infinite loop. It is the author's opinion that anyone doing so will get what they deserve. hheellppccoommmmaanndd Invoked by the rruunn--hheellpp editor command. The com- mand name for which help is sought is passed as sole argument. For example, if one does > alias helpcommand '\!:1 --help' then the help display of the command itself will be invoked, using the GNU help calling convention. Currently there is no easy way to account for var- ious calling conventions (e.g., the customary Unix `-h'), except by using a table of many commands. ppeerriiooddiicc Runs every ttppeerriioodd minutes. This provides a con- venient means for checking on common but infre- quent changes such as new mail. For example, if one does > set tperiod = 30 > alias periodic checknews then the _c_h_e_c_k_n_e_w_s(1) program runs every 30 min- utes. If _p_e_r_i_o_d_i_c is set but ttppeerriioodd is unset or set to 0, _p_e_r_i_o_d_i_c behaves like _p_r_e_c_m_d. pprreeccmmdd Runs just before each prompt is printed. For example, if one does > alias precmd date then _d_a_t_e(1) runs just before the shell prompts for each command. There are no limits on what _p_r_e_c_m_d can be set to do, but discretion should be used. ppoossttccmmdd Runs before each command gets executed. > alias postcmd 'echo -n "^[]2\;\!#^G"' then executing _v_i _f_o_o_._c will put the command string in the xterm title bar. sshheellll Specifies the interpreter for executable scripts which do not themselves specify an interpreter. The first word should be a full path name to the desired interpreter (e.g., `/bin/csh' or `/usr/local/bin/tcsh'). SSppeecciiaall sshheellll vvaarriiaabblleess The variables described in this section have special mean- ing to the shell. The shell sets aaddddssuuffffiixx, aarrggvv, aauuttoollooggoouutt, ccoommmmaanndd, eecchhoo__ssttyyllee, eeddiitt, ggiidd, ggrroouupp, hhoommee, llooggiinnsshh, ooiidd, ppaatthh, pprroommpptt, pprroommpptt22, pprroommpptt33, sshheellll, sshhllvvll, ttccsshh, tteerrmm, ttttyy, uuiidd, uusseerr and vveerrssiioonn at startup; they do not change thereafter unless changed by the user. The shell updates ccwwdd, ddiirrssttaacckk, oowwdd and ssttaattuuss when necessary, and sets llooggoouutt on logout. The shell synchronizes aaffssuusseerr, ggrroouupp, hhoommee, ppaatthh, sshhllvvll, tteerrmm and uusseerr with the environment variables of the same names: whenever the environment variable changes the shell changes the corresponding shell variable to match (unless the shell variable is read-only) and vice versa. Note that although ccwwdd and PPWWDD have identical meanings, they are not synchronized in this manner, and that the shell automatically interconverts the different formats of ppaatthh and PPAATTHH. aaddddssuuffffiixx (+) If set, filename completion adds `/' to the end of directories and a space to the end of normal files when they are matched exactly. Set by default. aaffssuusseerr (+) If set, aauuttoollooggoouutt's autolock feature uses its value instead of the local username for kerberos authentication. aammppmm (+) If set, all times are shown in 12-hour AM/PM for- mat. aarrggvv The arguments to the shell. Positional parameters are taken from aarrggvv, i.e., `$1' is replaced by `$argv[1]', etc. Set by default, but usually empty in interactive shells. aauuttooccoorrrreecctt (+) If set, the _s_p_e_l_l_-_w_o_r_d editor command is invoked automatically before each completion attempt. aauuttooeexxppaanndd (+) If set, the _e_x_p_a_n_d_-_h_i_s_t_o_r_y editor command is invoked automatically before each completion attempt. aauuttoolliisstt (+) If set, possibilities are listed after an ambigu- ous completion. If set to `ambiguous', possibili- ties are listed only when no new characters are added by completion. aauuttoollooggoouutt (+) The first word is the number of minutes of inac- tivity before automatic logout. The optional sec- ond word is the number of minutes of inactivity before automatic locking. When the shell automat- ically logs out, it prints `auto-logout', sets the variable logout to `automatic' and exits. When the shell automatically locks, the user is required to enter his password to continue work- ing. Five incorrect attempts result in automatic logout. Set to `60' (automatic logout after 60 minutes, and no locking) by default in login and superuser shells, but not if the shell thinks it is running under a window system (i.e., the DDIISS-- PPLLAAYY environment variable is set), the tty is a pseudo-tty (pty) or the shell was not so compiled (see the vveerrssiioonn shell variable). See also the aaffssuusseerr and llooggoouutt shell variables. bbaacckkssllaasshh__qquuoottee (+) If set, backslashes (`\') always quote `\', `'', and `"'. This may make complex quoting tasks eas- ier, but it can cause syntax errors in _c_s_h(1) scripts. ccaattaalloogg The file name of the message catalog. If set, tcsh use `tcsh.${catalog}' as a message catalog instead of default `tcsh'. ccddppaatthh A list of directories in which _c_d should search for subdirectories if they aren't found in the current directory. ccoolloorr If set, it enables color display for the builtin llss--FF and it passes ----ccoolloorr==aauuttoo to llss. Alterna- tively, it can be set to only llss--FF or only llss to enable color to only one command. Setting it to nothing is equivalent to setting it to ((llss--FF llss)). ccoolloorrccaatt If set, it enables color escape sequence for NLS message files. And display colorful NLS messages. ccoommmmaanndd (+) If set, the command which was passed to the shell with the --cc flag (q.v.). ccoommpplleettee (+) If set to `enhance', completion 1) ignores case and 2) considers periods, hyphens and underscores (`.', `-' and `_') to be word separators and hyphens and underscores to be equivalent. ccoonnttiinnuuee (+) If set to a list of commands, the shell will con- tinue the listed commands, instead of starting a new one. ccoonnttiinnuuee__aarrggss (+) Same as continue, but the shell will execute: echo `pwd` $argv > ~/._pause; % ccoorrrreecctt (+) If set to `cmd', commands are automatically spelling-corrected. If set to `complete', com- mands are automatically completed. If set to `all', the entire command line is corrected. ccwwdd The full pathname of the current directory. See also the ddiirrssttaacckk and oowwdd shell variables. ddeexxttrraacctt (+) If set, `pushd +_n' extracts the _nth directory from the directory stack rather than rotating it to the top. ddiirrssffiillee (+) The default location in which `dirs -S' and `dirs -L' look for a history file. If unset, _~_/_._c_s_h_d_i_r_s is used. Because only _~_/_._t_c_s_h_r_c is normally sourced before _~_/_._c_s_h_d_i_r_s, ddiirrssffiillee should be set in _~_/_._t_c_s_h_r_c rather than _~_/_._l_o_g_i_n. ddiirrssttaacckk (+) An array of all the directories on the directory stack. `$dirstack[1]' is the current working directory, `$dirstack[2]' the first directory on the stack, etc. Note that the current working directory is `$dirstack[1]' but `=0' in directory stack substitutions, etc. One can change the stack arbitrarily by setting ddiirrssttaacckk, but the first element (the current working directory) is always correct. See also the ccwwdd and oowwdd shell variables. ddssppmmbbyyttee (+) If set to `euc', it enables display and editing EUC-kanji(Japanese) code. If set to `sjis', it enables display and editing Shift-JIS(Japanese) code. If set to the following format, it enables display and editing of original multi-byte code format: > set dspmbyte = 0000....(256 bytes)....0000 The table requires jjuusstt 256 bytes. Each character of 256 characters corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff. Each character is set to number 0,1,2 and 3. Each num- ber has the following meaning: 0 ... not used for multi-byte characters. 1 ... used for the first byte of a multi-byte character. 2 ... used for the second byte of a multi-byte character. 3 ... used for both the first byte and second byte of a multi-byte character. Example: If set to `001322', the first character (means 0x00 of the ASCII code) and second character (means 0x01 of ASCII code) are set to `0'. Then, it is not used for multi-byte characters. The 3rd character (0x02) is set to '2', indicating that it is used for the first byte of a multi-byte charac- ter. The 4th character(0x03) is set '3'. It is used for both the first byte and the second byte of a multi-byte character. The 5th and 6th char- acters (0x04,0x05) are set to '2', indicating that they are used for the second byte of a multi-byte character. The GNU fileutils version of ls cannot display multi-byte filenames without the -N ( --literal ) option. If you are using this version, set the second word of dspmbyte to "ls". If not, for example, "ls-F -l" cannot display multi-byte file- names. dduunniiqquuee (+) If set, _p_u_s_h_d removes any instances of _n_a_m_e from the stack before pushing it onto the stack. eecchhoo If set, each command with its arguments is echoed just before it is executed. For non-builtin com- mands all expansions occur before echoing. Builtin commands are echoed before command and filename substitution, because these substitutions are then done selectively. Set by the --xx command line option. eecchhoo__ssttyyllee (+) The style of the _e_c_h_o builtin. May be set to bsd Don't echo a newline if the first argument is `-n'. sysv Recognize backslashed escape sequences in echo strings. both Recognize both the `-n' flag and back- slashed escape sequences; the default. none Recognize neither. Set by default to the local system default. The BSD and System V options are described in the _e_c_h_o(1) man pages on the appropriate systems. eeddiitt (+) If set, the command-line editor is used. Set by default in interactive shells. eelllliippssiiss (+) If set, the `%c'/`%.' and `%C' prompt sequences (see the pprroommpptt shell variable) indicate skipped directories with an ellipsis (`...') instead of `/'. ffiiggnnoorree (+) Lists file name suffixes to be ignored by comple- tion. ffiilleecc In _t_c_s_h, completion is always used and this vari- able is ignored. If set in _c_s_h, filename comple- tion is used. ggiidd (+) The user's real group ID. ggrroouupp (+) The user's group name. hhiissttcchhaarrss A string value determining the characters used in HHiissttoorryy ssuubbssttiittuuttiioonn (q.v.). The first character of its value is used as the history substitution character, replacing the default character `!'. The second character of its value replaces the character `^' in quick substitutions. hhiissttdduupp (+) Controls handling of duplicate entries in the his- tory list. If set to `all' only unique history events are entered in the history list. If set to `prev' and the last history event is the same as the current command, then the current command is not entered in the history. If set to `erase' and the same event is found in the history list, that old event gets erased and the current one gets inserted. Note that the `prev' and `all' options renumber history events so there are no gaps. hhiissttffiillee (+) The default location in which `history -S' and `history -L' look for a history file. If unset, _~_/_._h_i_s_t_o_r_y is used. hhiissttffiillee is useful when shar- ing the same home directory between different machines, or when saving separate histories on different terminals. Because only _~_/_._t_c_s_h_r_c is normally sourced before _~_/_._h_i_s_t_o_r_y, hhiissttffiillee should be set in _~_/_._t_c_s_h_r_c rather than _~_/_._l_o_g_i_n. hhiissttlliitt (+) If set, builtin and editor commands and the ssaavvee-- hhiisstt mechanism use the literal (unexpanded) form of lines in the history list. See also the _t_o_g_- _g_l_e_-_l_i_t_e_r_a_l_-_h_i_s_t_o_r_y editor command. hhiissttoorryy The first word indicates the number of history events to save. The optional second word (+) indicates the format in which history is printed; if not given, `%h\t%T\t%R\n' is used. The format sequences are described below under pprroommpptt; note the variable meaning of `%R'. Set to `100' by default. hhoommee Initialized to the home directory of the invoker. The filename expansion of `_~' refers to this vari- able. iiggnnoorreeeeooff If set to the empty string or `0' and the input device is a terminal, the _e_n_d_-_o_f_-_f_i_l_e command (usually generated by the user by typing `^D' on an empty line) causes the shell to print `Use "exit" to leave tcsh.' instead of exiting. This prevents the shell from accidentally being killed. If set to a number _n, the shell ignores _n - 1 con- secutive _e_n_d_-_o_f_-_f_i_l_es and exits on the _nth. (+) If unset, `1' is used, i.e., the shell exits on a single `^D'. iimmpplliicciittccdd (+) If set, the shell treats a directory name typed as a command as though it were a request to change to that directory. If set to _v_e_r_b_o_s_e, the change of directory is echoed to the standard output. This behavior is inhibited in non-interactive shell scripts, or for command strings with more than one word. Changing directory takes precedence over executing a like-named command, but it is done after alias substitutions. Tilde and variable expansions work as expected. iinnppuuttmmooddee (+) If set to `insert' or `overwrite', puts the editor into that input mode at the beginning of each line. lliissttffllaaggss (+) If set to `x', `a' or `A', or any combination thereof (e.g., `xA'), they are used as flags to _l_s_-_F, making it act like `ls -xF', `ls -Fa', `ls -FA' or a combination (e.g., `ls -FxA'): `a' shows all files (even if they start with a `.'), `A' shows all files but `.' and `..', and `x' sorts across instead of down. If the second word of lliissttffllaaggss is set, it is used as the path to `ls(1)'. lliissttjjoobbss (+) If set, all jobs are listed when a job is sus- pended. If set to `long', the listing is in long format. lliissttlliinnkkss (+) If set, the _l_s_-_F builtin command shows the type of file to which each symbolic link points. lliissttmmaaxx (+) The maximum number of items which the _l_i_s_t_-_c_h_o_i_c_e_s editor command will list without asking first. lliissttmmaaxxrroowwss (+) The maximum number of rows of items which the _l_i_s_t_-_c_h_o_i_c_e_s editor command will list without ask- ing first. llooggiinnsshh (+) Set by the shell if it is a login shell. Setting or unsetting it within a shell has no effect. See also sshhllvvll. llooggoouutt (+) Set by the shell to `normal' before a normal logout, `automatic' before an automatic logout, and `hangup' if the shell was killed by a hangup signal (see SSiiggnnaall hhaannddlliinngg). See also the aauuttooll-- ooggoouutt shell variable. mmaaiill The names of the files or directories to check for incoming mail, separated by whitespace, and optionally preceded by a numeric word. Before each prompt, if 10 minutes have passed since the last check, the shell checks each file and says `You have new mail.' (or, if mmaaiill contains multi- ple files, `You have new mail in _n_a_m_e.') if the filesize is greater than zero in size and has a modification time greater than its access time. If you are in a login shell, then no mail file is reported unless it has been modified after the time the shell has started up, to prevent redun- dant notifications. Most login programs will tell you whether or not you have mail when you log in. If a file specified in mmaaiill is a directory, the shell will count each file within that directory as a separate message, and will report `You have _n mails.' or `You have _n mails in _n_a_m_e.' as appro- priate. This functionality is provided primarily for those systems which store mail in this manner, such as the Andrew Mail System. If the first word of mmaaiill is numeric it is taken as a different mail checking interval, in seconds. Under very rare circumstances, the shell may report `You have mail.' instead of `You have new mail.' mmaattcchhbbeeeepp (+) If set to `never', completion never beeps. If set to `nomatch', it beeps only when there is no match. If set to `ambiguous, it beeps when there are multiple matches. If set to `notunique', it beeps when there is one exact and other longer matches. If unset, `ambiguous' is used. nnoobbeeeepp (+) If set, beeping is completely disabled. See also vviissiibblleebbeellll. nnoocclloobbbbeerr If set, restrictions are placed on output redirec- tion to insure that files are not accidentally destroyed and that `>>' redirections refer to existing files, as described in the IInnppuutt//oouuttppuutt section. nnooddiinngg If set, disable the printing of `DING!' in the pprroommpptt time specifiers at the change of hour. nnoogglloobb If set, FFiilleennaammee ssuubbssttiittuuttiioonn and DDiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn (q.v.) are inhibited. This is most useful in shell scripts which do not deal with filenames, or after a list of filenames has been obtained and further expansions are not desirable. nnookkaannjjii (+) If set and the shell supports Kanji (see the vveerr-- ssiioonn shell variable), it is disabled so that the meta key can be used. nnoonnoommaattcchh If set, a FFiilleennaammee ssuubbssttiittuuttiioonn or DDiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn (q.v.) which does not match any existing files is left untouched rather than caus- ing an error. It is still an error for the sub- stitution to be malformed, e.g., `echo [' still gives an error. nnoossttaatt (+) A list of directories (or glob-patterns which match directories; see FFiilleennaammee ssuubbssttiittuuttiioonn) that should not be _s_t_a_t(2)ed during a completion opera- tion. This is usually used to exclude directories which take too much time to _s_t_a_t(2), for example _/_a_f_s. nnoottiiffyy If set, the shell announces job completions asyn- chronously. The default is to present job comple- tions just before printing a prompt. ooiidd (+) The user's real organization ID. (Domain/OS only) oowwdd (+) The old working directory, equivalent to the `-' used by _c_d and _p_u_s_h_d. See also the ccwwdd and ddiirrssttaacckk shell variables. ppaatthh A list of directories in which to look for exe- cutable commands. A null word specifies the cur- rent directory. If there is no ppaatthh variable then only full path names will execute. ppaatthh is set by the shell at startup from the PPAATTHH environment variable or, if PPAATTHH does not exist, to a system- dependent default something like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'. The shell may put `.' first or last in ppaatthh or omit it entirely depend- ing on how it was compiled; see the vveerrssiioonn shell variable. A shell which is given neither the --cc nor the --tt option hashes the contents of the directories in ppaatthh after reading _~_/_._t_c_s_h_r_c and each time ppaatthh is reset. If one adds a new com- mand to a directory in ppaatthh while the shell is active, one may need to do a _r_e_h_a_s_h for the shell to find it. pprriinntteexxiittvvaalluuee (+) If set and an interactive program exits with a non-zero status, the shell prints `Exit ssttaattuuss'. pprroommpptt The string which is printed before reading each command from the terminal. pprroommpptt may include any of the following formatting sequences (+), which are replaced by the given information: %/ The current working directory. %~ The current working directory, but with one's home directory represented by `~' and other users' home directories represented by `~user' as per FFiilleennaammee ssuubbssttiittuuttiioonn. `~user' substi- tution happens only if the shell has already used `~_u_s_e_r' in a pathname in the current ses- sion. %c[[0]_n], %.[[0]_n] The trailing component of the current working directory, or _n trailing components if a digit _n is given. If _n begins with `0', the number of skipped components precede the trailing component(s) in the format `/<_s_k_i_p_p_e_d>trail- ing'. If the eelllliippssiiss shell variable is set, skipped components are represented by an ellipsis so the whole becomes `...trailing'. `~' substitution is done as in `%~' above, but the `~' component is ignored when counting trailing components. %C Like %c, but without `~' substitution. %h, %!, ! The current history event number. %M The full hostname. %m The hostname up to the first `.'. %S (%s) Start (stop) standout mode. %B (%b) Start (stop) boldfacing mode. %U (%u) Start (stop) underline mode. %t, %@ The time of day in 12-hour AM/PM format. %T Like `%t', but in 24-hour format (but see the aammppmm shell variable). %p The `precise' time of day in 12-hour AM/PM format, with seconds. %P Like `%p', but in 24-hour format (but see the aammppmm shell variable). \_c _c is parsed as in _b_i_n_d_k_e_y. ^_c _c is parsed as in _b_i_n_d_k_e_y. %% A single `%'. %n The user name. %d The weekday in `Day' format. %D The day in `dd' format. %w The month in `Mon' format. %W The month in `mm' format. %y The year in `yy' format. %Y The year in `yyyy' format. %l The shell's tty. %L Clears from the end of the prompt to end of the display or the end of the line. %$ Expands the shell or environment variable name immediately after the `$'. %# `>' (or the first character of the pprroommppttcchhaarrss shell variable) for normal users, `#' (or the second character of pprroommppttcchhaarrss) for the supe- ruser. %{_s_t_r_i_n_g%} Includes _s_t_r_i_n_g as a literal escape sequence. It should be used only to change terminal attributes and should not move the cursor location. This cannot be the last sequence in pprroommpptt. %? The return code of the command executed just before the prompt. %R In pprroommpptt22, the status of the parser. In pprroommpptt33, the corrected string. In hhiissttoorryy, the history string. `%B', `%S', `%U' and `%{_s_t_r_i_n_g%}' are available in only eight-bit-clean shells; see the vveerrssiioonn shell variable. The bold, standout and underline sequences are often used to distinguish a superuser shell. For example, > set prompt = "%m [%h] %B[%@]%b [%/] you rang? " tut [37] [[22::5544ppmm]] [/usr/accts/sys] you rang? _ If `%t', `%@', `%T', `%p', or `%P' is used, and nnooddiinngg is not set, then print `DING!' on the change of hour (i.e, `:00' minutes) instead of the actual time. Set by default to `%# ' in interactive shells. pprroommpptt22 (+) The string with which to prompt in _w_h_i_l_e and _f_o_r_e_- _a_c_h loops and after lines ending in `\'. The same format sequences may be used as in pprroommpptt (q.v.); note the variable meaning of `%R'. Set by default to `%R? ' in interactive shells. pprroommpptt33 (+) The string with which to prompt when confirming automatic spelling correction. The same format sequences may be used as in pprroommpptt (q.v.); note the variable meaning of `%R'. Set by default to `CORRECT>%R (y|n|e|a)? ' in interactive shells. pprroommppttcchhaarrss (+) If set (to a two-character string), the `%#' for- matting sequence in the pprroommpptt shell variable is replaced with the first character for normal users and the second character for the superuser. ppuusshhddttoohhoommee (+) If set, _p_u_s_h_d without arguments does `pushd ~', like _c_d. ppuusshhddssiilleenntt (+) If set, _p_u_s_h_d and _p_o_p_d do not print the directory stack. rreecceexxaacctt (+) If set, completion completes on an exact match even if a longer match is possible. rreeccooggnniizzee__oonnllyy__eexxeeccuuttaabblleess (+) If set, command listing displays only files in the path that are executable. Slow. rrmmssttaarr (+) If set, the user is prompted before `rm *' is exe- cuted. rrpprroommpptt (+) The string to print on the right-hand side of the screen (after the command input) when the prompt is being displayed on the left. It recognizes the same formatting characters as pprroommpptt. It will automatically disappear and reappear as necessary, to ensure that command input isn't obscured, and will appear only if the prompt, command input, and itself will fit together on the first line. If eeddiitt isn't set, then rrpprroommpptt will be printed after the prompt and before the command input. ssaavveeddiirrss (+) If set, the shell does `dirs -S' before exiting. If the first word is set to a number, at most that many directory stack entries are saved. ssaavveehhiisstt If set, the shell does `history -S' before exit- ing. If the first word is set to a number, at most that many lines are saved. (The number must be less than or equal to hhiissttoorryy.) If the second word is set to `merge', the history list is merged with the existing history file instead of replac- ing it (if there is one) and sorted by time stamp and the most recent events are retained. (+) sscchheedd (+) The format in which the _s_c_h_e_d builtin command prints scheduled events; if not given, `%h\t%T\t%R\n' is used. The format sequences are described above under pprroommpptt; note the variable meaning of `%R'. sshheellll The file in which the shell resides. This is used in forking shells to interpret files which have execute bits set, but which are not executable by the system. (See the description of BBuuiillttiinn aanndd nnoonn--bbuuiillttiinn ccoommmmaanndd eexxeeccuuttiioonn.) Initialized to the (system-dependent) home of the shell. sshhllvvll (+) The number of nested shells. Reset to 1 in login shells. See also llooggiinnsshh. ssttaattuuss The status returned by the last command. If it terminated abnormally, then 0200 is added to the status. Builtin commands which fail return exit status `1', all other builtin commands return sta- tus `0'. ssyymmlliinnkkss (+) Can be set to several different values to control symbolic link (`symlink') resolution: If set to `chase', whenever the current directory changes to a directory containing a symbolic link, it is expanded to the real name of the directory to which the link points. This does not work for the user's home directory; this is a bug. If set to `ignore', the shell tries to construct a current directory relative to the current direc- tory before the link was crossed. This means that _c_ding through a symbolic link and then `cd ..'ing returns one to the original directory. This affects only builtin commands and filename comple- tion. If set to `expand', the shell tries to fix sym- bolic links by actually expanding arguments which look like path names. This affects any command, not just builtins. Unfortunately, this does not work for hard-to-recognize filenames, such as those embedded in command options. Expansion may be prevented by quoting. While this setting is usually the most convenient, it is sometimes mis- leading and sometimes confusing when it fails to recognize an argument which should be expanded. A compromise is to use `ignore' and use the editor command _n_o_r_m_a_l_i_z_e_-_p_a_t_h (bound by default to ^X-n) when necessary. Some examples are in order. First, let's set up some play directories: > cd /tmp > mkdir from from/src to > ln -s from/src to/dist Here's the behavior with ssyymmlliinnkkss unset, > cd /tmp/to/dist; echo $cwd /tmp/to/dist > cd ..; echo $cwd /tmp/from here's the behavior with ssyymmlliinnkkss set to `chase', > cd /tmp/to/dst; echo $cwd /tmp/from/src > cd ..; echo $cwd /tmp/from here's the behavior with ssyymmlliinnkkss set to `ignore', > cd /tmp/to/dist; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to and here's the behavior with ssyymmlliinnkkss set to `expand'. > cd /tmp/to/dist; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to > cd /tmp/to/dist; echo $cwd /tmp/to/dst > cd ".."; echo $cwd /tmp/from > /bin/echo .. /tmp/to > /bin/echo ".." .. Note that `expand' expansion 1) works just like `ignore' for builtins like _c_d, 2) is prevented by quoting, and 3) happens before filenames are passed to non-builtin commands. ttccsshh (+) The version number of the shell in the format `R.VV.PP', where `R' is the major release number, `VV' the current version and `PP' the patchlevel. tteerrmm The terminal type. Usually set in _~_/_._l_o_g_i_n as described under SSttaarrttuupp aanndd sshhuuttddoowwnn. ttiimmee If set to a number, then the _t_i_m_e builtin (q.v.) executes automatically after each command which takes more than that many CPU seconds. If there is a second word, it is used as a format string for the output of the _t_i_m_e builtin. (u) The fol- lowing sequences may be used in the format string: %U The time the process spent in user mode in cpu seconds. %S The time the process spent in kernel mode in cpu seconds. %E The elapsed (wall clock) time in seconds. %P The CPU percentage computed as (%U + %S) / %E. %W Number of times the process was swapped. %X The average amount in (shared) text space used in Kbytes. %D The average amount in (unshared) data/stack space used in Kbytes. %K The total space used (%X + %D) in Kbytes. %M The maximum memory the process had in use at any time in Kbytes. %F The number of major page faults (page needed to be brought from disk). %R The number of minor page faults. %I The number of input operations. %O The number of output operations. %r The number of socket messages received. %s The number of socket messages sent. %k The number of signals received. %w The number of voluntary context switches (waits). %c The number of involuntary context switches. Only the first four sequences are supported on systems without BSD resource limit functions. The default time format is `%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww' for systems that support resource usage reporting and `%Uu %Ss %E %P' for systems that do not. Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not available, but the following additional sequences are: %Y The number of system calls performed. %Z The number of pages which are zero-filled on demand. %i The number of times a process's resident set size was increased by the kernel. %d The number of times a process's resident set size was decreased by the kernel. %l The number of read system calls performed. %m The number of write system calls performed. %p The number of reads from raw disk devices. %q The number of writes to raw disk devices. and the default time format is `%Uu %Ss $E %P %I+%Oio %Fpf+%Ww'. Note that the CPU percentage can be higher than 100% on multi-processors. ttppeerriioodd (+) The period, in minutes, between executions of the _p_e_r_i_o_d_i_c special alias. ttttyy (+) The name of the tty, or empty if not attached to one. uuiidd (+) The user's real user ID. uusseerr The user's login name. vveerrbboossee If set, causes the words of each command to be printed, after history substitution (if any). Set by the --vv command line option. vveerrssiioonn (+) The version ID stamp. It contains the shell's version number (see ttccsshh), origin, release date, vendor, operating system and machine (see VVEENNDDOORR, OOSSTTYYPPEE and MMAACCHHTTYYPPEE) and a comma-separated list of options which were set at compile time. Options which are set by default in the distribution are noted. 8b The shell is eight bit clean; default 7b The shell is not eight bit clean nls The system's NLS is used; default for systems with NLS lf Login shells execute _/_e_t_c_/_c_s_h_._l_o_g_i_n before instead of after _/_e_t_c_/_c_s_h_._c_s_h_r_c and _~_/_._l_o_g_i_n before instead of after _~_/_._t_c_s_h_r_c and _~_/_._h_i_s_- _t_o_r_y. dl `.' is put last in ppaatthh for security; default nd `.' is omitted from ppaatthh for security vi _v_i-style editing is the default rather than _e_m_a_c_s dtr Login shells drop DTR when exiting bye _b_y_e is a synonym for _l_o_g_o_u_t and _l_o_g is an alternate name for _w_a_t_c_h_l_o_g al aauuttoollooggoouutt is enabled; default kan Kanji is used if appropriate according to locale settings, unless the nnookkaannjjii shell variable is set sm The system's _m_a_l_l_o_c(3) is used hb The `#! ' convention is emu- lated when executing shell scripts ng The _n_e_w_g_r_p builtin is available rh The shell attempts to set the RREEMMOOTTEEHHOOSSTT envi- ronment variable afs The shell verifies your password with the ker- beros server if local authentication fails. The aaffssuusseerr shell variable or the AAFFSSUUSSEERR environment variable override your local user- name if set. An administrator may enter additional strings to indicate differences in the local version. vviissiibblleebbeellll (+) If set, a screen flash is used rather than the audible bell. See also nnoobbeeeepp. wwaattcchh (+) A list of user/terminal pairs to watch for logins and logouts. If either the user is `any' all ter- minals are watched for the given user and vice versa. Setting wwaattcchh to `(any any)' watches all users and terminals. For example, set watch = (george ttyd1 any console $user any) reports activity of the user `george' on ttyd1, any user on the console, and oneself (or a tres- passer) on any terminal. Logins and logouts are checked every 10 minutes by default, but the first word of wwaattcchh can be set to a number to check every so many minutes. For example, set watch = (1 any any) reports any login/logout once every minute. For the impatient, the _l_o_g builtin command triggers a wwaattcchh report at any time. All current logins are reported (as with the _l_o_g builtin) when wwaattcchh is first set. The wwhhoo shell variable controls the format of wwaattcchh reports. wwhhoo (+) The format string for wwaattcchh messages. The follow- ing sequences are replaced by the given informa- tion: %n The name of the user who logged in/out. %a The observed action, i.e., `logged on', `logged off' or `replaced _o_l_d_u_s_e_r on'. %l The terminal (tty) on which the user logged in/out. %M The full hostname of the remote host, or `local' if the login/logout was from the local host. %m The hostname of the remote host up to the first `.'. The full name is printed if it is an IP address or an X Window System display. %M and %m are available on only systems that store the remote hostname in _/_e_t_c_/_u_t_m_p. If unset, `%n has %a %l from %m.' is used, or `%n has %a %l.' on systems which don't store the remote hostname. wwoorrddcchhaarrss (+) A list of non-alphanumeric characters to be con- sidered part of a word by the _f_o_r_w_a_r_d_-_w_o_r_d, _b_a_c_k_- _w_a_r_d_-_w_o_r_d etc., editor commands. If unset, `*?_-.[]~=' is used. EENNVVIIRROONNMMEENNTT AAFFSSUUSSEERR (+) Equivalent to the aaffssuusseerr shell variable. CCOOLLUUMMNNSS The number of columns in the terminal. See TTeerrmmii-- nnaall mmaannaaggeemmeenntt. DDIISSPPLLAAYY Used by X Window System (see _X(1)). If set, the shell does not set aauuttoollooggoouutt (q.v.). EEDDIITTOORR The pathname to a default editor. See also the VVIISSUUAALL environment variable and the _r_u_n_-_f_g_-_e_d_i_t_o_r editor command. GGRROOUUPP (+) Equivalent to the ggrroouupp shell variable. HHOOMMEE Equivalent to the hhoommee shell variable. HHOOSSTT (+) Initialized to the name of the machine on which the shell is running, as determined by the _g_e_t_h_- _o_s_t_n_a_m_e(2) system call. HHOOSSTTTTYYPPEE (+) Initialized to the type of machine on which the shell is running, as determined at compile time. This variable is obsolete and will be removed in a future version. HHPPAATTHH (+) A colon-separated list of directories in which the _r_u_n_-_h_e_l_p editor command looks for command documen- tation. LLAANNGG Gives the preferred character environment. See NNaattiivvee LLaanngguuaaggee SSyysstteemm ssuuppppoorrtt. LLCC__CCTTYYPPEE If set, only ctype character handling is changed. See NNaattiivvee LLaanngguuaaggee SSyysstteemm ssuuppppoorrtt. LLIINNEESS The number of lines in the terminal. See TTeerrmmiinnaall mmaannaaggeemmeenntt. LLSS__CCOOLLOORRSS The format of this variable is reminiscent of the tteerrmmccaapp((55)) file format; a colon-separated list of expressions of the form "_x_x_=_s_t_r_i_n_g", where "_x_x" is a two-character variable name. The variables with their associated defaults are: no 0 Normal (non-filename) text fi 0 Regular file di 01;34 Directory ln 01;36 Symbolic link pi 33 Named pipe (FIFO) so 01;35 Socket bd 01;33 Block device cd 01;32 Character device ex 01;32 Executable file mi (none) Missing file (defaults to fi) or (none) Orphaned symbolic link (defaults to ln) lc ^[[ Left code rc m Right code ec (none) End code (replaces lc+no+rc) You need to include only the variables you want to change from the default. File names can also be colorized based on filename extension. This is specified in the LLSS__CCOOLLOORRSS variable using the syntax ""**eexxtt==ssttrriinngg"". For example, using ISO 6429 codes, to color all C-lan- guage source files blue you would specify ""**..cc==3344"". This would color all files ending in ..cc in blue (34) color. Control characters can be written either in C-style-escaped notation, or in stty-like ^-nota- tion. The C-style notation adds ^^[[ for Escape, __ for a normal space character, and ?? for Delete. In addition, the ^^[[ escape character can be used to override the default interpretation of ^^[[, ^^, :: and ==. Each file will be written as <> <> <> <> <>. If the <> code is unde- fined, the sequence <> <> <> will be used instead. This is generally more convenient to use, but less general. The left, right and end codes are provided so you don't have to type com- mon parts over and over again and to support weird terminals; you will generally not need to change them at all unless your terminal does not use ISO 6429 color sequences but a different system. If your terminal does use ISO 6429 color codes, you can compose the type codes (i.e., all except the llcc, rrcc, and eecc codes) from numerical commands separated by semicolons. The most common commands are: 0 to restore default color 1 for brighter colors 4 for underlined text 5 for flashing text 30 for black foreground 31 for red foreground 32 for green foreground 33 for yellow (or brown) foreground 34 for blue foreground 35 for purple foreground 36 for cyan foreground 37 for white (or gray) foreground 40 for black background 41 for red background 42 for green background 43 for yellow (or brown) background 44 for blue background 45 for purple background 46 for cyan background 47 for white (or gray) background Not all commands will work on all systems or dis- play devices. A few terminal programs do not recognize the default end code properly. If all text gets col- orized after you do a directory listing, try changing the nnoo and ffii codes from 0 to the numeri- cal codes for your standard fore- and background colors. MMAACCHHTTYYPPEE (+) The machine type (microprocessor class or machine model), as determined at compile time. NNOORREEBBIINNDD (+) If set, printable characters are not rebound to _s_e_l_f_-_i_n_s_e_r_t_-_c_o_m_m_a_n_d. See NNaattiivvee LLaanngguuaaggee SSyysstteemm ssuuppppoorrtt. OOSSTTYYPPEE (+) The operating system, as determined at compile time. PPAATTHH A colon-separated list of directories in which to look for executables. Equivalent to the ppaatthh shell variable, but in a different format. PPWWDD (+) Equivalent to the ccwwdd shell variable, but not syn- chronized to it; updated only after an actual directory change. RREEMMOOTTEEHHOOSSTT (+) The host from which the user has logged in remotely, if this is the case and the shell is able to determine it. Set only if the shell was so compiled; see the vveerrssiioonn shell variable. SSHHLLVVLL (+) Equivalent to the sshhllvvll shell variable. SSYYSSTTYYPPEE (+) The current system type. (Domain/OS only) TTEERRMM Equivalent to the tteerrmm shell variable. TTEERRMMCCAAPP The terminal capability string. See TTeerrmmiinnaall mmaann-- aaggeemmeenntt. UUSSEERR Equivalent to the uusseerr shell variable. VVEENNDDOORR (+) The vendor, as determined at compile time. VVIISSUUAALL The pathname to a default full-screen editor. See also the EEDDIITTOORR environment variable and the _r_u_n_- _f_g_-_e_d_i_t_o_r editor command. FFIILLEESS _/_e_t_c_/_c_s_h_._c_s_h_r_c Read first by every shell. ConvexOS, Stellix and Intel use _/_e_t_c_/_c_s_h_r_c and NeXTs use _/_e_t_c_/_c_s_h_r_c_._s_t_d. A/UX, AMIX, Cray and IRIX have no equivalent in _c_s_h(1), but read this file in _t_c_s_h anyway. Solaris 2.x does not have it either, but _t_c_s_h reads _/_e_t_c_/_._c_s_h_r_c. (+) _/_e_t_c_/_c_s_h_._l_o_g_i_n Read by login shells after _/_e_t_c_/_c_s_h_._c_s_h_r_c. ConvexOS, Stellix and Intel use _/_e_t_c_/_l_o_g_i_n, NeXTs use _/_e_t_c_/_l_o_g_i_n_._s_t_d, Solaris 2.x uses _/_e_t_c_/_._l_o_g_i_n and A/UX, AMIX, Cray and IRIX use _/_e_t_c_/_c_s_h_r_c. _~_/_._t_c_s_h_r_c (+) Read by every shell after _/_e_t_c_/_c_s_h_._c_s_h_r_c or its equivalent. _~_/_._c_s_h_r_c Read by every shell, if _~_/_._t_c_s_h_r_c doesn't exist, after _/_e_t_c_/_c_s_h_._c_s_h_r_c or its equiva- lent. This manual uses `_~_/_._t_c_s_h_r_c' to mean `_~_/_._t_c_s_h_r_c or, if _~_/_._t_c_s_h_r_c is not found, _~_/_._c_s_h_r_c'. _~_/_._h_i_s_t_o_r_y Read by login shells after _~_/_._t_c_s_h_r_c if ssaavveehhiisstt is set, but see also hhiissttffiillee. _~_/_._l_o_g_i_n Read by login shells after _~_/_._t_c_s_h_r_c or _~_/_._h_i_s_t_o_r_y. The shell may be compiled to read _~_/_._l_o_g_i_n before instead of after _~_/_._t_c_s_h_r_c and _~_/_._h_i_s_t_o_r_y; see the vveerrssiioonn shell variable. _~_/_._c_s_h_d_i_r_s (+) Read by login shells after _~_/_._l_o_g_i_n if ssaavveeddiirrss is set, but see also ddiirrssffiillee. _/_e_t_c_/_c_s_h_._l_o_g_o_u_t Read by login shells at logout. ConvexOS, Stellix and Intel use _/_e_t_c_/_l_o_g_o_u_t and NeXTs use _/_e_t_c_/_l_o_g_o_u_t_._s_t_d. A/UX, AMIX, Cray and IRIX have no equivalent in _c_s_h(1), but read this file in _t_c_s_h anyway. Solaris 2.x does not have it either, but _t_c_s_h reads _/_e_t_c_/_._l_o_g_o_u_t. (+) _~_/_._l_o_g_o_u_t Read by login shells at logout after _/_e_t_c_/_c_s_h_._l_o_g_o_u_t or its equivalent. _/_b_i_n_/_s_h Used to interpret shell scripts not start- ing with a `#'. _/_t_m_p_/_s_h_* Temporary file for `<<'. _/_e_t_c_/_p_a_s_s_w_d Source of home directories for `~name' substitutions. The order in which startup files are read may differ if the shell was so compiled; see SSttaarrttuupp aanndd sshhuuttddoowwnn and the vveerrssiioonn shell variable. NNEEWW FFEEAATTUURREESS ((++)) This manual describes _t_c_s_h as a single entity, but experi- enced _c_s_h(1) users will want to pay special attention to _t_c_s_h's new features. A command-line editor, which supports GNU Emacs or _v_i(1)-style key bindings. See TThhee ccoommmmaanndd--lliinnee eeddiittoorr and EEddiittoorr ccoommmmaannddss. Programmable, interactive word completion and listing. See CCoommpplleettiioonn aanndd lliissttiinngg and the _c_o_m_p_l_e_t_e and _u_n_c_o_m_p_l_e_t_e builtin commands. SSppeelllliinngg ccoorrrreeccttiioonn (q.v.) of filenames, commands and variables. EEddiittoorr ccoommmmaannddss (q.v.) which perform other useful func- tions in the middle of typed commands, including documen- tation lookup (_r_u_n_-_h_e_l_p), quick editor restarting (_r_u_n_-_f_g_- _e_d_i_t_o_r) and command resolution (_w_h_i_c_h_-_c_o_m_m_a_n_d). An enhanced history mechanism. Events in the history list are time-stamped. See also the _h_i_s_t_o_r_y command and its associated shell variables, the previously undocumented `#' event specifier and new modifiers under HHiissttoorryy ssuubb-- ssttiittuuttiioonn, the _*_-_h_i_s_t_o_r_y, _h_i_s_t_o_r_y_-_s_e_a_r_c_h_-_*, _i_-_s_e_a_r_c_h_-_*, _v_i_-_s_e_a_r_c_h_-_* and _t_o_g_g_l_e_-_l_i_t_e_r_a_l_-_h_i_s_t_o_r_y editor commands and the hhiissttlliitt shell variable. Enhanced directory parsing and directory stack handling. See the _c_d, _p_u_s_h_d, _p_o_p_d and _d_i_r_s commands and their asso- ciated shell variables, the description of DDiirreeccttoorryy ssttaacckk ssuubbssttiittuuttiioonn, the ddiirrssttaacckk, oowwdd and ssyymmlliinnkkss shell vari- ables and the _n_o_r_m_a_l_i_z_e_-_c_o_m_m_a_n_d and _n_o_r_m_a_l_i_z_e_-_p_a_t_h editor commands. Negation in glob-patterns. See FFiilleennaammee ssuubbssttiittuuttiioonn. New FFiillee iinnqquuiirryy ooppeerraattoorrss (q.v.) and a _f_i_l_e_t_e_s_t builtin which uses them. A variety of AAuuttoommaattiicc,, ppeerriiooddiicc aanndd ttiimmeedd eevveennttss (q.v.) including scheduled events, special aliases, automatic logout and terminal locking, command timing and watching for logins and logouts. Support for the Native Language System (see NNaattiivvee LLaann-- gguuaaggee SSyysstteemm ssuuppppoorrtt), OS variant features (see OOSS vvaarriiaanntt ssuuppppoorrtt and the eecchhoo__ssttyyllee shell variable) and system- dependent file locations (see FFIILLEESS). Extensive terminal-management capabilities. See TTeerrmmiinnaall mmaannaaggeemmeenntt. New builtin commands including _b_u_i_l_t_i_n_s, _h_u_p, _l_s_-_F, _n_e_w_- _g_r_p, _p_r_i_n_t_e_n_v, _w_h_i_c_h and _w_h_e_r_e (q.v.). New variables that make useful information easily avail- able to the shell. See the ggiidd, llooggiinnsshh, ooiidd, sshhllvvll, ttccsshh, ttttyy, uuiidd and vveerrssiioonn shell variables and the HHOOSSTT, RREEMMOOTTEEHHOOSSTT, VVEENNDDOORR, OOSSTTYYPPEE and MMAACCHHTTYYPPEE environment vari- ables. A new syntax for including useful information in the prompt string (see pprroommpptt). and special prompts for loops and spelling correction (see pprroommpptt22 and pprroommpptt33). Read-only variables. See VVaarriiaabbllee ssuubbssttiittuuttiioonn. BBUUGGSS When a suspended command is restarted, the shell prints the directory it started in if this is different from the current directory. This can be misleading (i.e., wrong) as the job may have changed directories internally. Shell builtin functions are not stoppable/restartable. Command sequences of the form `a ; b ; c' are also not handled gracefully when stopping is attempted. If you suspend `b', the shell will then immediately execute `c'. This is especially noticeable if this expansion results from an _a_l_i_a_s. It suffices to place the sequence of com- mands in ()'s to force it to a subshell, i.e., `( a ; b ; c )'. Control over tty output after processes are started is primitive; perhaps this will inspire someone to work on a good virtual terminal interface. In a virtual terminal interface much more interesting things could be done with output control. Alias substitution is most often used to clumsily simulate shell procedures; shell procedures should be provided rather than aliases. Commands within loops are not placed in the history list. Control structures should be parsed rather than being rec- ognized as built-in commands. This would allow control commands to be placed anywhere, to be combined with `|', and to be used with `&' and `;' metasyntax. _f_o_r_e_a_c_h doesn't ignore here documents when looking for its _e_n_d. It should be possible to use the `:' modifiers on the out- put of command substitutions. The screen update for lines longer than the screen width is very poor if the terminal cannot move the cursor up (i.e., terminal type `dumb'). HHPPAATTHH and NNOORREEBBIINNDD don't need to be environment variables. Glob-patterns which do not use `?', `*' or `[]' or which use `{}' or `~' are not negated correctly. The single-command form of _i_f does output redirection even if the expression is false and the command is not exe- cuted. _l_s_-_F includes file identification characters when sorting filenames and does not handle control characters in file- names well. It cannot be interrupted. Report bugs to tcsh-bugs@mx.gw.com, preferably with fixes. If you want to help maintain and test tcsh, send mail to listserv@mx.gw.com with the text `subscribe tcsh ' on a line by itself in the body. You can also `subscribe tcsh-bugs ' to get all bug reports, or `subscribe tcsh-diffs ' to get the develop- ment list plus diffs for each patchlevel. TTHHEE TT IINN TTCCSSHH In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementation. It was re-christened the DECsystem-10 in 1970 or so when DEC brought out the second model, the KI10. TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts think tank) in 1972 as an experiment in demand-paged virtual memory operating systems. They built a new pager for the DEC PDP-10 and created the OS to go with it. It was extremely successful in academia. In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to have only a version of TENEX, which they had licensed from BBN, for the new box. They called their version TOPS-20 (their capitalization is trade- marked). A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC found themselves support- ing two incompatible systems on the same hardware--but then there were 6 on the PDP-11! TENEX, and TOPS-20 to version 3, had command completion via a user-code-level subroutine library called ULTCMD. With version 3, DEC moved all that capability and more into the monitor (`kernel' for you Unix types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the supervisor call mechanism [are my IBM roots also show- ing?]). The creator of tcsh was impressed by this feature and sev- eral others of TENEX and TOPS-20, and created a version of csh which mimicked them. LLIIMMIITTAATTIIOONNSS Words can be no longer than 1024 characters. The system limits argument lists to 10240 characters. The number of arguments to a command which involves file- name expansion is limited to 1/6th the number of charac- ters allowed in an argument list. Command substitutions may substitute no more characters than are allowed in an argument list. To detect looping, the shell restricts the number of _a_l_i_a_s substitutions on a single line to 20. SSEEEE AALLSSOO csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1), tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2), pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2), mal- loc(3), setlocale(3), tty(4), a.out(5), termcap(5), envi- ron(7), termio(7), Introduction to the C Shell VVEERRSSIIOONN This manual documents tcsh 6.10.00 (Astron) 2000-11-19. AAUUTTHHOORRSS William Joy Original author of _c_s_h(1) J.E. Kulp, IIASA, Laxenburg, Austria Job control and directory stack features Ken Greer, HP Labs, 1981 File name completion Mike Ellis, Fairchild, 1983 Command name recognition/completion Paul Placeway, Ohio State CIS Dept., 1983-1993 Command line editor, prompt routines, new glob syntax and numerous fixes and speedups Karl Kleinpaste, CCI 1983-4 Special aliases, directory stack extraction stuff, login/logout watch, scheduled events, and the idea of the new prompt format Rayan Zachariassen, University of Toronto, 1984 _l_s_-_F and _w_h_i_c_h builtins and numerous bug fixes, modifi- cations and speedups Chris Kingsley, Caltech Fast storage allocator routines Chris Grevstad, TRW, 1987 Incorporated 4.3BSD _c_s_h into _t_c_s_h Christos S. Zoulas, Cornell U. EE Dept., 1987-94 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support and a new version of sh.glob.c James J Dempsey, BBN, and Paul Placeway, OSU, 1988 A/UX port Daniel Long, NNSC, 1988 wwoorrddcchhaarrss Patrick Wolfe, Kuck and Associates, Inc., 1988 _v_i mode cleanup David C Lawrence, Rensselaer Polytechnic Institute, 1989 aauuttoolliisstt and ambiguous completion listing Alec Wolman, DEC, 1989 Newlines in the prompt Matt Landau, BBN, 1989 _~_/_._t_c_s_h_r_c Ray Moody, Purdue Physics, 1989 Magic space bar history expansion Mordechai ????, Intel, 1989 printprompt() fixes and additions Kazuhiro Honda, Dept. of Computer Science, Keio Univer- sity, 1989 Automatic spelling correction and pprroommpptt33 Per Hedeland, Ellemtel, Sweden, 1990- Various bugfixes, improvements and manual updates Hans J. Albertsson (Sun Sweden) aammppmm, _s_e_t_t_c and _t_e_l_l_t_c Michael Bloom Interrupt handling fixes Michael Fine, Digital Equipment Corp Extended key support Eric Schnoebelen, Convex, 1990 Convex support, lots of _c_s_h bug fixes, save and restore of directory stack Ron Flax, Apple, 1990 A/UX 2.0 (re)port Dan Oscarsson, LTH Sweden, 1990 NLS support and simulated NLS support for non NLS sites, fixes Johan Widen, SICS Sweden, 1990 sshhllvvll, Mach support, _c_o_r_r_e_c_t_-_l_i_n_e, 8-bit printing Matt Day, Sanyo Icon, 1990 POSIX termio support, SysV limit fixes Jaap Vermeulen, Sequent, 1990-91 Vi mode fixes, expand-line, window change fixes, Symme- try port Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991 aauuttoolliisstt beeping options, modified the history search to search for the whole string from the beginning of the line to the cursor. Scott Krotz, Motorola, 1991 Minix port David Dawes, Sydney U. Australia, Physics Dept., 1991 SVR4 job control fixes Jose Sousa, Interactive Systems Corp., 1991 Extended _v_i fixes and _v_i delete command Marc Horowitz, MIT, 1991 ANSIfication fixes, new exec hashing code, imake fixes, _w_h_e_r_e Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995 ETA and Pyramid port, Makefile and lint fixes, iiggnnoorreeeeooff=n addition, and various other portability changes and bug fixes Jeff Fink, 1992 _c_o_m_p_l_e_t_e_-_w_o_r_d_-_f_w_d and _c_o_m_p_l_e_t_e_-_w_o_r_d_-_b_a_c_k Harry C. Pulley, 1992 Coherent port Andy Phillips, Mullard Space Science Lab U.K., 1992 VMS-POSIX port Beto Appleton, IBM Corp., 1992 Walking process group fixes, _c_s_h bug fixes, POSIX file tests, POSIX SIGHUP Scott Bolte, Cray Computer Corp., 1992 CSOS port Kaveh R. Ghazi, Rutgers University, 1992 Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf support. Mark Linderman, Cornell University, 1992 OS/2 port Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992 Linux port Tim P. Starrin, NASA Langley Research Center Operations, 1993 Read-only variables Dave Schweisguth, Yale University, 1993-4 New man page and tcsh.man2html Larry Schwimmer, Stanford University, 1993 AFS and HESIOD patches Luke Mewburn, RMIT University, 1994-6 Enhanced directory printing in prompt, added eelllliippssiiss and rrpprroommpptt. Edward Hutchins, Silicon Graphics Inc., 1996 Added implicit cd. Martin Kraemer, 1997 Ported to Siemens Nixdorf EBCDIC machine Amol Deshpande, Microsoft, 1997 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library and message catalog code to inter- face to Windows. Taga Nayuta, 1998 Color ls additions. TTHHAANNKKSS TTOO Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig, Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all the other people at Ohio State for suggestions and encouragement All the people on the net, for putting up with, reporting bugs in, and suggesting new additions to each and every version Richard M. Alderson III, for writing the `T in tcsh' sec- tion Astron 6.10.00 19 November 2000 TCSH(1)