... is an enhanced but completely compatible version of the Berkeley UNIX C shell, It is a command language interpreter usable both as an interactive login shell and a shell script command processor. It includes a command- line editor (see programmable word completion (see spelling correction (see a history mechanism (see job control (see and a C-like syntax. The section describes major enhancements of over Throughout this manual, features of not found in most implementations (specifically, the 4.4BSD are labeled with and features which are present in but not usually documented are labeled with If the first argument (argument 0) to the shell is then it is a login shell. A login shell can be also specified by invoking the shell with the flag as the only argument. The rest of the flag arguments are interpreted as follows: Forces a from option processing, causing any further shell arguments to be treated as non-option arguments. The remaining arguments will not be interpreted as shell options. This may be used to pass options to a shell script without confusion or possible subterfuge. The shell will not run a set-user ID script without this option. Commands are read from the following argument (which must be present, and must be a single argument), stored in the shell variable for reference, and executed. Any remaining arguments are placed in the shell variable. The shell loads the directory stack from as described under whether or not it is a login shell. (+) Sets the environment variable to (Domain/OS only) (+) The shell exits if any invoked command terminates abnormally or yields a non-zero exit status. The shell does not load any resource or startup files, or perform any command hashing, and thus starts faster. The shell uses instead of to spawn processes. (+) 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. The shell is a login shell. Applicable only if is the only flag specified. The shell loads even if it does not belong to the effective user. Newer versions of can pass to the shell. (+) The shell parses commands but does not execute them. This aids in debugging shell scripts. The shell accepts SIGQUIT (see and behaves when it is used under a debugger. Job control is disabled. (u) Command input is taken from the standard input. 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. Sets the shell variable, so that command input is echoed after history substitution. Sets the shell variable, so that commands are echoed immediately before execution. Sets the shell variable even before executing Is to as is to Print a help message on the standard output and exit. (+) Print the version/platform/compilation options on the standard output and exit. This information is also contained in the shell variable. (+) After processing of flag arguments, if arguments remain but none of the or options were given, the first argument is taken as the name of a file of commands, or to be executed. The shell opens this file and saves its name for possible resubstitution by 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 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 shell variable. A login shell begins by executing commands from the system files and It then executes commands from files in the user's directory: first or, if is not found, then the contents of (or the value of the shell variable) are loaded into memory, then and finally (or the value of the shell variable) (+). The shell may read before instead of after and before instead of after or and if so compiled; see the shell variable. (+) Non-login shells read only and or on startup. For examples of startup files, please consult: Commands like and which need be run only once per login, usually go in one's file. Users who need to use the same set of files with both and can have only a which checks for the existence of the shell variable before using -specific commands, or can have both a and a which s (see the builtin command) The rest of this manual uses to mean or, if is not found, In the normal case, the shell begins reading commands from the terminal, prompting with (Processing of arguments and the use of the shell to process files containing command scripts are described later.) The shell repeatedly reads a line of command input, breaks it into words, places it on the command history list, parses it and executes each command in the line. One can log out by typing on an empty line, or or via the shell's autologout mechanism (see the shell variable). When a login shell terminates it sets the shell variable to or as appropriate, then executes commands from the files and The shell may drop DTR on logout if so compiled; see the shell variable. The names of the system login and logout files vary from system to system for compatibility with different variants; see We first describe The and sections describe two sets of functionality that are implemented as editor commands but which deserve their own treatment. Finally, lists and describes the editor commands specific to the shell and their default bindings. Command-line input can be edited using key sequences much like those used in or The editor is active only when the shell variable is set, which it is by default in interactive shells. The builtin can display and change key bindings to editor commands (see -style key bindings are used by default (unless the shell was compiled otherwise; see the shell variable), but can change the key bindings to -style bindings en masse. The shell always binds the arrow keys (as defined in the environment variable) to editor commands: unless doing so would alter another single-character binding. One can set the arrow key escape sequences to the empty string with to prevent these bindings. The ANSI/VT100 sequences for arrow keys are always bound. Other key bindings are, for the most part, what and users would expect and can easily be displayed by so there is no need to list them here. Likewise, can list the editor commands with a short description of each. Certain key bindings have different behavior depending if or -style bindings are being used; see for more information. Note that editor commands do not have the same notion of a as does the shell. The editor delimits words with any non-alphanumeric characters not in the shell variable while the shell recognizes only whitespace and some of the characters with special meanings to it, listed under The shell is often able to complete words when given a unique abbreviation. For example, typing part of a word and hit the tab key to run the editor command. The shell completes the filename to replacing the incomplete 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 shell variable can be unset to prevent this.) If no match is found (perhaps doesn't exist), the terminal bell rings. If the word is already complete (perhaps there is a 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 would complete to if were the only command on your system beginning with Completion can find a command in any directory in or if given a full pathname. Typing would complete to if no other variable began with The shell parses the input buffer to determine whether the word you want to complete should be completed as a filename, 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 filename. An empty line is as a filename. You can list the possible completions of a word at any time by typing to run the editor command. The shell lists the possible completions using the builtin and reprints the prompt and unfinished command line, for example: > ls /usr/l[^D] lbin/ lib/ local/ lost+found/ > ls /usr/l If the 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 the shell variable is set to 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 and directory stack entries abbreviated with (see 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 editor command. 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 the variable is set, does nothing. bound to the editor command lists completion possibilities anywhere on a line, and (or any one of the related editor commands that do or don't delete, list and/or log out, listed under can be bound to with the builtin command if so desired. The and editor commands (not bound to any keys by default) can be used to cycle up and down through the list of possible completions, replacing the current word with the next or previous word in the list. The shell variable can be set to a list of suffixes to be ignored by completion. Consider the following: > 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 and are ignored by completion (but not listing), because they end in suffixes in Note that a was needed in front of to prevent it from being expanded to as described under is ignored if only one completion is possible. If the shell variable is set to completion 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 it would be completed to and typing would list and Typing would list and Typing 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. If the shell variable is set to completion ignores case and differences between a hyphen and an underscore word separator only when the user types a lowercase character or a hyphen. Entering an uppercase character or an underscore will not match the corresponding lowercase character or hyphen word separator. Typing in the directory of the previous example would still list all three files, but typing would match only and typing would match just and because the user explicitly used an uppercase or an underscore character. Completion and listing are affected by several other shell variables: 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 could expand to or but if we type another > rm foo[tab] > rm foo the completion completes on even though and also match. can be set to run the editor command before each completion attempt, can be set to spelling-correct the word to be completed (see before each completion attempt and can be set to complete commands automatically after one hits return. can be set to make completion beep or not beep in a variety of situations, and can be set to never beep at all. can be set to a list of directories and/or patterns that match directories to prevent the completion mechanism from ing those directories. and can be set to limit the number of items and rows (respectively) that are listed without asking first. can be set to make the shell list only executables when listing commands, but it is quite slow. Finally, the builtin command can be used to tell the shell how to complete words other than filenames, commands and variables. Completion and listing do not work on glob-patterns (see but the and editor commands perform equivalent functions for glob-patterns. 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 editor command (usually bound to and and the entire input buffer with (usually bound to The shell variable can be set to to correct the command name or to correct the entire line each time return is typed, and 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 or space to execute the corrected line, to leave the uncorrected command in the input buffer, to abort the command as if had been hit, and anything else to execute the original line unchanged. Spelling correction recognizes user-defined completions (see the 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 correction. However, if the input word does not match any of the possible completions for that position, spelling correction does not register a misspelling. Like completion, spelling correction works anywhere in the line, pushing the rest of the line to the right and possibly leaving extra characters to the right of the cursor. lists key bindings and lists and briefly describes editor commands. Only new or especially interesting editor commands are described here. See and for descriptions of each editor's key bindings. The character or characters to which each command is bound by default is given in parentheses. means a control character and a meta character, typed as (or 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. Supported editor commands are: Move back a character. Cursor behavior modified by Cut from beginning of current word to cursor - saved in cut buffer. Word boundary behavior modified by Move to beginning of current word. Word boundary and cursor behavior modified by Move to beginning of line. Cursor behavior modified by Capitalize the characters from cursor to end of current word. Word boundary behavior modified by Completes a word as described under Like but steps up from the end of the list. 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. Like but ignores user-defined completions. Copies the previous word in the current line into the input buffer. See also Word boundary behavior modified by Expands the current word to the most recent preceding one for which the current is a leading substring, wrapping around the history list (once) if necessary. Repeating without any intervening typing changes to the next previous word etc., skipping identical matches much like does. Deletes the character under the cursor. See also Cursor behavior modified by Does if there is a character under the cursor or on an empty line. See also Cursor behavior modified by Does if there is a character under the cursor or at the end of the line. See also Does if there is a character under the cursor, at the end of the line or on an empty line. See also those three commands, each of which does only a single action, and and each of which does a different two out of the three. Cut from cursor to end of current word - save in cut buffer. Word boundary behavior modified by Like but steps down, stopping at the original input line. Lowercase the characters from cursor to end of current word. Word boundary behavior modified by Signals an end of file, causing the shell to exit unless the shell variable is set to prevent this. See also Move cursor to end of line. Cursor behavior modified by Expands history substitutions in the current word. See See also and the shell variable. Expands the glob-pattern to the left of the cursor. See Like but expands history substitutions in each word in the input buffer. Expands the variable to the left of the cursor. See Move forward one character. Cursor behavior modified by Move forward to end of current word. Word boundary and cursor behavior modified by 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 containing or and will proceed from the appropriate point in the history list. Emacs mode only. See also and Like but searches forward. Searches backward like copies the first match into the input buffer with the cursor positioned at the end of the pattern, and prompts with and the first match. Additional characters may be typed to extend the search, may be typed to continue searching with the same pattern, wrapping around the history list if necessary, must be bound to a single character for this to work) or one of the following special characters may be typed: Appends the rest of the word under the cursor to the search pattern. Undoes the effect of the last character typed and deletes a character from the search pattern if appropriate. If the previous search was successful, aborts the entire search. If not, goes back to the last successful search. Ends the search, leaving the current line in the input buffer. Any other character not bound to 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. See also and Word boundary behavior modified by Like but searches forward. Word boundary behavior modified by Inserts the last word of the previous input line into the input buffer. See also Lists completion possibilities as described under See also and Like but ignores user-defined completions. Lists (via the builtin) matches to the glob-pattern (see to the left of the cursor. Does or on an empty line. See also Expands history substitutions in the current line, like and inserts a space. is designed to be bound to the space bar, but is not bound by default. Searches for the current word in 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., and Expands the current word as described under the setting of the shell variable. Toggles between input and overwrite modes. Saves the current input line and looks for a stopped job where the file name portion of its first word is found in the shell variable. If is not set, then the file name portion of the environment variable if unset) and the environment variable if unset) will be used. If such a job is found, it is restarted as if had been typed. This is used to toggle back and forth between an editor and the shell easily. Some people bind this command to so they can do this even more easily. Searches for documentation on the current command, using the same notion of as the completion routines, and prints it. There is no way to use a pager; is designed for short help files. If the special alias is defined, it is run with the command name as a sole argument. Else, documentation should be in a file named or which should be in one of the directories listed in the environment variable. If there is more than one help file only the first is printed. 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 character. The input mode is normally preserved between lines, but the shell variable can be set to or to put the editor in that mode at the beginning of each line. See also 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 and the whole sequence to the command. All sequences beginning with a character bound to are effectively bound to unless bound to another command. Attempts to correct the spelling of each word in the input buffer, like but ignores words whose first character is one of or or which contain or to avoid problems with switches, substitutions and the like. See Attempts to correct the spelling of the current word as described under Checks each component of a word which appears to be a pathname. Expands or unexpands history substitutions in the input buffer. See also and the shell variable. Beeps. Copies the previous entry in the history list into the input buffer. If is set, uses the literal form of the entry. May be repeated to step up through the history list, stopping at the top. Uppercase the characters from cursor to end of current word. Word boundary behavior modified by Vi goto the beginning of next word. Word boundary and cursor behavior modified by Vi move to the end of the current word. Word boundary behavior modified by Prompts with for a search string (which may be a glob-pattern, as with 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. mode only. Like but searches forward. Does a (see the description of the builtin command) on the first word of the input buffer. When executed immediately after a or another replaces the yanked string with the next previous string from the killring. This also has the effect of rotating the killring, such that this string will be considered the most recently killed by a later command. Repeating will cycle through the killring any number of times. 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 prevented 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 newline preceded by a is equivalent to a blank, but inside quotes this sequence results in a newline. Furthermore, all except 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 or respectively) with is no exception: quoting in any way any character of a word for which an has been defined prevents substitution of the alias. The usual way of quoting an alias is to precede it with a backslash.) is prevented by backslashes but not by single quotes. Strings quoted with double or backward quotes undergo and but other substitutions are prevented. 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 can a double-quoted string yield parts of more than one word; single-quoted strings never do. Backward quotes are special: they signal which may result in more than one word. C-style escape sequences can be used in single quoted strings by preceding the leading quote with (+) See for a complete list of recognized escape sequences. Quoting complex strings, particularly strings which themselves 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 shell variable can be set to make backslashes always quote and (+). This may make complex quoting tasks easier, but it can cause syntax errors in scripts. The following escape sequences are always recognized inside a string constructed using and optionally by the builtin command as controlled by the shell variable. Supported escape sequences are: Bell. Backspace. The control character denoted by in If is a backslash, it must be doubled. Escape. Form feed. Newline. Carriage return. Horizontal tab. Vertical tab. Literal backslash. Literal single quote. Literal double quote. The character corresponding to the octal number The character corresponding to the hexadecimal number (1-2 hexadecimal digits). The character corresponding to the hexadecimal number (1-8 hexadecimal digits). The Unicode code point (1-4 hexadecimal digits). The Unicode code point (1-8 hexadecimal digits). The implementations of and in other shells may take a varying number of digits. It is often safest to use leading zeros to provide the maximum expected number of digits. We now describe the various transformations the shell performs on the input in the order in which they occur. We note in passing the data structures involved and the commands and variables which affect them. Remember that substitutions can be prevented by quoting as described under Each command, or input from the terminal is saved in the history list. The previous command is always saved, and the shell variable can be set to a number to save that many commands. The shell variable can be set to not save duplicate events or consecutive 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 shell variable. By default history entries are displayed by printing each parsed token separated by space; thus the redirection operator will be displayed as The shell actually saves history in expanded and literal (unexpanded) forms. If the shell variable is set, commands that display and store history use the literal form. The builtin command can print, store in a file, restore and clear the history list at any time, and the and shell variables 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 commands, repeat arguments of a previous command in the current command, or fix spelling mistakes in the previous command with little typing and a high degree of confidence. 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 see The characters used to signal history substitution and can be changed by setting the shell variable. Any input line which contains a history substitution is printed before it is executed. A history substitution may have an (see which indicates the event from which words are to be taken, a (see which selects particular words from the chosen event, and/or a (see which manipulates the selected words. A history event specification may be one of (with the history substitution character shown): A number, referring to a particular event. An offset, referring to the event before the current event. The current event. This should be used carefully in where there is no check for recursion. allows 10 levels of recursion. (+) The previous event, equivalent to The most recent event whose first word begins with the string The most recent event which contains the string 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. Typing or refers to event 11. Typing refers to the previous event, 12. can be abbreviated if it is followed by which is described in and Typing refers to event 9, which begins with Typing refers to event 12, which contains Without word designators or modifiers history references simply expand to the entire event, so we might type to redo the command (event 10) or if the output in the previous event, 12, scrolled off the top of the screen. History references may be insulated from the surrounding text with braces and if necessary. For example, would look for a command beginning with and, in this example, not find one, but would expand unambiguously to by matching event 11. Even in braces, history substitutions do not nest. (+) While expands, for example, to event 3 with the letter appended to it, expands it to the last event beginning with only completely numeric arguments are treated as event numbers. This makes it possible to recall events beginning with numbers. To expand as in type 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, with columns for a leading and a leading (for the abbreviated word designators - see The first (command) word. The th argument. The first argument, equivalent to The last argument. The word matched by an search. A range of words. Equivalent to Equivalent to but returns nothing if the event contains only 1 word. Equivalent to Equivalent to but omitting the last word Equivalent to the command and all arguments except the last argument. Selected words are inserted into the command line separated by single blanks. For example, the command (event 12) in the history list example in might have been typed as (using to select the first argument from the previous event) or to select and swap the arguments from the command (event 10). If we didn't care about the order of the we might have typed or simply The command (event 10) might have been typed using to refer to the current event. Typing would reuse the first two words from the command (event 9) to expand to The separating the event specification from the word designator can be omitted if the argument selector begins with a or For example, our command (event 12) might have been typed or, equivalently, 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 command. Continuing our command example (event 12), we could have typed simply or, to get the arguments in the opposite order, just The word or words in a history reference can be edited, or by following it with one or more modifiers (with the leading shown), each preceded by a Remove a trailing pathname component, leaving the head. Remove all leading pathname components, leaving the tail. Remove a filename extension leaving the root name. Remove all but the extension. Uppercase the first lowercase letter. Lowercase the first uppercase letter. Substitute for is simply a string like not a regular expression as in the eponymous command. Any character may be used as the delimiter in place of a can be used to quote the delimiter inside and The character in the is replaced by also quotes If is empty the from a previous substitution or the from a previous search or event number in event specification is used. The trailing delimiter may be omitted if it is immediately followed by a newline. Repeat the previous substitution. Apply the following modifier once to each word. Apply the following modifier as many times as possible to a single word. and can be used together to apply a modifier globally. With the modifier, only the patterns contained in the original word are substituted, not patterns that contain any substitution result. Print the new command line but do not execute it. Quote the substituted words, preventing further substitutions. Same as but in addition preserve empty variables as a string containing a NUL. This is useful to preserve positional arguments for example: > set args=('arg 1' '' 'arg 3') > tcsh -f -c 'echo ${#argv}' $args:gQ 3 Like but break into words at blanks, tabs and newlines. Modifiers are applied to only the first modifiable word (unless is used). It is an error for no word to be modifiable. For example, the command (event 12) in the history list example in might have been typed as using to remove from the first argument on the same line We could type then to capitalize to upper case the first word to or to upper case all words. We might follow with to correct the spelling of (see and for different approaches). (+) In as such, only one modifier may be applied to each history or variable expansion. In more than one may be used, for example % mv wumpus.man /usr/share/man/man1/wumpus.1 % man !$:t:r man wumpus In the result would be A substitution followed by a 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 but fails in because expects another modifier after the second rather than There is a special abbreviation for substitutions; when it is the first character on an input line, is equivalent to Thus, we might follow the example from with to make the spelling correction. This is the only history substitution which does not explicitly begin with Finally, history can be accessed through the editor as well as through the substitutions just described. The and and and and and editor commands search for events in the history list and copy them into the input buffer. The editor command switches between the expanded and literal forms of history lines in the input buffer. and expand history substitutions in the current word and in the entire input buffer respectively. The shell maintains a list of aliases which can be set, unset and printed by the and commands. After a command line is parsed into simple commands (see 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 as though the original command were the previous input line. If the alias does not contain a history reference, the argument list is left untouched. Thus if the alias for were the command would become the argument list here being undisturbed. If the alias for were then would become Aliases can be used to introduce parser metasyntax. For example, defines a which 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 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 and commands. The system maintains its own list of variables. These can be displayed and changed with and (+) Variables may be made read-only with Read-only variables may not be modified or unset; attempting to do so will cause an error. Once made read-only, a variable cannot be made writable, so 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 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 variable is a toggle which causes command input to be echoed. The command line option sets this variable. 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 performed keyed by characters. This expansion can be prevented by preceding the with a except within pairs where it occurs, and within pairs where it occurs. Strings quoted by are interpreted later (see 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. Otherwise, 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 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 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 editor command normally bound to can be used to interactively expand individual variables. The following metasequences are provided for introducing variable values into the shell input: Substitutes the words of the value of variable each separated by a blank. Braces insulate from following characters which would otherwise be part of it. Shell variables have names consisting of letters and digits starting with a letter. The underscore character is considered a letter. If is not a shell variable, but is set in the environment, then that value is returned (but some of the other forms given below are not available in this case). Substitutes only the selected words from the value of The is subjected to substitution and may consist of a single number or two numbers separated by a The first word of a variable's value is numbered If the first number of a range is omitted it defaults to If the last member of a range is omitted it defaults to The selects all words. It is not an error for a range to be empty if the second argument is omitted or in range. Substitutes the name of the file from which command input is being read. An error occurs if the name is not known. Equivalent to Equivalent to which is equivalent to Except as noted, it is an error to reference a variable which is not set. The modifiers described under except for 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 just as with any modifiers must appear within the braces. The following substitutions cannot be modified with modifiers: Substitutes the string if is set, if it is not. Substitutes if the current input filename is known, if it is not. Always in interactive shells. Substitutes the number of words in Equivalent to (+) Substitutes the number of characters in (+) Substitutes the number of characters in (+) Equivalent to (+) 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 always quotes as if it were equivalent to does not. Furthermore, when 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 does not allow this. Substitutes the number of available bytes from the standard input. (This feature might be non-portable.) (+) 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. Command substitution is indicated by a command enclosed in The output from such a command is broken into separate words at blanks, tabs and newlines, and null words are discarded. The output is variable and command substituted and put in place of the original string. Command substitutions inside double quotes retain blanks and tabs; only newlines force new words. The single 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 complete line. By default, the shell since version 6.12 replaces all newline and carriage return characters in the command by spaces. If this is switched off by unsetting newlines separate commands as usual. If a word contains any of the characters or or begins with the character it is a candidate for filename substitution, also known as This word is then regarded as a 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 (unless either or or both are set (+)). The character matches any string of characters, including the null string. The character matches any single character. The sequence matches any one of the characters enclosed. Within a pair of characters separated by matches any character lexically between the two. (+) Some glob-patterns can be negated: The sequence matches any single character 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 is a shorthand for Left-to- right order is preserved: expands to The results of matches are sorted separately at a low level to preserve this order: might expand to (Note that was not sorted with the results of matching 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 shell variable. When followed by a name consisting of letters, digits and characters the shell searches for a user with that name and substitutes their home directory; thus might expand to and might expand to 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 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. However, only one pattern in a list of glob-patterns must match a file (so that, e.g., would fail only if there were no files in the current directory ending in or and if the shell variable is set a pattern (or list of patterns) which matches nothing is left unchanged rather than causing an error. The shell variable can be set to allow or as a file glob pattern that matches any string of characters including recursively traversing any existing sub-directories. For example, will list all the .c files in the current directory tree. If used by itself, it will match zero or more sub-directories. For example will list any file named in the directory tree; will match any file in the directory tree ending in and will match any .h file with either in a subdirectory name or in the filename itself. To prevent problems with recursion, the glob-pattern will not descend into a symbolic link containing a directory. To override this, use (+) The shell variable can be set to prevent filename substitution, and the editor command, normally bound to can be used to interactively expand individual filename substitutions. The directory stack is a list of directories, numbered from zero, used by the and builtin commands. can print, store in a file, restore and clear the directory stack at any time, and the and shell variables can be set to store the directory stack automatically on logout and restore it on login. The shell variable can be examined to see the directory stack and set to put arbitrary directories 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 and shell variables and the editor command apply to directory stack as well as filename substitutions. There are several more transformations involving filenames, not strictly related to the above but mentioned here for completeness. filename may be expanded to a full path when the variable is set to Quoting prevents this expansion, and the editor command does it on demand. The editor command expands commands in into full paths on demand. Finally, and interpret as the old working directory (equivalent to the shell variable This is not a substitution at all, but an abbreviation recognized by only those commands. Nonetheless, it too can be prevented by quoting. The next three sections describe how the shell executes commands and deals with their input and output. 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 respectively. A simple command, pipeline or sequence may be placed in parentheses and 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 Builtin commands are executed within the shell. If any component of a pipeline except the last is a builtin command, the pipeline is executed in a subshell. Parenthesized commands are always executed in a subshell. (cd; pwd); pwd thus prints the directory, leaving you where you were (printing this after the home directory), while cd; pwd leaves you in the directory. Parenthesized commands are most often used to prevent from affecting the current shell. When a command to be executed is found not to be a builtin command the shell attempts to execute the command via Each word in the variable names a directory in which the shell will look for the command. If the shell is not given a option, the shell hashes the names in these directories into an internal table so that it will try an 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. This hashing mechanism is not used: If hashing is turned explicitly off via If the shell was given a For each directory component of which does not begin with a If the command contains a In the above four cases the shell concatenates each component of the path vector with the given command name to form a path name of a file which it then attempts to execute it. If execution is successful, the search stops. If the file has execute permissions but is not an executable 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 special alias may be set to specify an interpreter other than the shell itself. On systems which do not understand the script interpreter convention the shell may be compiled to emulate it; see the shell variable. If so, the shell checks the first line of the file to see if it is of the form If it is, the shell starts with the given s and feeds the file to it on standard input. The standard input and standard output of a command may be redirected with the following syntax: Open file (which is first variable, command and filename expanded) as the standard input. Read the shell input up to a line which is identical to is not subjected to variable, filename or command substitution, and each input line is compared to before any substitutions are done on this input line. Unless a quoting or appears in variable and command substitution is performed on the intervening 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. The file is used as standard output. If the file does not exist then it is created; if the file exists, it is truncated, its previous contents being lost. If the shell variable is set, then the file must not exist or be a character special file (e.g., a terminal or or an error results. This helps prevent accidental destruction of files. In this case the forms can be used to suppress this check. If is given in is allowed on empty files; if is given in an interactive confirmation is presented, rather than an error. The forms involving route the diagnostic output into the specified file as well as the standard output. is expanded in the same way as input filenames are. Like but appends output to the end of If the shell variable is set, then it is an error for the file 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 commands 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 present 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 the empty file 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 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 is often an acceptable workaround. Either or may be to send output to the terminal. Having described how the shell accepts, parses and executes command lines, we now turn to a variety of its useful features. 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 implementation, restrict the placement of some of the commands. The and statements, as well as the form of the 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 s will succeed on non-seekable inputs.) The and 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 has its own separate syntax. These operators are similar to those of C and have the same precedence. The operators, in descending precedence, with equivalent precedence per line, are: The and operators compare their arguments as strings; all others operate on numbers. The operators and are like and except that the right hand side is a glob-pattern (see against which the left hand operand is matched. This reduces the need for use of the builtin command in shell scripts when all that is really needed is pattern matching. Null or missing arguments are considered 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 syntactically significant to the parser they should be surrounded by spaces. Commands can be executed in expressions and their exit status returned by enclosing them in braces and Remember that the braces should be separated from the words of the command by spaces. Command executions succeed, returning true, i.e., if the command exits with status 0, otherwise they fail, returning false, i.e., If more detailed status information is required then the command should be executed outside of an expression and the shell variable examined. Some of these operators perform true/false tests on files and related objects. They are of the form where is one of: Read access. Write access. Execute access. Executable in the path or shell builtin, e.g., and are generally true, but is not. (+) Existence. Ownership. Zero size. Non-zero size. (+) Plain file. Directory. Symbolic link. (+) * Block special file. (+) Character special file. (+) Named pipe (fifo). (+) * Socket special file. (+) * Set- user-ID bit is set. (+) Set-group-ID bit is set. (+) Sticky bit is set. (+) (which must be a digit) is an open file descriptor for a terminal device. (+) Has been migrated (Convex only). (+) Applies subsequent operators in a multiple-operator test to a symbolic link rather than to the file to which the link points. (+) * is command and filename expanded and then tested to see if it has the specified relationship to the real user. If 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 inquiries return false, i.e., These operators may be combined for conciseness: is equivalent to (+) For example, is true (returns for plain executable files, but not for directories. may be used in a multiple- operator test to apply subsequent operators to a symbolic link rather than to the file to which the link points. For example, is true for links owned by the invoking user. and are always true for links and false for non- links. has a different meaning when it is the last operator in a multiple-operator test; see below. It is possible but not useful, and sometimes misleading, to combine operators which expect to be a file with operators which do not (e.g., and Following with a non-file operator can lead to particularly strange results. Other operators return other information, i.e., not just or (+) They have the same format as before; may be one of: Last file access time, as the number of seconds since the epoch. Like but in timestamp format, e.g., Last file modification time. Like but in timestamp format. Last inode modification time. Like but in timestamp format. Device number. Inode number. Composite ile identifier, in the form The name of the file pointed to by a symbolic link. Number of (hard) links. Permissions, in octal, without leading zero. Like with leading zero. Equivalent to For example, returns if is writable by group and other, if by group only, and if by neither. Like with leading zero. Numeric userid. Username, or the numeric userid if the username is unknown. Numeric groupid. Groupname, or the numeric groupid if the groupname is unknown. Size, in bytes. Only one of these operators may appear in a multiple-operator test, and it must be the last. Note that has a different meaning at the end of and elsewhere in a multiple-operator test. Because is a valid return value for many of these operators, they do not return when they fail: most return and returns If the shell is compiled with POSIX defined (see the shell variable), the result of a file inquiry is based on the permission bits of the file and not on the result of the system call. For example, if one tests a file with 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 builtin command (+). The shell associates a with each pipeline. It keeps a table of current jobs, printed by the 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 which sends a STOP signal to the current job. The shell will then normally indicate that the job has been and print another prompt. If the shell variable is set, all jobs will be listed like the builtin command; if it is set to the listing will be in long format, like You can then manipulate the state of the suspended job. You can put it in the with the command or run some other commands and eventually bring the job back into the with (See also the editor command.) A takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. The 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 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 key performs this function in in 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 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 Just naming a job brings it to the foreground; thus is a synonym for bringing job 1 back into the foreground. Similarly, typing resumes job 1 in the background, just like A job can also be named by an unambiguous prefix of the string typed in to start it: would normally restart a suspended job, if there were only one suspended job whose name began with the string It is also possible to type to specify a job whose text contains 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 mechanism) all refer to the current job, and refers to the previous job. The job control mechanism requires that the option be set on some systems. It is an artifact from a implementation of the tty driver which allows generation of interrupt characters from the keyboard to tell jobs to stop. See and the builtin command for details on setting options in the new tty driver. 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 the shell will notify you immediately of changes of status in background jobs. There is also a builtin command which marks a single process so that its status changes will be immediately reported. By default marks the current process; simply enter after starting a background job to mark it for immediate status reporting. When you try to leave the shell while jobs are stopped, you will be warned that You may use the 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 terminated. There are various ways to run commands and take other actions automatically at various times in the of the shell. They are summarized here, and described in detail under the appropriate and The builtin command puts commands in a scheduled-event list, to be executed by the shell at a given time. The and can be set, respectively, to execute commands: when the shell wants to ring the bell, when the working directory changes, when a job is started or is brought into the foreground, every minutes, before each prompt, and before each command gets executed. The shell variable can be set to log out or lock the shell after a given number of minutes of inactivity. The shell variable can be set to check for new mail periodically. The shell variable can be set to print the exit status of commands which exit with a status other than zero. The shell variable can be set to ask the user, when is typed, if that is really what was meant. The shell variable can be set to execute the builtin command after the completion of any process that takes more than a given number of CPU seconds. The and shell variables can be set to report when selected users log in or out, and the builtin command reports on those users at any time. The shell is eight bit clean (if so compiled; see the 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 In either case, 7-bit ASCII is the default character code (e.g., the classification of which characters are printable) and sorting, and changing the or environment variables causes a check for possible changes in these respects. When using the system's NLS, the function is called to determine appropriate character code/classification and sorting (e.g., would yield as the character code). This function typically examines the and 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 and variables are set, regardless of their values. Sorting is not affected for the simulated NLS. In addition, with both real and simulated NLS, all printable characters in the range \200-\377, i.e., those that have bindings, are automatically rebound to The corresponding binding for the sequence, if any, is left alone. These characters are not rebound if the environment variable is set. This may be useful for the simulated NLS or a primitive real NLS which assumes full ISO 8859-1. Otherwise, all bindings in the range \240-\377 are effectively undone. Explicitly rebinding the relevant keys with 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 command in, e.g., the file. A number of new builtin commands are provided to support features in particular operating systems. All are described in detail in the section. On systems that support TCF (aix-ibm370, aix-ps2), and get and set the system execution path, and get and set the experimental version prefix and migrates processes between sites. The builtin prints the site on which each job is executing. Under BS2000, executes commands of the underlying BS2000/OSD operating system. Under Domain/OS, adds shared libraries to the current environment, changes the rootnode and changes the systype. Under Mach, is equivalent to Mach's Under Masscomp/RTU and Harris CX/UX, sets the universe. Under Harris CX/UX, or runs a command under the specified universe. Under Convex/OS, prints or sets the universe. The and 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 and put executables compiled for each machine in the appropriate directory. The shell variable indicates what options were chosen when the shell was compiled. Note also the builtin, the and shell variables and the system-dependent locations of the shell's input files (see Login shells ignore interrupts when reading the file The shell ignores quit signals unless started with 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 and its handling of hangups can be controlled with and The shell exits on a hangup (see also the shell variable). By default, the shell's children do too, but the shell does not send them a hangup when it exits. arranges for the shell to send a hangup to a child when it exits, and sets a child to ignore hangups. The shell uses three different sets of terminal modes: used when editing; used when quoting literal characters; and used when executing commands. The shell holds some settings in each mode constant, 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 modified with the builtin. Note that although the editor uses CBREAK mode (or its equivalent), it takes typed- ahead characters anyway. The and commands can be used to manipulate and debug terminal capabilities from the command line. On systems that support SIGWINCH or SIGWINDOW, the shell adapts to window resizing automatically and adjusts the environment variables and if set. If the environment variable contains and fields, the shell adjusts them to reflect the new window size. The next sections of this manual describe all of the available and A synonym for the builtin command. A synonym for the builtin command. Does nothing, successfully. The first form prints the values of all shell variables. The second form assigns the value of to The third form assigns the value of to the 'th component of both and its 'th component must already exist. may contain the operators etc., as in C. If contains or then at least that part of must be placed within and Note that the syntax of has nothing to do with that described under The fourth and fifth forms increment or decrement or its 'th component. The space between and is required. The spaces between and and between and are optional. Components of must be separated by spaces. Without arguments, prints all aliases. With prints the alias for name. With and assigns as the alias of is command and filename substituted. may not be or See also the builtin command. Shows the amount of dynamic memory acquired, broken down into used and free memory. With an argument 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. Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. may be a number, a string, or as described under The first form either lists all bound keys and the editor command to which each is bound, lists a description of the commands, or binds all keys to a specific mode. The second form lists the editor command to which is bound. The third form binds the editor command to Supported options: Lists or changes key-bindings in the alternative key map. This is the key map used in command mode. is interpreted as a control character written (e.g., or (e.g., a meta character written (e.g., a function key written (e.g., or an extended prefix key written (e.g., is interpreted as a builtin or external command instead of an editor command. Binds all keys to the standard bindings for the default editor, as per and Binds all keys to -style bindings. Unsets is interpreted as a symbolic arrow key name, which may be one of or Lists all editor commands and a short description of each. Removes 's binding. Be careful: does bind to it unbinds completely. is taken as a literal string and treated as terminal input when is typed. Bound keys in are themselves reinterpreted, and this continues for ten levels of interpretation. Prints a usage message. Binds all keys to -style bindings. Sets Forces a break from option processing, so the next word is taken as even if it begins with 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 and the entire string is bound to the command. Control characters in can be literal (they can be typed by preceding them with the editor command normally bound to or written caret- character style, e.g., Delete is written (caret-question mark). and can contain backslashed escape sequences (in the style of System V as follows: Bell. Backspace. Escape. Form feed. Newline. Carriage return. Horizontal tab. Vertical tab. The ASCII character corresponding to the octal number nullifies the special meaning of the following character, if it has any, notably and Passes to the BS2000 command interpreter for execution. Only non-interactive commands can be executed, and it is not possible to execute any command that would overlay the image of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only) Causes execution to resume after the of the nearest enclosing or The remaining commands on the current line are executed. Multi-level breaks are thus possible by writing them all on one line. Causes a break from a resuming after the Prints the names of all builtin commands. A synonym for the builtin command. Available only if the shell was so compiled; see the shell variable. A label in a statement as discussed below. If a directory is given, changes the shell's working directory to If not, changes to unless the variable is not set, in which case a is required. If is it is interpreted as the previous working directory (see (+) If is not a subdirectory of the current directory (and does not begin with or each component of the variable is checked to see if it has a subdirectory Finally, if all else fails but is a shell variable whose value begins with or then this is tried to see if it is a directory, and the option is implied. With prints the final directory stack, just like The and flags have the same effect on as on and they imply (+). Using forces a break from option processing so the next word is taken as the directory even if it begins with (+). See also the and shell variables. A synonym for the builtin command. ... (+) Without arguments, lists all completions. With lists completions for With and ..., defines completions. may be a full command name or a glob-pattern (see It can begin with to indicate that completion should be used only when is ambiguous. specifies which word relative to the current word is to be completed, and may be one of the following: Current-word completion. is a glob-pattern which must match the beginning of the current word on the command line. is ignored when completing the current word. Like but includes when completing the current word. Next-word completion. is a glob-pattern which must match the beginning of the previous word on the command line. Like but must match the beginning of the word two before the current word. Position-dependent completion. is a numeric range, with the same syntax used to index shell variables, which must include the current word. the list of possible completions, may be one of the following: Aliases. Bindings (editor commands). Commands (builtin or external commands). External commands which begin with the supplied path prefix. Directories. Directories which begin with the supplied path prefix. Environment variables. Filenames. Filenames which begin with the supplied path prefix. Groupnames. Jobs. Limits. Nothing. Shell variables. Signals. Plain files. Plain files which begin with the supplied path prefix. Any variables. Usernames. Like but prints when is used. Completions. Words from the variable Words from the given list. Words from the output of command. is an optional glob-pattern. If given, words from only that match are considered and the shell variable is ignored. The types and may not have a pattern, and uses as an explanatory message when the editor command is used. 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. invoked from has the additional environment variable set, which contains (as its name indicates) contents of the current (already typed in) command line. One can examine and use contents of the environment variable in a custom script to build more sophisticated completions (see completion for included in this package). Now for some examples. Some commands take only directories as arguments, so there's no point completing plain files. > complete cd 'p/1/d/' completes only the first word following with a directory. -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 position 0, which begin with (thus matching to (the only word in the list). The leading indicates that this completion is to be used with only ambiguous commands. > complete find 'n/-user/u/' is an example of -type completion. Any word following and immediately following is completed from the list of users. > complete cc 'c/-I/d/' demonstrates -type completion. Any word following and beginning with is completed as a directory. is not taken as part of the directory because we used lowercase Different are useful with different commands. > 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 with aliases, with commands, and with shell variables. doesn't have any options, so does nothing when completion is attempted and prints when completion choices are listed. Note that the example, and several other examples below, could just as well have used or as Words can be completed from a variable evaluated at completion time, > complete ftp 'p/1/$hostnames/' > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu) > ftp [^D] rtfm.mit.edu tesla.ee.cornell.edu > ftp [^C] > set hostnames = (rtfm.mit.edu tesla.ee.cornell.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 command does not itself quote its arguments, so the braces, space and in must be quoted explicitly. One command can have multiple completions: > complete dbx 'p/2/(core)/' 'p/*/c/' completes the second argument to with the word and all other arguments with commands. Note that the positional completion is specified before the next-word completion. Because completions 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 pattern is useful when a command takes files with only particular forms as arguments. For example, > complete cc 'p/*/f:*.[cao]/' completes arguments to files ending in only or can also exclude files, using negation of a glob-pattern as described under One might use > complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/' to exclude precious source code from completion. Of course, one could still type excluded names manually or override the completion mechanism using the or editor commands. The and are like and respectively, but they use the argument in a different way: to restrict completion 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 as if it were Note that we used the separator instead of to avoid confusion with the argument, and we used instead of because home directory substitution works at only the beginning of a word. 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 from the list of users, appends an and then completes after the from the 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 or (note the pattern which matches both) to files, words following or to commands, words following and to users and groups respectively and words following or to members of the given lists. It also completes the switches themselves from the given list (note the use of -type completion) and completes anything not otherwise completed to a directory. Whew. Remember that programmed completions are ignored if the word being completed is a tilde substitution (beginning with or a variable (beginning with See also the builtin command. Continues execution of the nearest enclosing or The rest of the commands on the current line are executed. Labels the default case in a statement. It should come after all labels. (+) (+) 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 or in the output is expanded explicitly to or the pathname of the home directory for user (+) With entries are wrapped before they reach the edge of the screen. (+) With entries are printed one per line, preceded by their stack positions. (+) If more than one of or is given, takes precedence. is accepted but does nothing. The second form with saves the directory stack to as a series of and commands. The second form with sources which is presumably a directory stack file saved by the option or the mechanism. In either case, is used if is not given and is used if is unset. Note that login shells do the equivalent of on startup and, if is set, before exiting. Because only is normally sourced before should be set in rather than The third form clears the directory stack. Writes each to the shell's standard output, separated by spaces and terminated with a newline. The shell variable may be set to emulate (or not) the flags and escape sequences of the BSD and/or System V versions of see and Exercises the terminal capabilities (see in For example, sends the cursor to the home position, sends it to column 3 and row 10, and prints in the status line. If is or prints the value of that capability or 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 capability 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 nonexistent capabilities return the empty string rather than causing an error. With messages are verbose. See the description of the and statements below. 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 command or variable substitution, because parsing occurs before these substitutions. See for a sample use of Executes the specified in place of the current shell. The shell exits either with the value of the specified (an expression, as described under or, without with the value 0. Brings the specified jobs (or, without arguments, the current job) into the foreground, continuing each if it is stopped. may be a number, a string, or as described under See also the editor command. Applies (which is a file inquiry operator as described under to each and returns the results as a space-separated list. Successively sets the variable to each member of and executes the sequence of commands between this command and the matching (Both and must appear alone on separate lines.) The builtin command may be used to continue the loop prematurely and the builtin command to terminate it prematurely. When this command is read from the terminal, the loop is read once prompting with (or 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. Prints the system execution path. (TCF only) Prints the experimental version prefix. (TCF only) Like but the parameter is not recognized and words are delimited by null characters in the output. Useful for programs which wish to use the shell to filename expand a list of words. is filename and command-substituted to yield a string of the form The shell rewinds its input as much as possible, searches for a line of the form possibly preceded by blanks or tabs, and continues execution after that line. Prints a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding 's). An is attempted for each component of the where the hash function indicates a possible hit, and in each component which does not begin with a On machines without prints only the number and size of hash buckets. (+) (+) The first form prints the history event list. If is given only the most recent events are printed or saved. With the history list is printed without leading numbers. If is specified, timestamps are printed also in comment form. This can be used to produce files suitable for loading with or With the order of printing is most recent first rather than oldest first. The second form with saves the history list to If the first word of the shell variable is set to a number, at most that many lines are saved. If the second word of is set to 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. If the second word of is and the third word is set to the history file update will be serialized with other shell sessions that would possibly like to merge history at exactly the same time. The second form with appends (which is presumably a history list saved by the option or the mechanism) to the history list. is like but the contents of are merged into the history list and sorted by timestamp. In either case, is used if is not given and is used if is unset. Note that is exactly like except that it does not require a filename. Note that login shells do the equivalent of on startup and, if is set, before exiting. Because only is normally sourced before should be set in rather than If is set, the first and second forms print and save the literal (unexpanded) form of the history list. The third form clears the history list. With runs 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 Without an argument, causes the non-interactive shell only to exit on a hangup for the remainder of the script. See also and the builtin command. If (an expression, as described under evaluates true, then is executed. Variable substitution on happens early, at the same time it does for the rest of the command. must be a simple command, not an alias, a pipeline, a command list or a parenthesized command list, but it may have arguments. Input/output redirection occurs even if is false and is thus executed; this is a bug. If the specified is true then the commands to the first are executed; otherwise if is true then the commands to the second are executed, etc. Any number of pairs are possible; only one is needed. The part is likewise optional. (The words and must appear at the beginning of input lines; the must appear alone on its input line or after an Adds each to the current environment. There is no way to remove a shared library. (Domain/OS only) The first form lists the active jobs. With lists process IDs in addition to the normal information. On TCF systems, prints the site on which each job is executing. The second form with the option sets the process title to using where available. If no is provided, the process title will be cleared. The first form lists the signal names. The second form sends the specified (or, if none is given, the TERM (terminate) signal) to the specified jobs or processes. may be a number, a string, or as described under Signals are either given by number or by name (as given in stripped of the prefix There is no default entering just does not send a signal to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process is sent a CONT (continue) signal as well. Limits the consumption by the current process and each process it creates to not individually exceed on the specified If no is given, then the current limit for is printed. If no is given, then all limitations are given. If the flag is given, the hard limits are used instead of the current limits. The hard limits impose a ceiling on the values 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 types currently include (if supported by the OS): Maximum number of threads for this process. Size of the largest core dump that will be created. Maximum number of cpu-seconds to be used by each process. Maximum growth of the data+stack region via beyond the end of the program text. Maximum number of open files for this process. Largest single file which can be created. Maximum amount of memory a process may allocate per system call. Maximum number of kqueues allocated for this process. Maximum number of locks for this user. Maximum number of bytes in POSIX mqueues for this user. Maximum nice priority the user is allowed to raise mapped from [19...-20] to [0...39] for this user. Maximum number of simultaneous processes for this user id. Maximum realtime priority for this user. Timeout for RT tasks in microseconds for this user. Maximum number of pending signals for this user. Maximum number of simultaneous threads (lightweight processes) for this user id. Maximum size which a process may lock into memory using Maximum amount of physical memory a process may have allocated to it at a given time. Maximum number of POSIX advisory locks for this user. Maximum number of pseudo-terminals for this user. Maximum size of socket buffer usage for this user. Maximum size of the automatically-extended stack region. Maximum amount of swap space reserved or used for this user. Maximum number of threads for this process. Maximum amount of virtual memory a process may have allocated to it at a given time (address space). may be given as a (floating point or integer) number followed by a scale factor. For all limits other than the default scale is or (1024 bytes); a scale factor of or (1048576 bytes) or or (1073741824 bytes) may also be used. For the default scaling is while for minutes or for hours, or a time of the form giving minutes and seconds may be used. If is then the limitation on the specified is removed (this is equivalent to the builtin command). For both names and scale factors, unambiguous prefixes of the names suffice. Prints the shell variable and reports on each user indicated in who is logged in, regardless of when they last logged in. See also Terminates a login shell, replacing it with an instance of This is one way to log off, included for compatibility with Terminates a login shell. Especially useful if is set. (+) Lists files like but much faster. identifies each type of special file in the listing with a special character suffix: 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 dependent (HP/UX only). Network special (HP/UX only). If the shell variable is set, symbolic links are identified in more detail (on only systems that have them, of course): Symbolic link to a non-directory. Symbolic link to a directory. Orphaned (broken) symbolic link. also slows down and causes partitions holding files pointed to by symbolic links to be mounted. If the shell variable is set to or or any combination thereof (e.g., they are used as flags to making it act like ls -xF ls -Fa ls -FA or a combination, for example On machines where is not the default, acts like unless contains an in which case it acts like passes its arguments to if it is given any switches, so generally does the right thing. The builtin can list files using different colors depending on the file type or extension. See the shell variable and the and environment variables. The first form migrates the process or job to the site specified or the default site determined by the system path. (TCF only) The second form is equivalent to in that it migrates the current process to the specified site. Migrating the shell itself can cause unexpected behavior, because the shell does not like to lose its tty. (TCF only) Equivalent to as per Available only if the shell was so compiled; see the shell variable. Increments the scheduling priority for the shell by or, without by 4. With runs at the appropriate priority. The greater the the less cpu the process gets. The super-user may decrement the priority by using is always executed in a sub-shell, and the restrictions placed on commands in simple statements apply. With runs such that it will ignore hangup signals. Note that commands may set their own response to hangups, overriding Without an argument, causes the non-interactive shell only to ignore hangups for the remainder of the script. See also and the builtin command. Causes the shell to notify the user asynchronously when the status of any of the specified jobs (or, without the current job) changes, instead of waiting until the next prompt as is usual. may be a number, a string, or as described under See also the shell variable. 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 causes the shell to execute a when an interrupt is received or a child process terminates because it was interrupted. is ignored if the shell is running detached and in system startup files (see where interrupts are disabled anyway. Without arguments, pops the directory stack and returns to the new top directory. With a number discards the th entry in the stack. Finally, all forms of print the final directory stack, just like The shell variable can be set to prevent this and the flag can be given to override The and flags have the same effect on as on (+) Prints the names and values of all environment variables or, with the value of the environment variable Without arguments, exchanges the top two elements of the directory stack. If is set, without arguments acts as like (+) With pushes the current working directory onto the directory stack and changes to If is it is interpreted as the previous working directory (see (+) If is set, removes any instances of from the stack before pushing it onto the stack. (+) With a number rotates the th element of the directory stack around to be the top element and changes to it. If is set, however, extracts the th directory, pushes it onto the top of the stack and changes to it. (+) Finally, all forms of print the final directory stack, just like The shell variable can be set to prevent this and the flag can be given to override The and flags have the same effect on as on (+) Causes the internal hash table of the contents of the directories in the variable to be recomputed. This is needed if the shell variable is not set and new commands are added to directories in while you are logged in. With a new command will be found automatically, except in the special case where another command of the same name which is located in a different directory already exists in the hash table. Also flushes the cache of home directories built by tilde expansion. The specified which is subject to the same restrictions as the in the one line statement above, is executed times. I/O redirections occur exactly once, even if is 0. Changes the rootnode to so that will be interpreted as (Domain/OS only) (+) The first form prints the scheduled-event list. The shell variable may be set to define the format in which the scheduled-event list is printed. The second form adds to the scheduled-event list. For example, > sched 11:00 echo It\'s eleven o\'clock. causes the shell to echo 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 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 possible 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 immediately. 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 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 runs directly from the shell, it has access to shell variables and other structures. This provides a mechanism for changing one's working environment based on the time of day. (+) 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 to the null string. The third form sets to the single The fourth form sets to the list of words in In all cases the value is command and filename expanded. If is specified, the value is set read-only. If or are specified, set only unique words keeping their order. prefers the first occurrence of a word, and the last. The fifth form sets the 'th component of to this component must already exist. The sixth form lists only the names of all shell variables that are read-only. The seventh form makes read-only, whether or not it has a value. The eighth form is the same as the third form, but make read-only at the same time. These arguments can be repeated to set and/or make read-only multiple variables in a single set command. Note, however, that variable expansion happens for all arguments before any setting occurs. Note also that can be adjacent to both and or separated from both by whitespace, but cannot be adjacent to only one or the other. See also the builtin command. Without arguments, prints the names and values of all environment variables. With sets the environment variable to or, without to the null string. Equivalent to (Mach only) Sets the system execution path. (TCF only) Tells the shell to believe that the terminal capability (as defined in has the value No sanity checking is done. Concept terminal users may have to to get proper wrapping at the rightmost column. (+) Controls which tty modes (see the shell does not allow to change. or tells to act on the or set of tty modes respectively; without or is used. Without other arguments, lists the modes in the chosen set which are fixed on or off The available modes, and thus the display, vary from system to system. With lists all tty modes in the chosen set whether or not they are fixed. With or fixes on or off or removes control from in the chosen set. For example, fixes mode on and allows commands to turn mode on or off, both when the shell is executing commands. Set the experimental version prefix to or removes it if is omitted. (TCF only) Without arguments, discards and shifts the members of to the left. It is an error for not to be set or to have fewer than one word as value. With performs the same function on The shell reads and executes commands from The commands are not placed on the history list. If any are given, they are placed in (+) commands may be nested; if they are nested too deeply the shell may run out of file descriptors. An error in a at any level terminates all nested commands. With commands are placed on the history list instead of being executed, much like Stops the specified jobs or processes which are executing in the background. may be a number, a string, or as described under There is no default entering just does not stop the current job. Causes the shell to stop in its tracks, much as if it had been sent a stop signal with This is most often used to stop shells started by Each case label is successively matched, against the specified 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 label is found, then the execution begins after the label. Each case label and the label must appear at the beginning of a line. The command causes execution to continue after the 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 Lists the values of all terminal capabilities (see Tests if (or the current value of if no is given) has an entry in the hosts or database. Prints the terminal type to stdout and returns 0 if an entry is present otherwise returns 1. Executes (which must be a simple command, not an alias, a pipeline, a command list or a parenthesized command list) and prints a time summary as described under the variable. If necessary, an extra shell is created to print the time statistic when the command completes. Without prints a time summary for the current shell and its children. Sets the file creation mask to 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 prints the current file creation mask. Removes all aliases whose names match Thus removes all aliases. It is not an error for nothing to be ed. Removes all completions whose names match Thus removes all completions. It is not an error for nothing to be d. Disables use of the internal hash table to speed location of executed programs. Sets the universe to (Masscomp/RTU only) Removes the limitation on or, if no is specified, all limitations. With the corresponding hard limits are removed. Only the super-user may do this. Note that may not exit successful, since most systems do not allow to be unlimited. With errors are ignored. Removes all variables whose names match unless they are read-only. Thus removes all variables unless they are read-only; this is a bad idea. It is not an error for nothing to be Removes all environment variables whose names match Thus removes all environment variables; this is a bad idea. It is not an error for nothing to be ed. Without arguments, prints With sets to With and executes under may be or (Domain/OS only) 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. Sets the universe to (Convex/OS only) An alternate name for the builtin command. Available only if the shell was so compiled; see the shell variable. Reports all known instances of including aliases, builtins and executables in Displays the command that will be executed by the shell after substitutions, searching, etc. The builtin command is just like but it correctly reports aliases and builtins and is 10 to 100 times faster. See also the editor command. Executes the commands between the and the matching while (an expression, as described under evaluates non- zero. and must appear alone on their input lines. and may be used to terminate or continue the loop prematurely. If the input is a terminal, the user is prompted the first time through the loop as with If set, each of these aliases executes automatically at the indicated time. They are all initially undefined. Supported special aliases are: Runs when the shell wants to ring the terminal bell. Runs after every change of working directory. For example, if the user is working on an X window system using and a re-parenting window manager that supports title bars such as and does > alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"' then the shell will change the title of the running to be the name of the host, a 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 or in may cause an infinite loop. It is the author's opinion that anyone doing so will get what they deserve. Runs before each command gets executed, or when the command changes state. This is similar to but it does not print builtins. > alias jobcmd 'echo -n "^[]2\;\!#:q^G"' then executing will put the command string in the xterm title bar. Invoked by the editor command. The command 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 various calling conventions (e.g., the customary Unix except by using a table of many commands. Runs every minutes. This provides a convenient means for checking on common but infrequent changes such as new mail. For example, if one does > set tperiod = 30 > alias periodic checknews then the program runs every 30 minutes. If is set but is unset or set to 0, behaves like Runs just before each prompt is printed. For example, if one does > alias precmd date then runs just before the shell prompts for each command. There are no limits on what can be set to do, but discretion should be used. Runs before each command gets executed. > alias postcmd 'echo -n "^[]2\;\!#:q^G"' then executing will put the command string in the xterm title bar. 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., or The variables described in this section have special meaning to the shell. The shell sets and at startup; they do not change thereafter unless changed by the user. The shell updates and when necessary, and sets on logout. The shell synchronizes and 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 and have identical meanings, they are not synchronized in this manner, and that the shell automatically converts between the different formats of and Supported special shell variables are: 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. If set, 's autolock feature uses its value instead of the local username for kerberos authentication. If set, all times are shown in 12-hour AM/PM format. This variable selects what is propagated to the value of the variable. For more information see the description of the variable below. The arguments to the shell. Positional parameters are taken from i.e., is replaced by etc. Set by default, but usually empty in interactive shells. If set, the editor command is invoked automatically before each completion attempt. If set, the editor command is invoked automatically before each completion attempt. If this is set to then only history will be expanded and a second completion will expand filenames. If set, possibilities are listed after an ambiguous completion. If set to possibilities are listed only when no new characters are added by completion. The first word is the number of minutes of inactivity before automatic logout. The optional second word is the number of minutes of inactivity before automatic locking. When the shell automatically logs out, it prints sets the variable to and exits. When the shell automatically locks, the user is required to enter their password to continue working. Five incorrect attempts result in automatic logout. Set to (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 environment variable is set), the tty is a pseudo-tty (pty) or the shell was not so compiled (see the shell variable). Unset or set it to to disable automatic logout. See also the and shell variables. If set, the internal hash table of the contents of the directories in the variable will be recomputed if a command is not found in the hash table. In addition, the list of available commands will be rebuilt for each command completion or spelling correction attempt if set to or respectively; if set to this will be done for both cases. If set, backslashes (`\') always quote and This may make complex quoting tasks easier, but it can cause syntax errors in scripts. The file name of the message catalog. If set, uses as a message catalog instead of default A list of directories in which should search for subdirectories if they aren't found in the current directory. If not set, requires a directory and will not go to the directory if it's omitted. This is set by default. If set, it enables color display for the builtin and it passes to (or if is set). Alternatively, it can be set to only or only to enable color for a specific command. Setting it to nothing is equivalent to setting it to Color is disabled if the output is not directed to a terminal, unless is set. If set, it enables color escape sequence for NLS message files, and display colorful NLS messages. If set, the command which was passed to the shell with the flag. If set, the shell will evaluate expressions right to left, like the original If set to the completion becomes case insensitive. If set to completion ignores case and considers hyphens and underscores to be equivalent; it will also treat periods, hyphens and underscores and as word separators. If set to completion matches uppercase and underscore characters explicitly and matches lowercase and hyphens in a case- insensitive manner; it will treat periods, hyphens and underscores as word separators. If set to a list of commands, the shell will continue the listed commands, instead of starting a new one. Same as continue, but the shell will execute: echo `pwd` $argv > ~/.<cmd>_pause; %<cmd> If set to commands are automatically spelling-corrected. If set to commands are automatically completed. If set to the entire command line is corrected. If set, newlines and carriage returns in command substitution are replaced by spaces. Set by default. The full pathname of the current directory. See also the and shell variables. If set, extracts the th directory from the directory stack rather than rotating it to the top. The default location in which and look for a history file. If unset, is used. Because only is normally sourced before should be set in rather than An array of all the directories on the directory stack. is the current working directory, the first directory on the stack, etc. Note that the current working directory is but in directory stack substitutions, etc. One can change the stack arbitrarily by setting but the first element (the current working directory) is always correct. See also the and shell variables. Has an effect only if is listed as part of the shell variable. If set to it enables display and editing EUC-kanji(Japanese) code. If set to it enables display and editing Shift-JIS(Japanese) code. If set to it enables display and editing Big5(Chinese) code. If set to it enables display and editing Utf8(Unicode) code. If set to 256 characters in the following format, it enables display and editing of original multi-byte code format: Each character in the 256 character value corresponds (from left to right) to the ASCII codes 0x00, 0x01, 0x02, ..., 0xfd, 0xfe, 0xff at the same index. Each character is set to number 0, 1, 2 or 3, with the meaning: Not used for multi-byte characters. Used for the first byte of a multi-byte character. Used for the second byte of a multi-byte character. Used for both the first byte and second byte of a multi-byte character. For example, if set to 256 characters starting with the value is interpreted as: The GNU coreutils version of cannot display multi-byte filenames without the option. If you are using this version, set the second word of dspmbyte to If not, for example, cannot display multi-byte filenames. Note that this variable can only be used if KANJI and DSPMBYTE has been defined at compile time. If set, removes any instances of from the stack before pushing it onto the stack. If set, each command with its arguments is echoed just before it is executed. For non-builtin commands all expansions occur before echoing. Builtin commands are echoed before command and filename substitution, because these substitutions are then done selectively. Set by the command line option. The style of the builtin. May be set to: Don't echo a newline if the first argument is the default for Recognize backslashed escape sequences in echo strings. Recognize both the flag and backslashed escape sequences; the default for Recognize neither. Set by default to the local system default. The BSD and System V options are described in the man pages on the appropriate systems. If set, the command-line editor is used. Set by default in interactive shells. A list of command names for the editor command to match. If not set, the if unset) and if unset) environment variables will be used instead. If set, the and prompt sequences (see the shell variable) indicate skipped directories with an ellipsis instead of The user's effective user ID. The first matching passwd entry name corresponding to the effective user ID. Lists file name suffixes to be ignored by completion. In completion is always used and this variable is ignored by default. If is unset, then the traditional completion is used. If set in filename completion is used. The user's real group ID. If set, wild-card glob patterns will match files and directories beginning with except for and If set, the and file glob patterns will match any string of characters including traversing any existing sub-directories. For example, will list all the .c files in the current directory tree. If used by itself, it will match zero or more sub-directories. For example, will list any file named in the directory tree; whereas will match any file in the directory tree ending in To prevent problems with recursion, the glob-pattern will not descend into a symbolic link containing a directory. To override this, use The user's group name. If set, the incremental search match (in and and the region between the mark and the cursor are highlighted in reverse video. Highlighting requires more frequent terminal writes, which introduces extra overhead. If you care about terminal performance, you may want to leave this unset. A string value determining the characters used in 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. Controls handling of duplicate entries in the history list. If set to only unique history events are entered in the history list. If set to 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 and the same event is found in the history list, that old event gets erased and the current one gets inserted. Note that the and options renumber history events so there are no gaps. The default location in which and look for a history file. If unset, is used. is useful when sharing the same home directory between different machines, or when saving separate histories on different terminals. Because only is normally sourced before should be set in rather than If set, builtin and editor commands and the mechanism use the literal (unexpanded) form of lines in the history list. See also the editor command. 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, is used. The format sequences are described below under note the variable meaning of Set to by default. Initialized to the home directory of the invoker. The filename expansion of refers to this variable. If set to the empty string or and the input device is a terminal, the command (usually generated by the user by typing on an empty line) causes the shell to print instead of exiting. This prevents the shell from accidentally being killed. Historically this setting exited after 26 successive EOF's to avoid infinite loops. If set to a number the shell ignores - 1 consecutive s and exits on the th (+). If unset, is used, i.e., the shell exits on a single 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 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. If set to or puts the editor into that input mode at the beginning of each line. Controls handling of duplicate entries in the kill ring. If set to only unique strings are entered in the kill ring. If set to and the last killed string is the same as the current killed string, then the current string is not entered in the ring. If set to and the same string is found in the kill ring, the old string is erased and the current one is inserted. Indicates the number of killed strings to keep in memory. Set to by default. If unset or set to less than the shell will only keep the most recently killed string. Strings are put in the killring by the editor commands that delete (kill) strings of text, e.g. etc, as well as the command. The editor command will yank the most recently killed string into the command-line, while (see can be used to yank earlier killed strings. If set to or or any combination thereof (e.g., they are used as flags to making it act like ls -xF ls -Fa ls -FA or a combination, for example If the first word contains shows all files (even if they start with a If the first word contains shows all files but and If the first word contains sorts across instead of down. If the second word of is set, it is used as the path to If set, all jobs are listed when a job is suspended. If set to the listing is in long format. If set, the builtin command shows the type of file to which each symbolic link points. The maximum number of items which the editor command will list without asking first. The maximum number of rows of items which the editor command will list without asking first. Set by the shell if it is a login shell. Setting or unsetting it within a shell has no effect. See also Set by the shell to before a normal logout, before an automatic logout, and if the shell was killed by a hangup signal (see See also the shell variable. A list of files and directories to check for incoming mail, optionally preceded by a numeric word. Before each prompt, if 10 minutes have passed since the last check, the shell checks each file and displays (or, if contains multiple files, 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 redundant notifications. Most login programs will tell you whether or not you have mail when you log in. If a file specified in is a directory, the shell will count each file within that directory as a separate message, and will report or as appropriate. 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 is numeric it is taken as a different mail checking interval, in seconds. Under very rare circumstances, the shell may report instead of If set to completion never beeps. If set to it beeps only when there is no match. If set to it beeps when there are multiple matches. If set to it beeps when there is one exact and other longer matches. If unset, is used. If set, beeping is completely disabled. See also If set, restrictions are placed on output redirection to insure that files are not accidentally destroyed and that redirections refer to existing files, as described in the section. If contains an interacive confirmation is presented, rather than an error. If contains is allowed on empty files. If set, disable the printing of in the time specifiers at the change of hour. If set, and 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. If set and the shell supports Kanji (see the shell variable), it is disabled so that the meta key can be used. If set, a or which does not match any existing files is left untouched rather than causing an error. It is still an error for the substitution to be malformed. For example, still gives an error. A list of directories (or glob-patterns which match directories; see that should not be during a completion operation. This is usually used to exclude directories which take too much time to for example If set, the shell announces job completions asynchronously. The default is to present job completions just before printing a prompt. The user's real organization ID. (Domain/OS only) The old working directory, equivalent to the used by and See also the and shell variables. If set, enable the printing of padding '0' for hours, in 24 and 12 hour formats. E.g., versus To retain compatibily with older versions numeric variables starting with 0 are not interpreted as octal. Setting this variable enables proper octal parsing. A list of directories in which to look for executable commands. A null word specifies the current directory. If there is no variable then only full path names will execute. is set by the shell at startup from the environment variable or, if does not exist, to a system-dependent default, such as The shell may put first or last in or omit it entirely depending on how it was compiled; see the shell variable. A shell which is given neither the nor the option hashes the contents of the directories in after reading and each time is reset. If one adds a new command to a directory in while the shell is active, one may need to do a for the shell to find it. If set and an interactive program exits with a non-zero status, the shell prints The string which is printed before reading each command from the terminal. 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 as per substitution happens only if the shell has already used in a pathname in the current session. The trailing component of the current working directory, or trailing components if a digit is given. If begins with the number of skipped components precede the trailing component(s) in the format If the shell variable is set, skipped components are represented by an ellipsis so the whole becomes substitution is done as in above, but the component is ignored when counting trailing components. Like but without substitution. The current history event number. The full hostname. The hostname up to the first Start (stop) standout mode. Start (stop) boldfacing mode. Start (stop) underline mode. The time of day in 12-hour AM/PM format. Like but in 24-hour format (but see the shell variable). The time of day in 12-hour AM/PM format, with seconds. Like but in 24-hour format (but see the shell variable). is parsed as in is parsed as in A single The user name. The effective user name. The number of jobs. The weekday in format. The day in format. The month in format. The month in format. The year in format. The year in format. The shell's tty. 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 shell variable) for normal users, (or the second character of for the superuser. Includes 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 The return code of the command executed just before the prompt. In the status of the parser. In the corrected string. In the history string. and are available in only eight-bit-clean shells; see the shell variable. The bold, standout and underline sequences are often used to distinguish a superuser shell. For example, If or is used, and is not set, then print on the change of hour (i.e, minutes) instead of the actual time. Set by default to in interactive shells. The string with which to prompt in and loops and after lines ending in The same format sequences may be used as in note the variable meaning of Set by default to in interactive shells. The string with which to prompt when confirming automatic spelling correction. The same format sequences may be used as in note the variable meaning of Set by default to in interactive shells. If set (to a two-character string), the formatting sequence in the shell variable is replaced with the first character for normal users and the second character for the superuser. If set, without arguments does like If set, and do not print the directory stack. If set, completion completes on an exact match even if a longer match is possible. If set, command listing displays only files in the path that are executable. Slow. If set, the user is prompted before is executed. 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 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 isn't set, then will be printed after the prompt and before the command input. If set, the shell does before exiting. If the first word is set to a number, at most that many directory stack entries are saved. If set, the shell does before exiting. If the first word is set to a number, at most that many lines are saved. (The number should be less than or equal to the number entries; if it is set to greater than the number of settings, only entries will be saved.) If the second word is set to the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp and the most recent events are retained. If the second word is set to and the third word is set to the history file update will be serialized with other shell sessions that would possibly like to merge history at exactly the same time. (+) The format in which the builtin command prints scheduled events; if not given, is used. The format sequences are described above under note the variable meaning of 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 Initialized to the (system-dependent) home of the shell. The number of nested shells. Reset to 1 in login shells. See also The exit status from the last command or backquote expansion, or any command in a pipeline is propagated to (This is also the default behavior.) This default does not match what POSIX mandates (to return the status of the last command only). To match the POSIX behavior, you need to unset If the variable is unset, the exit status of a pipeline is determined only from the last command in the pipeline, and the exit status of a backquote expansion is propagated to If a command terminated abnormally, then 0200 is added to the status. Builtin commands which fail return exit status all other builtin commands return status Can be set to several different values to control symbolic link resolution: If set to 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 the shell tries to construct a current directory relative to the current directory before the link was crossed. This means that through a symbolic link and then returns one to the original directory. This affects only builtin commands and filename completion. If set to the shell tries to fix symbolic 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 misleading and sometimes confusing when it fails to recognize an argument which should be expanded. A compromise is to use and use the editor command (bound by default to 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/dst Here's the behavior with unset, > cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/from Here's the behavior with set to > cd /tmp/to/dst; echo $cwd /tmp/from/src > cd ..; echo $cwd /tmp/from Here's the behavior with set to > cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to Here's the behavior with set to > cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to > cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ".."; echo $cwd /tmp/from > /bin/echo .. /tmp/to > /bin/echo ".." .. Note that expansion: Works just like for builtins like Is prevented by quoting. Happens before filenames are passed to non- builtin commands. The version number of the shell in the format where is the major release number, the current version, and the patchlevel. The terminal type. Usually set in as described under If set to a number, then the builtin 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 builtin. (u) The following sequences may be used in the format string: The time the process spent in user mode in cpu seconds. The time the process spent in kernel mode in cpu seconds. The elapsed (wall clock) time in seconds. The CPU percentage computed as (%U + %S) / %E. Number of times the process was swapped. The average amount in (shared) text space used in Kbytes. The average amount in (unshared) data/stack space used in Kbytes. The total space used (%X + %D) in Kbytes. The maximum memory the process had in use at any time in Kbytes. The number of major page faults (page needed to be brought from disk). The number of minor page faults. The number of input operations. The number of output operations. The number of socket messages received. The number of socket messages sent. The number of signals received. The number of voluntary context switches (waits). 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 for systems that support resource usage reporting and for systems that do not. Under Sequent's DYNIX/ptx, and are not available, but the following additional sequences are: The number of system calls performed. The number of pages which are zero-filled on demand. The number of times a process's resident set size was increased by the kernel. The number of times a process's resident set size was decreased by the kernel. The number of read system calls performed. The number of write system calls performed. The number of reads from raw disk devices. The number of writes to raw disk devices. and the default time format is Note that the CPU percentage can be higher than 100% on multi-processors. The period, in minutes, between executions of the special alias. The name of the tty, or empty if not attached to one. The user's real user ID. The user's login name. If set, causes the words of each command to be printed, after history substitution (if any). Set by the command line option. The version ID stamp. It contains the shell's version number (see origin, release date, vendor, operating system and machine (see and and a comma-separated list of options which were set at compile time. Options which are set by default in the distribution are noted. Supported options include: The shell is eight bit clean; default. The shell is not eight bit clean. The shell is multi-byte encoding clean (like UTF-8). The system's NLS is used; default for systems with NLS. Login shells execute before instead of after and before instead of after and is put last in for security; default. is omitted from for security. -style editing is the default rather than -style. Login shells drop DTR when exiting. is a synonym for and is an alternate name for is enabled; default. Kanji is used if appropriate according to locale settings, unless the shell variable is set. The system's is used. The convention is emulated when executing shell scripts. The builtin is available. The shell attempts to set the environment variable. The shell verifies your password with the kerberos server if local authentication fails. The shell variable or the environment variable override your local username if set. An administrator may enter additional strings to indicate differences in the local version. If unset, various key bindings change behavior to be more -style: word boundaries are determined by versus other characters. If set, various key bindings change behavior to be more -style: word boundaries are determined by versus whitespace versus other characters; cursor behavior depends upon current vi mode (command, delete, insert, replace). This variable is unset by and set by may be explicitly set or unset by the user after those operations if required. If set, a screen flash is used rather than the audible bell. See also A list of user/terminal pairs to watch for logins and logouts. If either the user is all terminals are watched for the given user and vice versa. Setting to watches all users and terminals. For example, set watch = (george ttyd1 any console $user any) reports activity of the user on any user on the console, and oneself (or a trespasser) on any terminal. Logins and logouts are checked every 10 minutes by default, but the first word of 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 builtin command triggers a report at any time. All current logins are reported (as with the builtin) when is first set. The shell variable controls the format of reports. The format string for messages. The following sequences are replaced by the given information: The name of the user who logged in/out. The observed action, i.e., or The terminal (tty) on which the user logged in/out. The full hostname of the remote host, or if the login/logout was from the local host. 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. and are available on only systems that store the remote hostname in If unset, is used, or on systems which don't store the remote hostname. A list of non-alphanumeric characters to be considered part of a word by the etc., editor commands. If unset, the default value is determined based on the state of if is unset, is used as the default; if is set, is used as the default. Equivalent to the shell variable. Color sequences for are normally disabled if the output is not directed to a terminal. This can be overridden by setting this variable, which also changes the invocation of to use instead of Note that must be set for this environment variable to be effective; by itself does not enable color Set by to the current command line when invoking programs for the mode See in The number of columns in the terminal. See Used by X Window System (see If set, the shell does not set The pathname to a default editor. Used by the editor command if the the shell variable is unset. See also the environment variable. Equivalent to the shell variable. Equivalent to the shell variable. Initialized to the name of the machine on which the shell is running, as determined by the system call. 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. A list of directories in which the editor command looks for command documentation. Gives the preferred character environment. See If set, only ctype character handling is changed. See The number of lines in the terminal. See One of two environment variables that may be used to define the per- file colors used by (along with This variable is used by some BSD versions of On startup, takes priority over If both or are the most recent is used. If is while is still then is parsed again (with any warnings suppressed) to reapply its settings. This variable is a 22 character string containing a concatenation of 11 pairs of the format where is the foreground color and is the background color. If fewer than 11 pairs are provided, default colors are used for the remaining entries. If more than 11 pairs are provided, the extra values are ignored. The order of the color attribute pairs to the equivalent variable, the file type, and default color, is as follows: The color code designators are as follows: Black. Red. Green. Yellow (or brown). Blue. Magenta. Cyan. Light grey. Bold black, usually shows up as dark grey. Bold red. Bold green. Bold yellow. Bold blue. Bold magenta. Bold cyan. Bold light grey; looks like bright white. Default foreground or background. Note that the above are standard ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use. The default colors are as per the color variables in and are not the same default colors as those used by some BSD versions of One of two environment variables that may be used to define the per-file colors used by (along with This variable is used by the GNU coreutils version of and may be setup by On startup, takes priority over If both or are the most recent is used. If is while is still then is parsed again (with any warnings suppressed) to reapply its settings. The format of this variable is reminiscent of the file format; a list of expressions of the form or The first form where is a two-character variable name, supports the following variables, their associated default ISO 6429 color code or escape sequences, and file type: You need to include only the variables you want to change from the default. The second form colorizes file names based on extension. For example, using ISO 6429 codes, to color all C-language source files blue you would specify This would color all files ending in in blue foreground (34) color. Control characters can be written either in C-style-escaped notation, or in stty-like ^-notation. 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 filename will be output to the terminal as If the code is undefined, the sequence will be used instead. This is generally more convenient to use, but less general. The left code right code and end codes are provided so you don't have to type common 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 codes but a different system. If your terminal uses ISO 6429 color codes, you can compose the type codes (i.e., all except the and codes) from numerical ISO 6429 color codes separated by For example, is bright green foreground with default background. The most common ISO 6429 color codes are: To restore default color. Bold / brighter colors. Underlined text. Flashing text. Black foreground. Red foreground. Green foreground. Yellow (or brown) foreground. Blue foreground. Magenta foreground. Cyan foreground. White (or gray) foreground. Black background. Red background. Green background. Yellow (or brown) background. Blue background. Magenta background. Cyan background. White (or gray) background. Not all ISO 6429 color codes will work on all systems or display devices. A few terminal programs do not recognize the default end code properly. If all text gets colorized after you do a directory listing, try changing the and codes from 0 to the numerical codes for your standard foreground and background colors. For symbolic links the keyword can be set to which makes the file color the same as the color of the link target. The machine type (microprocessor class or machine model), as determined at compile time. If set, printable characters are not rebound to See The operating system, as determined at compile time. A list of directories in which to look for executables. Equivalent to the shell variable, but in a different format. Equivalent to the shell variable, but not synchronized to it; updated only after an actual directory change. 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 shell variable. Equivalent to the shell variable. The current system type. (Domain/OS only) Equivalent to the shell variable. The terminal capability string. See Equivalent to the shell variable. The vendor, as determined at compile time. The pathname to a default full- screen editor. Used by the editor command if the the shell variable is unset. See also the environment variable. Read first by every shell. ConvexOS, Stellix and Intel use NeXTs use A/UX, AMIX, Cray and IRIX have no equivalent in but read this file in anyway. Solaris 2.x does not have it either, but reads (+) Read by login shells after ConvexOS, Stellix and Intel use NeXTs use Solaris 2.x uses A/UX, AMIX, Cray and IRIX use Read by every shell after or its equivalent. Read by every shell, if doesn't exist, after or its equivalent. This manual uses to mean or, if is not found, Read by login shells after if is set, but see also Read by login shells after or The shell may be compiled to read before instead of after and see the shell variable. Read by login shells after if is set, but see also Read by login shells at logout. ConvexOS, Stellix and Intel use NeXTs use A/UX, AMIX, Cray and IRIX have no equivalent in but read this file in anyway. Solaris 2.x does not have it either, but reads (+) Read by login shells at logout after or its equivalent. Used to interpret shell scripts not starting with a Temporary file for Source of home directories for substitutions. The order in which startup files are read may differ if the shell was so compiled; see and the shell variable. This manual describes as a single entity, but experienced users will want to pay special attention to 's new features. A command-line editor, which supports -style or -style key bindings. See and Programmable, interactive word completion and listing. See and the and builtin commands. of filenames, commands and variables. which perform other useful functions in the middle of typed commands, including documentation lookup quick editor restarting and command resolution An enhanced history mechanism. Events in the history list are time-stamped. See also the command and its associated shell variables, the previously undocumented event specifier and new modifiers under the and editor commands and the shell variable. Enhanced directory parsing and directory stack handling. See the and commands and their associated shell variables, the description of the and shell variables and the and editor commands. Negation in glob-patterns. See New and a builtin which uses them. A variety of 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 OS variant features (see and the shell variable) and system-dependent file locations (see Extensive terminal-management capabilities. See New builtin commands including and New variables that make useful information easily available to the shell. See the and shell variables and the and environment variables. A new syntax for including useful information in the prompt string (see and special prompts for loops and spelling correction (see and Read-only variables. See 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 trademarked). A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC found themselves supporting 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 showing?]). The creator of tcsh was impressed by this feature and several others of TENEX and TOPS-20, and created a version of csh which mimicked them. The system limits argument lists to ARG_MAX characters. The number of arguments to a command which involves filename expansion is limited to 1/6th the number of characters 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 substitutions on a single line to 20. This manual documents tcsh 6.24.13 (Astron) 2024-06-12. Original author of IIASA, Laxenburg, Austria. Job control and directory stack features. HP Labs, 1981. File name completion. Fairchild, 1983. Command name recognition/completion. Ohio State CIS Dept., 1983-1993. Command line editor, prompt routines, new glob syntax and numerous fixes and speedups. CCI, 1983-4. Special aliases, directory stack extraction stuff, login/logout watch, scheduled events, and the idea of the new prompt format. University of Toronto, 1984. and builtins and numerous bug fixes, modifications and speedups. Caltech. Fast storage allocator routines. TRW, 1987. Incorporated 4.3BSD into 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. BBN, and OSU, 1988. A/UX port. NNSC, 1988. Kuck and Associates, Inc., 1988. mode cleanup. Rensselaer Polytechnic Institute, 1989. and ambiguous completion listing. DEC, 1989. Newlines in the prompt. BBN, 1989. Purdue Physics, 1989. Magic space bar history expansion. Intel, 1989. fixes and additions. Dept. of Computer Science, Keio University, 1989. Automatic spelling correction and Ellemtel, Sweden, 1990-. Various bugfixes, improvements and manual updates. Sun Sweden. and Interrupt handling fixes. Digital Equipment Corp. Extended key support. Convex, 1990. Convex support, lots of bug fixes, save and restore of directory stack. Apple, 1990. A/UX 2.0 (re)port. LTH Sweden, 1990. NLS support and simulated NLS support for non NLS sites, fixes. SICS Sweden, 1990. Mach support, 8-bit printing. Sanyo Icon, 1990. POSIX termio support, SysV limit fixes. Sequent, 1990-91. Vi mode fixes, expand-line, window change fixes, Symmetry port. Institut de recherche d'Hydro-Quebec, 1991. beeping options, modified the history search to search for the whole string from the beginning of the line to the cursor. Motorola, 1991. Minix port. Sydney U. Australia, Physics Dept., 1991. SVR4 job control fixes. 1991-. Various portability and other fixes. Added (dollar-single-quotes). Interactive Systems Corp., 1991. Extended fixes and delete command. MIT, 1991. ANSIfication fixes, new exec hashing code, imake fixes, 1991-. Enhanced directory printing in Added and improvements. Manual page improvements. sterling@netcom.com, 1991-1995. ETA and Pyramid port, Makefile and lint fixes, addition, and various other portability changes and bug fixes. 1992. and 1992. Coherent port. Mullard Space Science Lab U.K., 1992. VMS-POSIX port. IBM Corp., 1992. Walking process group fixes, bug fixes, POSIX file tests, POSIX SIGHUP. Cray Computer Corp., 1992. CSOS port. Rutgers University, 1992. Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf support. Cornell University, 1992. OS/2 port. liljeber@kruuna.Helsinki.FI, 1992. Linux port. NASA Langley Research Center Operations, 1993. Read-only variables. Yale University, 1993-4. New man page and tcsh.man2html. Stanford University, 1993. AFS and HESIOD patches. Silicon Graphics Inc., 1996. Added implicit cd. 1997. Ported to Siemens Nixdorf EBCDIC machine. Microsoft, 1997. Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library and message catalog code to interface to Windows. 1998. Color ls additions. 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 section 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 are also not handled gracefully when stopping is attempted. If you suspend the shell will then immediately execute This is especially noticeable if this expansion results from an It suffices to place the sequence of commands in 's to force it to a subshell, i.e., 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. Control structures should be parsed rather than being recognized as built-in commands. This would allow control commands to be placed anywhere, to be combined with and to be used with and metasyntax. doesn't ignore here documents when looking for its It should be possible to use the modifiers on the output 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 and 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 does output redirection even if the expression is false and the command is not executed. includes file identification characters when sorting filenames and does not handle control characters in filenames well. It cannot be interrupted. Command substitution supports multiple commands and conditions, but not cycles or backward s. Report bugs at preferably with fixes. If you want to help maintain and test tcsh, add yourself to the mailing list in