The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Style notes for the tcsh man page:
- Tags in lists are bold, except in the FILES section where they are
italic.
- References are bold for section headings and environment and shell
variables and italic for commands (externals, builtins, aliases, and
editor commands) and arguments to commands.
- Be careful with the .B and .I macros: they handle only a limited number
of words. Work around this with and , but only if absolutely
necessary, because tcsh.man2html uses .B/.I to find name anchors.
- Indent in multiples of 4, usually 8.
- Use `', not '' or "", except of course in shell syntax examples.
'' at the beginning of a line will vanish!
- Use -, not -.
- Include the tilde when naming dot files. `~/.login', not `.login'.
- Refer to external commands in man page format, e.g., `csh(1)'. However,
tcsh is `tcsh', not `tcsh(1)', because this is the tcsh man page (and
see the next note anyway).
- Say `the shell', not `tcsh', unless distinguishing between tcsh and csh.
- Say `shell variable'/`environment variable' instead of `variable'
and `builtin command'/`editor command' instead of `builtin' or `command'
unless the distinction is absolutely clear from context.
- Use the simple present tense. `The shell uses', not `The shell will use'.
- IMPORTANT: Cross-reference as much as possible. Commands, variables,
etc. in the reference section should be mentioned in the appropriate
descriptive section, or at least in the reference-section description
of another command (or whatever) which is mentioned in a description
section. Remember to note OS-specific things in "OS variant support",
new features in NEW FEATURES and referenced external commands in SEE
ALSO.
- tcsh.man2html depends heavily on the specific nroff commands used in the
man page when the script was written. Please stick closely to the style
used here if you can. In particular, please don't use nroff commands
which aren't already used herein.
tcsh -l
The rest of the flag arguments are interpreted as follows:
4 -b Forces a ``break'' 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.
4 -c Commands are read from the following argument (which must be present, and must be a single argument), stored in the command shell variable for reference, and executed. Any remaining arguments are placed in the argv shell variable.
4 -d The shell loads the directory stack from ~/.cshdirs as described under Startup and shutdown, whether or not it is a login shell. (+)
4 -Dname[=value] Sets the environment variable name to value. (Domain/OS only) (+)
4 -e The shell exits if any invoked command terminates abnormally or yields a non-zero exit status.
4 -f The shell does not load any resource or startup files, or perform any command hashing, and thus starts faster.
4 -F The shell uses fork(2) instead of vfork(2) to spawn processes. (+)
4 -i 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.
4 -l The shell is a login shell. Applicable only if -l is the only flag specified.
4 -m The shell loads ~/.tcshrc even if it does not belong to the effective user. Newer versions of su(1) can pass -m to the shell. (+)
4 -n The shell parses commands but does not execute them. This aids in debugging shell scripts.
4 -q The shell accepts SIGQUIT (see Signal handling) and behaves when it is used under a debugger. Job control is disabled. (u)
4 -s Command input is taken from the standard input.
4 -t 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.
4 -v Sets the verbose shell variable, so that command input is echoed after history substitution.
4 -x Sets the echo shell variable, so that commands are echoed immediately before execution.
4 -V Sets the verbose shell variable even before executing ~/.tcshrc.
4 -X Is to -x as -V is to -v.
4 --help Print a help message on the standard output and exit. (+)
4 --version Print the version/platform/compilation options on the standard output and exit. This information is also contained in the version shell variable. (+)
After processing of flag arguments, if arguments remain but none of the -c, -i, -s, or -t options were given, the first argument is taken as the name of a file of commands, or ``script'', to be executed. The shell opens this file and saves its name for possible resubstitution by `$0'. Because many systems use either the standard version 6 or version 7 shells whose shell scripts are not compatible with this shell, the shell uses such a `standard' shell to execute a script whose first character is not a `#', i.e., that does not start with a comment.
Remaining arguments are placed in the argv shell variable.
Non-login shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on startup.
For examples of startup files, please consult http://tcshrc.sourceforge.net.
Commands like stty(1) and tset(1), which need be run only once per login, usually go in one's ~/.login file. Users who need to use the same set of files with both csh(1) and tcsh can have only a ~/.cshrc which checks for the existence of the tcsh shell variable (q.v.) before using tcsh-specific commands, or can have both a ~/.cshrc and a ~/.tcshrc which sources (see the builtin command) ~/.cshrc. The rest of this manual uses `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is not found, ~/.cshrc'.
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 `^D' on an empty line, `logout' or `login' or via the shell's autologout mechanism (see the autologout shell variable). When a login shell terminates it sets the logout shell variable to `normal' or `automatic' as appropriate, then executes commands from the files /etc/csh.logout and ~/.logout. The shell may drop DTR on logout if so compiled; see the version shell variable.
The names of the system login and logout files vary from system to system for compatibility with different csh(1) variants; see FILES.
The shell always binds the arrow keys (as defined in the TERMCAP environment variable) to
0
8 down down-history
8 up up-history
8 left backward-char
8 right forward-char
unless doing so would alter another single-character binding. One can set the arrow key escape sequences to the empty string with settc to prevent these bindings. The ANSI/VT100 sequences for arrow keys are always bound.
Other key bindings are, for the most part, what Emacs and vi(1) users would expect and can easily be displayed by bindkey, so there is no need to list them here. Likewise, bindkey can list the editor commands with a short description of each.
Note that editor commands do not have the same notion of a ``word'' as does the shell. The editor delimits words with any non-alphanumeric characters not in the shell variable wordchars, while the shell recognizes only whitespace and some of the characters with special meanings to it, listed under Lexical structure.
Completion works anywhere in the line, not at just the end; completed text pushes the rest of the line to the right. Completion in the middle of a word often results in leftover characters to the right of the cursor that need to be deleted.
Commands and variables can be completed in much the same way. For example, typing `em[tab]' would complete `em' to `emacs' if emacs were the only command on your system beginning with `em'. Completion can find a command in any directory in path or if given a full pathname. Typing `echo $ar[tab]' would complete `$ar' to `$argv' if no other variable began with `ar'.
The shell parses the input buffer to determine whether the word you want to complete should be completed as a 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 `completed' as a filename.
You can list the possible completions of a word at any time by typing `^D' to run the delete-char-or-list-or-eof editor command. The shell lists the possible completions using the ls-F builtin (q.v.) and reprints the prompt and unfinished command line, for example:
lbin/ lib/ local/ lost+found/
> ls /usr/l
If the autolist shell variable is set, the shell lists the remaining choices (if any) whenever completion fails:
libtermcap.a@ libtermlib.a@
If autolist is set to `ambiguous', choices are listed only when completion fails and adds no new characters to the word being completed.
A filename to be completed can contain variables, your own or others' home directories abbreviated with `~' (see Filename substitution) and directory stack entries abbreviated with `=' (see Directory stack substitution). For example,
kahn kas kellogg
> ls ~ke[tab]
> ls ~kellogg/
or
> ls $lo[tab]
> ls $local/[^D]
bin/ etc/ lib/ man/ src/
> ls $local/
Note that variables can also be expanded explicitly with the expand-variables editor command.
delete-char-or-list-or-eof 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 ignoreeof is set, does nothing. `M-^D', bound to the editor command list-choices, lists completion possibilities anywhere on a line, and list-choices (or any one of the related editor commands that do or don't delete, list and/or log out, listed under delete-char-or-list-or-eof) can be bound to `^D' with the bindkey builtin command if so desired.
The complete-word-fwd and complete-word-back 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 fignore can be set to a list of suffixes to be ignored by completion. Consider the following:
Makefile condiments.h~ main.o side.c
README main.c meal side.o
> set fignore = (.o \\~)
> emacs ma[^D]
> emacs ma[tab]
> emacs main.c
`main.c~' and `main.o' are ignored by completion (but not listing), because they end in suffixes in fignore. Note that a `\\' was needed in front of `~' to prevent it from being expanded to home as described under Filename substitution. fignore is ignored if only one completion is possible.
If the complete shell variable is set to `enhance', completion 1) ignores case and 2) considers periods, hyphens and underscores (`.', `-' and `_') to be word separators and hyphens and underscores to be equivalent. If you had the following files
and typed `mail -f c.l.c[tab]', it would be completed to `mail -f comp.lang.c', and ^D would list `comp.lang.c' and `comp.lang.c++'. `mail -f c..c++[^D]' would list `comp.lang.c++' and `comp.std.c++'. Typing `rm a--file[^D]' in the following directory
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 complete shell variable is set to `Enhance', 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 `rm a--file[^D]' in the directory of the previous example would still list all three files, but typing `rm A--file' would match only `A_silly_file' and typing `rm a__file[^D]' would match just `A_silly_file' and `another_silly_file' because the user explicitly used an uppercase or an underscore character.
Completion and listing are affected by several other shell variables: recexact can be set to complete on the shortest possible unique match, even if more typing might result in a longer match:
fodder foo food foonly
> set recexact
> rm fo[tab]
just beeps, because `fo' could expand to `fod' or `foo', but if we type another `o',
> rm foo
the completion completes on `foo', even though `food' and `foonly' also match. autoexpand can be set to run the expand-history editor command before each completion attempt, autocorrect can be set to spelling-correct the word to be completed (see Spelling correction) before each completion attempt and correct can be set to complete commands automatically after one hits `return'. matchbeep can be set to make completion beep or not beep in a variety of situations, and nobeep can be set to never beep at all. nostat can be set to a list of directories and/or patterns that match directories to prevent the completion mechanism from stat(2)ing those directories. listmax and listmaxrows can be set to limit the number of items and rows (respectively) that are listed without asking first. recognize_only_executables can be set to make the shell list only executables when listing commands, but it is quite slow.
Finally, the complete 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 Filename substitution), but the list-glob and expand-glob editor commands perform equivalent functions for glob-patterns.
Individual words can be spelling-corrected with the spell-word editor command (usually bound to M-s and M-S) and the entire input buffer with spell-line (usually bound to M-$). The correct shell variable can be set to `cmd' to correct the command name or `all' to correct the entire line each time return is typed, and autocorrect 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:
CORRECT>ls /usr/bin (y|n|e|a)?
One can answer `y' or space to execute the corrected line, `e' to leave the uncorrected command in the input buffer, `a' to abort the command as if `^C' had been hit, and anything else to execute the original line unchanged.
Spelling correction recognizes user-defined completions (see the complete 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.
Beware: spelling correction is not guaranteed to work the way one intends, and is provided mostly as an experimental feature. Suggestions and improvements are welcome.
The character or characters to which each command is bound by default is given in parentheses. `^character' means a control character and `M-character' a meta character, typed as escape-character 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.
8 complete-word (tab) Completes a word as described under Completion and listing.
8 complete-word-back (not bound) Like complete-word-fwd, but steps up from the end of the list.
8 complete-word-fwd (not bound) Replaces the current word with the first word in the list of possible completions. May be repeated to step down through the list. At the end of the list, beeps and reverts to the incomplete word.
8 complete-word-raw (^X-tab) Like complete-word, but ignores user-defined completions.
8 copy-prev-word (M-^_) Copies the previous word in the current line into the input buffer. See also insert-last-word.
8 dabbrev-expand (M-/) 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 dabbrev-expand without any intervening typing changes to the next previous word etc., skipping identical matches much like history-search-backward does.
8 delete-char (not bound) Deletes the character under the cursor. See also delete-char-or-list-or-eof.
8 delete-char-or-eof (not bound) Does delete-char if there is a character under the cursor or end-of-file on an empty line. See also delete-char-or-list-or-eof.
8 delete-char-or-list (not bound) Does delete-char if there is a character under the cursor or list-choices at the end of the line. See also delete-char-or-list-or-eof.
8 delete-char-or-list-or-eof (^D) Does delete-char if there is a character under the cursor, list-choices at the end of the line or end-of-file on an empty line. See also those three commands, each of which does only a single action, and delete-char-or-eof, delete-char-or-list and list-or-eof, each of which does a different two out of the three.
8 down-history (down-arrow, ^N) Like up-history, but steps down, stopping at the original input line.
8 end-of-file (not bound) Signals an end of file, causing the shell to exit unless the ignoreeof shell variable (q.v.) is set to prevent this. See also delete-char-or-list-or-eof.
8 expand-history (M-space) Expands history substitutions in the current word. See History substitution. See also magic-space, toggle-literal-history and the autoexpand shell variable.
8 expand-glob (^X-*) Expands the glob-pattern to the left of the cursor. See Filename substitution.
8 expand-line (not bound) Like expand-history, but expands history substitutions in each word in the input buffer.
8 expand-variables (^X-$) Expands the variable to the left of the cursor. See Variable substitution.
8 history-search-backward (M-p, M-P) Searches backwards through the history list for a command beginning with the current contents of the input buffer up to the cursor and copies it into the input buffer. The search string may be a glob-pattern (see Filename substitution) containing `*', `?', `[]' or `{}'. up-history and down-history will proceed from the appropriate point in the history list. Emacs mode only. See also history-search-forward and i-search-back.
8 history-search-forward (M-n, M-N) Like history-search-backward, but searches forward.
8 i-search-back (not bound) Searches backward like history-search-backward, copies the first match into the input buffer with the cursor positioned at the end of the pattern, and prompts with `bck: ' and the first match. Additional characters may be typed to extend the search, i-search-back may be typed to continue searching with the same pattern, wrapping around the history list if necessary, (i-search-back must be bound to a single character for this to work) or one of the following special characters may be typed:
0
8 ^W Appends the rest of the word under the cursor to the search pattern.
8 delete (or any character bound to backward-delete-char) Undoes the effect of the last character typed and deletes a character from the search pattern if appropriate.
8 ^G If the previous search was successful, aborts the entire search. If not, goes back to the last successful search.
8 escape Ends the search, leaving the current line in the input buffer.
Any other character not bound to self-insert-command terminates the search, leaving the current line in the input buffer, and is then interpreted as normal input. In particular, a carriage return causes the current line to be executed. Emacs mode only. See also i-search-fwd and history-search-backward.
8 i-search-fwd (not bound) Like i-search-back, but searches forward.
8 insert-last-word (M-_) Inserts the last word of the previous input line (`!$') into the input buffer. See also copy-prev-word.
8 list-choices (M-^D) Lists completion possibilities as described under Completion and listing. See also delete-char-or-list-or-eof and list-choices-raw.
8 list-choices-raw (^X-^D) Like list-choices, but ignores user-defined completions.
8 list-glob (^X-g, ^X-G) Lists (via the ls-F builtin) matches to the glob-pattern (see Filename substitution) to the left of the cursor.
8 list-or-eof (not bound) Does list-choices or end-of-file on an empty line. See also delete-char-or-list-or-eof.
8 magic-space (not bound) Expands history substitutions in the current line, like expand-history, and inserts a space. magic-space is designed to be bound to the space bar, but is not bound by default.
8 normalize-command (^X-?) Searches for the current word in PATH and, if it is found, replaces it with the full path to the executable. Special characters are quoted. Aliases are expanded and quoted but commands within aliases are not. This command is useful with commands that take commands as arguments, e.g., `dbx' and `sh -x'.
8 normalize-path (^X-n, ^X-N) Expands the current word as described under the `expand' setting of the symlinks shell variable.
8 overwrite-mode (unbound) Toggles between input and overwrite modes.
8 run-fg-editor (M-^Z) Saves the current input line and looks for a stopped job with a name equal to the last component of the file name part of the EDITOR or VISUAL environment variables, or, if neither is set, `ed' or `vi'. If such a job is found, it is restarted as if `fg %job' had been typed. This is used to toggle back and forth between an editor and the shell easily. Some people bind this command to `^Z' so they can do this even more easily.
run-help (M-h, M-H) Searches for documentation on the current command, using the same notion of `current command' as the completion routines, and prints it. There is no way to use a pager; run-help is designed for short help files. If the special alias helpcommand is defined, it is run with the command name as a sole argument. Else, documentation should be in a file named command.help, command.1, command.6, command.8 or command, which should be in one of the directories listed in the HPATH environment variable. If there is more than one help file only the first is printed.
8 self-insert-command (text characters) In insert mode (the default), inserts the typed character into the input line after the character under the cursor. In overwrite mode, replaces the character under the cursor with the typed character. The input mode is normally preserved between lines, but the inputmode shell variable can be set to `insert' or `overwrite' to put the editor in that mode at the beginning of each line. See also overwrite-mode.
8 sequence-lead-in (arrow prefix, meta prefix, ^X) Indicates that the following characters are part of a multi-key sequence. Binding a command to a multi-key sequence really creates two bindings: the first character to sequence-lead-in and the whole sequence to the command. All sequences beginning with a character bound to sequence-lead-in are effectively bound to undefined-key unless bound to another command.
8 spell-line (M-$) Attempts to correct the spelling of each word in the input buffer, like spell-word, but ignores words whose first character is one of `-', `!', `^' or `%', or which contain `\\', `*' or `?', to avoid problems with switches, substitutions and the like. See Spelling correction.
8 spell-word (M-s, M-S) Attempts to correct the spelling of the current word as described under Spelling correction. Checks each component of a word which appears to be a pathname.
8 toggle-literal-history (M-r, M-R) Expands or `unexpands' history substitutions in the input buffer. See also expand-history and the autoexpand shell variable.
8 undefined-key (any unbound key) Beeps.
8 up-history (up-arrow, ^P) Copies the previous entry in the history list into the input buffer. If histlit is set, uses the literal form of the entry. May be repeated to step up through the history list, stopping at the top.
8 vi-search-back (?) Prompts with `?' for a search string (which may be a glob-pattern, as with history-search-backward), 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. vi mode only.
8 vi-search-fwd (/) Like vi-search-back, but searches forward.
8 which-command (M-?) Does a which (see the description of the builtin command) on the first word of the input buffer.
8 yank-pop (M-y) When executed immediately after a yank or another yank-pop, 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 yank command. Repeating yank-pop will cycle through the killring any number of times.
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 Substitutions (see below) except History substitution 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 Variable substitution or Command substitution respectively) with `\\'. (Alias substitution is no exception: quoting in any way any character of a word for which an alias has been defined prevents substitution of the alias. The usual way of quoting an alias is to precede it with a backslash.) History substitution is prevented by backslashes but not by single quotes. Strings quoted with double or backward quotes undergo Variable substitution and Command substitution, 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 Command substitution below) can a double-quoted string yield parts of more than one word; single-quoted strings never do. Backward quotes are special: they signal Command substitution (q.v.), which may result in more than one word.
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 backslash_quote shell variable (q.v.) can be set to make backslashes always quote `\\', `'', and `"'. (+) This may make complex quoting tasks easier, but it can cause syntax errors in csh(1) scripts.
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 prompt shell variable.
The shell actually saves history in expanded and literal (unexpanded) forms. If the histlit shell variable is set, commands that display and store history use the literal form.
The history builtin command can print, store in a file, restore and clear the history list at any time, and the savehist and histfile 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 `^'. This special abbreviation will be described later. The characters used to signal history substitution (`!' and `^') can be changed by setting the histchars shell variable. Any input line which contains a history substitution is printed before it is executed.
A history substitution may have an ``event specification'', which indicates the event from which words are to be taken, a ``word designator'', which selects particular words from the chosen event, and/or a ``modifier'', which manipulates the selected words.
An event specification can be
0
8 n A number, referring to a particular event
8 -n An offset, referring to the event n before the current event
8 # The current event. This should be used carefully in csh(1), where there is no check for recursion. tcsh allows 10 levels of recursion. (+)
8 ! The previous event (equivalent to `-1')
8 s The most recent event whose first word begins with the string s
8 ?s? The most recent event which contains the string s. The second `?' can be omitted if it is immediately followed by a newline.
For example, consider this bit of someone's history list:
10 8:31 cp wumpus.man wumpus.man.old
11 8:36 vi wumpus.man
12 8:37 diff wumpus.man.old wumpus.man
The commands are shown with their event numbers and time stamps. The current event, which we haven't typed in yet, is event 13. `!11' and `!-2' refer to event 11. `!!' refers to the previous event, 12. `!!' can be abbreviated `!' if it is followed by `:' (`:' is described below). `!n' refers to event 9, which begins with `n'. `!?old?' also refers to event 12, which contains `old'. Without word designators or modifiers history references simply expand to the entire event, so we might type `!cp' to redo the copy command or `!!|more' if the `diff' output scrolled off the top of the screen.
History references may be insulated from the surrounding text with braces if necessary. For example, `!vdoc' would look for a command beginning with `vdoc', and, in this example, not find one, but `!{v}doc' would expand unambiguously to `vi wumpus.mandoc'. Even in braces, history substitutions do not nest.
(+) While csh(1) expands, for example, `!3d' to event 3 with the letter `d' appended to it, tcsh expands it to the last event beginning with `3d'; only completely numeric arguments are treated as event numbers. This makes it possible to recall events beginning with numbers. To expand `!3d' as in csh(1) say `!{3}d'.
To select words from an event we can follow the event specification by a `:' and a designator for the desired words. The words of an input line are numbered from 0, the first (usually command) word being 0, the second word (first argument) being 1, etc. The basic word designators are:
0
8 0 The first (command) word
8 n The nth argument
8 ^ The first argument, equivalent to `1'
8 $ The last argument
8 % The word matched by an ?s? search
8 x-y A range of words
8 -y Equivalent to `0-y'
8 * Equivalent to `^-$', but returns nothing if the event contains only 1 word
8 x* Equivalent to `x-$'
8 x- Equivalent to `x*', but omitting the last word (`$')
Selected words are inserted into the command line separated by single blanks. For example, the `diff' command in the previous example might have been typed as `diff !!:1.old !!:1' (using `:1' to select the first argument from the previous event) or `diff !-2:2 !-2:1' to select and swap the arguments from the `cp' command. If we didn't care about the order of the `diff' we might have said `diff !-2:1-2' or simply `diff !-2:*'. The `cp' command might have been written `cp wumpus.man !#:1.old', using `#' to refer to the current event. `!n:- hurkle.man' would reuse the first two words from the `nroff' command to say `nroff -man hurkle.man'.
The `:' separating the event specification from the word designator can be omitted if the argument selector begins with a `^', `$', `*', `%' or `-'. For example, our `diff' command might have been `diff !!^.old !!^' or, equivalently, `diff !!$.old !!$'. However, if `!!' is abbreviated `!', an argument selector beginning with `-' will be interpreted as an event specification.
A history reference may have a word designator but no event specification. It then references the previous command. Continuing our `diff' example, we could have said simply `diff !^.old !^' or, to get the arguments in the opposite order, just `diff !*'.
The word or words in a history reference can be edited, or ``modified'', by following it with one or more modifiers, each preceded by a `:':
0
8 h Remove a trailing pathname component, leaving the head.
8 t Remove all leading pathname components, leaving the tail.
8 r Remove a filename extension `.xxx', leaving the root name.
8 e Remove all but the extension.
8 u Uppercase the first lowercase letter.
8 l Lowercase the first uppercase letter.
8 s/l/r/ Substitute l for r. l is simply a string like r, not a regular expression as in the eponymous ed(1) command. Any character may be used as the delimiter in place of `/'; a `\\' can be used to quote the delimiter inside l and r. The character `&' in the r is replaced by l; `\\' also quotes `&'. If l is empty (``''), the l from a previous substitution or the s from a previous search or event number in event specification is used. The trailing delimiter may be omitted if it is immediately followed by a newline.
8 & Repeat the previous substitution.
8 g Apply the following modifier once to each word.
8 a (+) Apply the following modifier as many times as possible to a single word. `a' and `g' can be used together to apply a modifier globally. With the `s' modifier, only the patterns contained in the original word are substituted, not patterns that contain any substitution result.
8 p Print the new command line but do not execute it.
8 q Quote the substituted words, preventing further substitutions.
8 x Like q, but break into words at blanks, tabs and newlines.
Modifiers are applied to only the first modifiable word (unless `g' is used). It is an error for no word to be modifiable.
For example, the `diff' command might have been written as `diff wumpus.man.old !#^:r', using `:r' to remove `.old' from the first argument on the same line (`!#^'). We could say `echo hello out there', then `echo !*:u' to capitalize `hello', `echo !*:au' to say it out loud, or `echo !*:agu' to really shout. We might follow `mail -s "I forgot my password" rot' with `!:s/rot/root' to correct the spelling of `root' (but see Spelling correction for a different approach).
There is a special abbreviation for substitutions. `^', when it is the first character on an input line, is equivalent to `!:s^'. Thus we might have said `^rot^root' to make the spelling correction in the previous example. This is the only history substitution which does not explicitly begin with `!'.
(+) In csh as such, only one modifier may be applied to each history or variable expansion. In tcsh, more than one may be used, for example
% man !$:t:r
man wumpus
In csh, the result would be `wumpus.1:r'. A substitution followed by a colon may need to be insulated from it with braces:
> setenv PATH !$:h:$PATH
Bad ! modifier: $.
> setenv PATH !{-2$:h}:$PATH
setenv PATH /usr/games:/bin:/usr/bin:.
The first attempt would succeed in csh but fails in tcsh, because tcsh expects another modifier after the second colon rather than `$'.
Finally, history can be accessed through the editor as well as through the substitutions just described. The up- and down-history, history-search-backward and -forward, i-search-back and -fwd, vi-search-back and -fwd, copy-prev-word and insert-last-word editor commands search for events in the history list and copy them into the input buffer. The toggle-literal-history editor command switches between the expanded and literal forms of history lines in the input buffer. expand-history and expand-line expand history substitutions in the current word and in the entire input buffer respectively.
Thus if the alias for `ls' were `ls -l' the command `ls /usr' would become `ls -l /usr', the argument list here being undisturbed. If the alias for `lookup' were `grep !^ /etc/passwd' then `lookup bill' would become `grep bill /etc/passwd'. Aliases can be used to introduce parser metasyntax. For example, `alias print 'pr \e!* | lpr'' defines a ``command'' (`print') which pr(1)s its arguments to the line printer.
Alias substitution is repeated until the first word of the command has no alias. If an alias substitution does not change the first word (as in the previous example) it is flagged to prevent a loop. Other loops are detected and cause an error.
Some aliases are referred to by the shell; see Special aliases.
(+) Variables may be made read-only with `set -r' (q.v.). 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 `set -r' should be used with caution. Environment variables cannot be made read-only.
Some variables are set by the shell or referred to by it. For instance, the argv 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 verbose variable is a toggle which causes command input to be echoed. The -v command line option sets this variable. Special shell variables 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 `\e' except within `"'s where it always occurs, and within `''s where it never occurs. Strings quoted by ``' are interpreted later (see Command substitution below) so `$' substitution does not occur there until later, if at all. A `$' is passed unchanged if followed by a blank, tab, or end-of-line.
Input/output redirections are recognized before variable expansion, and are variable expanded separately. 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 `:q' modifier the results of variable substitution may eventually be command and filename substituted. Within `"', a variable whose value consists of multiple words expands to a (portion of a) single word, with the words of the variable's value separated by blanks. When the `:q' modifier is applied to a substitution the variable will expand to multiple words with each word separated by a blank and quoted to prevent later command or filename substitution.
The following metasequences are provided for introducing variable values into the shell input. Except as noted, it is an error to reference a variable which is not set.
0 $name
8 ${name} Substitutes the words of the value of variable name, each separated by a blank. Braces insulate name 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 name 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).
$name[selector]
8 ${name[selector]} Substitutes only the selected words from the value of name. The selector 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 `1'. If the first number of a range is omitted it defaults to `1'. If the last member of a range is omitted it defaults to `$#name'. The selector `*' selects all words. It is not an error for a range to be empty if the second argument is omitted or in range.
8 $0 Substitutes the name of the file from which command input is being read. An error occurs if the name is not known.
$number
8 ${number} Equivalent to `$argv[number]'.
8 $* Equivalent to `$argv', which is equivalent to `$argv[*]'.
The `:' modifiers described under History substitution, except for `:p', can be applied to the substitutions above. More than one may be used. (+) Braces may be needed to insulate a variable substitution from a literal colon just as with History substitution (q.v.); any modifiers must appear within the braces.
The following substitutions can not be modified with `:' modifiers.
0 $?name
8 ${?name} Substitutes the string `1' if name is set, `0' if it is not.
8 $?0 Substitutes `1' if the current input filename is known, `0' if it is not. Always `0' in interactive shells.
$#name
8 ${#name} Substitutes the number of words in name.
8 $# Equivalent to `$#argv'. (+)
$%name
8 ${%name} Substitutes the number of characters in name. (+)
$%number
8 ${%number} Substitutes the number of characters in $argv[number]. (+)
8 $? Equivalent to `$status'. (+)
8 $$ Substitutes the (decimal) process number of the (parent) shell.
8 $! Substitutes the (decimal) process number of the last background process started by this shell. (+)
8 $_ Substitutes the command line of the last command executed. (+)
8 $< 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 csh always quotes $<, as if it were equivalent to `$<:q', tcsh does not. Furthermore, when tcsh 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 csh does not allow this.
The editor command expand-variables, normally bound to `^X-$', can be used to interactively expand individual variables.
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 csubstnonl, newlines separate commands as usual.
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 globdot or globstar 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 not specified by the characters and/or ranges of characters in the braces.
An entire glob-pattern can also be negated with `^':
bang crash crunch ouch
> echo ^cr*
bang ouch
Glob-patterns which do not use `?', `*', or `[]' or which use `{}' or `~' (below) are not negated correctly.
The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'. Left-to-right order is preserved: `/usr/source/s1/{oldls,ls}.c' expands to `/usr/source/s1/oldls.c /usr/source/s1/ls.c'. The results of matches are sorted separately at a low level to preserve this order: `../{memo,*box}' might expand to `../memo ../box ../mbox'. (Note that `memo' was not sorted with the results of matching `*box'.) It is not an error when this construct expands to files which do not exist, but it is possible to get an error from a command to which the expanded list is passed. This construct may be nested. As a special case the words `{', `}' and `{}' are passed undisturbed.
The character `~' at the beginning of a filename refers to home directories. Standing alone, i.e., `~', it expands to the invoker's home directory as reflected in the value of the home 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 `~ken' might expand to `/usr/ken' and `~ken/chmach' to `/usr/ken/chmach'. If the character `~' is followed by a character other than a letter or `/' or appears elsewhere than at the beginning of a word, it is left undisturbed. A command like `setenv MANPATH /usr/man:/usr/local/man:~/lib/man' does not, therefore, do home directory substitution as one might hope.
It is an error for a glob-pattern containing `*', `?', `[' or `~', with or without `^', not to match any files. However, only one pattern in a list of glob-patterns must match a file (so that, e.g., `rm *.a *.c *.o' would fail only if there were no files in the current directory ending in `.a', `.c', or `.o'), and if the nonomatch shell variable is set a pattern (or list of patterns) which matches nothing is left unchanged rather than causing an error.
The globstar 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, `ls **.c' will list all the .c files in the current directory tree. If used by itself, it will match match zero or more sub-directories (e.g. `ls /usr/include/**/time.h' will list any file named `time.h' in the /usr/include directory tree; `ls /usr/include/**time.h' will match any file in the /usr/include directory tree ending in `time.h'; and `ls /usr/include/**time**.h' will match any .h file with `time' 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 noglob shell variable can be set to prevent filename substitution, and the expand-glob editor command, normally bound to `^X-*', can be used to interactively expand individual filename substitutions.
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,
> echo =1
> echo =0/calendar
> echo =-
The noglob and nonomatch shell variables and the expand-glob editor command apply to directory stack as well as filename substitutions.
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, `()', 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 `&'.
Parenthesized commands are always executed in a subshell.
thus prints the home directory, leaving you where you were (printing this after the home directory), while
leaves you in the home directory. Parenthesized commands are most often used to prevent cd 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 execve(2). Each word in the variable path names a directory in which the shell will look for the command. If the shell is not given a -f option, the shell hashes the names in these directories into an internal table so that it will try an execve(2) in only a directory where there is a possibility that the command resides there. This greatly speeds command location when a large number of directories are present in the search path. This hashing mechanism is not used:
4 1. If hashing is turned explicitly off via unhash.
4 2. If the shell was given a -f argument.
4 3. For each directory component of path which does not begin with a `/'.
4 4. 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 shell 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 version shell variable. If so, the shell checks the first line of the file to see if it is of the form `#!interpreter arg ...'. If it is, the shell starts interpreter with the given args 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:
0
8 < name Open file name (which is first variable, command and filename expanded) as the standard input.
8 << word Read the shell input up to a line which is identical to word. word is not subjected to variable, filename or command substitution, and each input line is compared to word before any substitutions are done on this input line. Unless a quoting `\e', `"', `' or ``' appears in word variable and command substitution is performed on the intervening lines, allowing `\e' to quote `$', `\e' 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.
> name
>! name
>& name
8 >&! name The file name 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 noclobber is set, then the file must not exist or be a character special file (e.g., a terminal or `/dev/null') or an error results. This helps prevent accidental destruction of files. In this case the `!' forms can be used to suppress this check.
The forms involving `&' route the diagnostic output into the specified file as well as the standard output. name is expanded in the same way as `<' input filenames are.
0
>> name
>>& name
>>! name
8 >>&! name Like `>', but appends output to the end of name. If the shell variable noclobber is set, then it is an error for the file not 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 not the empty file /dev/null, 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 Jobs).
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 `(command > output-file) >& error-file' is often an acceptable workaround. Either output-file or error-file may be `/dev/tty' to send output to the terminal.
The foreach, switch, and while statements, as well as the if-then-else form of the if 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 gotos will succeed on non-seekable inputs.)
< > << >> + - * / % ! ~ ( )
Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<=' `>=' `<' and `>', `<<' and `>>', `+' and `-', `*' `/' and `%' being, in groups, at the same level. 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 Filename substitution) against which the left hand operand is matched. This reduces the need for use of the switch builtin command in shell scripts when all that is really needed is pattern matching.
Null or missing arguments are considered `0'. The results of all expressions are strings, which represent decimal numbers. It is important to note that no two components of an expression can appear in the same word; except when adjacent to components of expressions which are syntactically significant to the parser (`&' `|' `<' `>' `(' `)') they should be surrounded by spaces.
0
4 r Read access
4 w Write access
4 x Execute access
4 X Executable in the path or shell builtin, e.g., `-X ls' and `-X ls-F' are generally true, but `-X /bin/ls' is not (+)
4 e Existence
4 o Ownership
4 z Zero size
4 s Non-zero size (+)
4 f Plain file
4 d Directory
4 l Symbolic link (+) *
4 b Block special file (+)
4 c Character special file (+)
4 p Named pipe (fifo) (+) *
4 S Socket special file (+) *
4 u Set-user-ID bit is set (+)
4 g Set-group-ID bit is set (+)
4 k Sticky bit is set (+)
4 t file (which must be a digit) is an open file descriptor for a terminal device (+)
4 R Has been migrated (Convex only) (+)
4 L Applies subsequent operators in a multiple-operator test to a symbolic link rather than to the file to which the link points (+) *
file is command and filename expanded and then tested to see if it has the specified relationship to the real user. If file does not exist or is inaccessible or, for the operators indicated by `*', if the specified file type does not exist on the current system, then all enquiries return false, i.e., `0'.
These operators may be combined for conciseness: `-xy file' is equivalent to `-x file && -y file'. (+) For example, `-fx' is true (returns `1') for plain executable files, but not for directories.
L 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, `-lLo' is true for links owned by the invoking user. Lr, Lw and Lx are always true for links and false for non-links. L 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 file to be a file with operators which do not (e.g., X and t). Following L with a non-file operator can lead to particularly strange results.
Other operators return other information, i.e., not just `0' or `1'. (+) They have the same format as before; op may be one of
0
8 A Last file access time, as the number of seconds since the epoch
8 A: Like A, but in timestamp format, e.g., `Fri May 14 16:36:10 1993'
8 M Last file modification time
8 M: Like M, but in timestamp format
8 C Last inode modification time
8 C: Like C, but in timestamp format
8 D Device number
8 I Inode number
8 F Composite file identifier, in the form device:inode
8 L The name of the file pointed to by a symbolic link
8 N Number of (hard) links
8 P Permissions, in octal, without leading zero
8 P: Like P, with leading zero
8 Pmode Equivalent to `-P file & mode', e.g., `-P22 file' returns `22' if file is writable by group and other, `20' if by group only, and `0' if by neither
8 Pmode: Like Pmode, with leading zero
8 U Numeric userid
8 U: Username, or the numeric userid if the username is unknown
8 G Numeric groupid
8 G: Groupname, or the numeric groupid if the groupname is unknown
8 Z Size, in bytes
Only one of these operators may appear in a multiple-operator test, and it must be the last. Note that L has a different meaning at the end of and elsewhere in a multiple-operator test. Because `0' is a valid return value for many of these operators, they do not return `0' when they fail: most return `-1', and F returns `:'.
If the shell is compiled with POSIX defined (see the version shell variable), the result of a file inquiry is based on the permission bits of the file and not on the result of the access(2) system call. For example, if one tests a file with -w 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 filetest builtin command (q.v.) (+).
indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process id was 1234.
If you are running a job and wish to do something else you may hit the suspend key (usually `^Z'), which sends a STOP signal to the current job. The shell will then normally indicate that the job has been `Suspended' and print another prompt. If the listjobs shell variable is set, all jobs will be listed like the jobs builtin command; if it is set to `long' the listing will be in long format, like `jobs -l'. You can then manipulate the state of the suspended job. You can put it in the ``background'' with the bg command or run some other commands and eventually bring the job back into the ``foreground'' with fg. (See also the run-fg-editor editor command.) A `^Z' takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. The wait 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 read(2) it, to the current job. This can usefully be typed ahead when you have prepared some commands for a job which you wish to stop after it has read them. The `^Y' key performs this function in csh(1); in tcsh, `^Y' is an editing command. (+)
A job being run in the background stops if it tries to read from the terminal. Background jobs are normally allowed to produce output, but this can be disabled by giving the command `stty tostop'. If you set this tty option, then background jobs will stop when they try to produce output like they do when they try to read input.
There are several ways to refer to jobs in the shell. The character `%' introduces a job name. If you wish to refer to job number 1, you can name it as `%1'. Just naming a job brings it to the foreground; thus `%1' is a synonym for `fg %1', bringing job 1 back into the foreground. Similarly, saying `%1 &' resumes job 1 in the background, just like `bg %1'. A job can also be named by an unambiguous prefix of the string typed in to start it: `%ex' would normally restart a suspended ex(1) job, if there were only one suspended job whose name began with the string `ex'. It is also possible to say `%?string' to specify a job whose text contains string, 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 history mechanism) `%%' all refer to the current job, and `%-' refers to the previous job.
The job control mechanism requires that the stty(1) option `new' be set on some systems. It is an artifact from a `new' implementation of the tty driver which allows generation of interrupt characters from the keyboard to tell jobs to stop. See stty(1) and the setty builtin command for details on setting options in the new tty driver.
When you try to leave the shell while jobs are stopped, you will be warned that `There are suspended jobs.' You may use the jobs 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.
The sched builtin command puts commands in a scheduled-event list, to be executed by the shell at a given time.
The beepcmd, cwdcmd, periodic, precmd, postcmd, and jobcmd Special aliases can be set, respectively, to execute commands when the shell wants to ring the bell, when the working directory changes, every tperiod minutes, before each prompt, before each command gets executed, after each command gets executed, and when a job is started or is brought into the foreground.
The autologout shell variable can be set to log out or lock the shell after a given number of minutes of inactivity.
The mail shell variable can be set to check for new mail periodically.
The printexitvalue shell variable can be set to print the exit status of commands which exit with a status other than zero.
The rmstar shell variable can be set to ask the user, when `rm *' is typed, if that is really what was meant.
The time shell variable can be set to execute the time builtin command after the completion of any process that takes more than a given number of CPU seconds.
The watch and who shell variables can be set to report when selected users log in or out, and the log builtin command reports on those users at any time.
When using the system's NLS, the setlocale(3) function is called to determine appropriate character code/classification and sorting (e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code). This function typically examines the LANG and LC_CTYPE 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 LANG and LC_CTYPE 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 \e200-\e377, i.e., those that have M-char bindings, are automatically rebound to self-insert-command. The corresponding binding for the escape-char sequence, if any, is left alone. These characters are not rebound if the NOREBIND 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 M-char bindings in the range \e240-\e377 are effectively undone. Explicitly rebinding the relevant keys with bindkey is of course still possible.
Unknown characters (i.e., those that are neither printable nor control characters) are printed in the format \ennn. 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 stty(1) command in, e.g., the ~/.login file.
On systems that support TCF (aix-ibm370, aix-ps2), getspath and setspath get and set the system execution path, getxvers and setxvers get and set the experimental version prefix and migrate migrates processes between sites. The jobs builtin prints the site on which each job is executing.
Under BS2000, bs2cmd executes commands of the underlying BS2000/OSD operating system.
Under Domain/OS, inlib adds shared libraries to the current environment, rootnode changes the rootnode and ver changes the systype.
Under Mach, setpath is equivalent to Mach's setpath(1).
Under Masscomp/RTU and Harris CX/UX, universe sets the universe.
Under Harris CX/UX, ucb or att runs a command under the specified universe.
Under Convex/OS, warp prints or sets the universe.
The VENDOR, OSTYPE and MACHTYPE 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,
in one's ~/.login and put executables compiled for each machine in the appropriate directory.
The version shell variable indicates what options were chosen when the shell was compiled.
Note also the newgrp builtin, the afsuser and echo_style shell variables and the system-dependent locations of the shell's input files (see FILES).
In shell scripts, the shell's handling of interrupt and terminate signals can be controlled with onintr, and its handling of hangups can be controlled with hup and nohup.
The shell exits on a hangup (see also the logout shell variable). By default, the shell's children do too, but the shell does not send them a hangup when it exits. hup arranges for the shell to send a hangup to a child when it exits, and nohup sets a child to ignore hangups.
The echotc, settc and telltc 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 LINES and COLUMNS if set. If the environment variable TERMCAP contains li# and co# fields, the shell adjusts them to reflect the new window size.
8 %job A synonym for the fg builtin command.
8 %job & A synonym for the bg builtin command.
8 : Does nothing, successfully.
@
@ name = expr
@ name[index] = expr
@ name++|--
0
8 @ name[index]++|-- The first form prints the values of all shell variables.
The second form assigns the value of expr to name. The third form assigns the value of expr to the index'th component of name; both name and its index'th component must already exist.
expr may contain the operators `*', `+', etc., as in C. If expr contains `<', `>', `&' or `' then at least that part of expr must be placed within `()'. Note that the syntax of expr has nothing to do with that described under Expressions.
The fourth and fifth forms increment (`++') or decrement (`--') name or its index'th component.
The space between `@' and name is required. The spaces between name and `=' and between `=' and expr are optional. Components of expr must be separated by spaces.
8 alias [name [wordlist]] Without arguments, prints all aliases. With name, prints the alias for name. With name and wordlist, assigns wordlist as the alias of name. wordlist is command and filename substituted. name may not be `alias' or `unalias'. See also the unalias builtin command.
8 alloc 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.
8 bg [%job ...] Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. job may be a number, a string, `', `%', `+' or `-' as described under Jobs.
bindkey [-l|-d|-e|-v|-u] (+)
bindkey [-a] [-b] [-k] [-r] [--] key (+)
0
8
bindkey [-a] [-b] [-k] [-c|-s] [--] key command (+)
.B macro can't take too many words, so I used in the previous tags
Without options, the first form lists all bound keys and the editor command to which each is bound,
the second form lists the editor command to which key is bound and
the third form binds the editor command command to key.
Options include:
0
4 -l Lists all editor commands and a short description of each.
4 -d Binds all keys to the standard bindings for the default editor.
4 -e Binds all keys to the standard GNU Emacs-like bindings.
4 -v Binds all keys to the standard vi(1)-like bindings.
4 -a Lists or changes key-bindings in the alternative key map. This is the key map used in vi command mode.
4 -b key is interpreted as a control character written ^character (e.g., `^A') or C-character (e.g., `C-A'), a meta character written M-character (e.g., `M-A'), a function key written F-string (e.g., `F-string'), or an extended prefix key written X-character (e.g., `X-A').
4 -k key is interpreted as a symbolic arrow key name, which may be one of `down', `up', `left' or `right'.
4 -r Removes key's binding. Be careful: `bindkey -r' does not bind key to self-insert-command (q.v.), it unbinds key completely.
4 -c command is interpreted as a builtin or external command instead of an editor command.
4 -s command is taken as a literal string and treated as terminal input when key is typed. Bound keys in command are themselves reinterpreted, and this continues for ten levels of interpretation.
4 -- Forces a break from option processing, so the next word is taken as key even if it begins with '-'.
4 -u (or any invalid option) Prints a usage message.
key 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 sequence-lead-in and the entire string is bound to the command.
Control characters in key can be literal (they can be typed by preceding them with the editor command quoted-insert, normally bound to `^V') or written caret-character style, e.g., `^A'. Delete is written `^?' (caret-question mark). key and command can contain backslashed escape sequences (in the style of System V echo(1)) as follows:
8
0 \ea Bell
8 \eb Backspace
8 \ee Escape
8 \ef Form feed
8 \en Newline
8 \er Carriage return
8 \et Horizontal tab
8 \ev Vertical tab
8 \ennn The ASCII character corresponding to the octal number nnn
`\e' nullifies the special meaning of the following character, if it has any, notably `\\' and `^'.
8 bs2cmd bs2000-command (+) Passes bs2000-command 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)
8 break Causes execution to resume after the end of the nearest enclosing foreach or while. The remaining commands on the current line are executed. Multi-level breaks are thus possible by writing them all on one line.
8 breaksw Causes a break from a switch, resuming after the endsw.
8 builtins (+) Prints the names of all builtin commands.
8 bye (+) A synonym for the logout builtin command. Available only if the shell was so compiled; see the version shell variable.
8 case label: A label in a switch statement as discussed below.
8 cd [-p] [-l] [-n|-v] [\I--] [name] If a directory name is given, changes the shell's working directory to name. If not, changes to home. If name is `-' it is interpreted as the previous working directory (see Other substitutions). (+) If name is not a subdirectory of the current directory (and does not begin with `/', `./' or `../'), each component of the variable cdpath is checked to see if it has a subdirectory name. Finally, if all else fails but name is a shell variable whose value begins with `/', then this is tried to see if it is a directory.
With -p, prints the final directory stack, just like dirs. The -l, -n and -v flags have the same effect on cd as on dirs, and they imply -p. (+) Using -- forces a break from option processing so the next word is taken as the directory name even if it begins with '-'. (+)
See also the implicitcd shell variable.
8 chdir A synonym for the cd builtin command.
8 complete [command [word/pattern/list[:select]/[[suffix]/] ...]] (+) Without arguments, lists all completions. With command, lists completions for command. With command and word etc., defines completions.
command may be a full command name or a glob-pattern (see Filename substitution). It can begin with `-' to indicate that completion should be used only when command is ambiguous.
word specifies which word relative to the current word is to be completed, and may be one of the following:
0
4 c Current-word completion. pattern is a glob-pattern which must match the beginning of the current word on the command line. pattern is ignored when completing the current word.
4 C Like c, but includes pattern when completing the current word.
4 n Next-word completion. pattern is a glob-pattern which must match the beginning of the previous word on the command line.
4 N Like n, but must match the beginning of the word two before the current word.
4 p Position-dependent completion. pattern is a numeric range, with the same syntax used to index shell variables, which must include the current word.
list, the list of possible completions, may be one of the following:
0
8 a Aliases
8 b Bindings (editor commands)
8 c Commands (builtin or external commands)
8 C External commands which begin with the supplied path prefix
8 d Directories
8 D Directories which begin with the supplied path prefix
8 e Environment variables
8 f Filenames
8 F Filenames which begin with the supplied path prefix
8 g Groupnames
8 j Jobs
8 l Limits
8 n Nothing
8 s Shell variables
8 S Signals
8 t Plain (``text'') files
8 T Plain (``text'') files which begin with the supplied path prefix
8 v Any variables
8 u Usernames
8 x Like n, but prints select when list-choices is used.
8 X Completions
8 $var Words from the variable var
8 (...) Words from the given list
8 `...` Words from the output of command
select is an optional glob-pattern. If given, words from only list that match select are considered and the fignore shell variable is ignored. The last three types of completion may not have a select pattern, and x uses select as an explanatory message when the list-choices editor command is used.
suffix 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.
command invoked from `...` version has additional environment variable set, the variable name is \%COMMAND_LINE\% and contains (as its name indicates) contents of the current (already typed in) command line. One can examine and use contents of the \%COMMAND_LINE\% variable in her custom script to build more sophisticated completions (see completion for svn(1) included in this package).
Now for some examples. Some commands take only directories as arguments, so there's no point completing plain files.
completes only the first word following `cd' (`p/1') with a directory. p-type completion can also be used to narrow down command completion:
complete compress
> complete -co* 'p/0/(compress)/'
> co[^D]
> compress
This completion completes commands (words in position 0, `p/0') which begin with `co' (thus matching `co*') to `compress' (the only word in the list). The leading `-' indicates that this completion is to be used with only ambiguous commands.
is an example of n-type completion. Any word following `find' and immediately following `-user' is completed from the list of users.
demonstrates c-type completion. Any word following `cc' and beginning with `-I' is completed as a directory. `-I' is not taken as part of the directory because we used lowercase c.
Different lists are useful with different commands.
> complete man 'p/*/c/'
> complete set 'p/1/s/'
> complete true 'p/1/x:Truth has no options./'
These complete words following `alias' with aliases, `man' with commands, and `set' with shell variables. `true' doesn't have any options, so x does nothing when completion is attempted and prints `Truth has no options.' when completion choices are listed.
Note that the man example, and several other examples below, could just as well have used 'c/*' or 'n/*' as 'p/*'.
Words can be completed from a variable evaluated at completion time,
> 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:
> kill -9 [^D]
23113 23377 23380 23406 23429 23529 23530 PID
Note that the complete command does not itself quote its arguments, so the braces, space and `$' in `{print $1}' must be quoted explicitly.
One command can have multiple completions:
completes the second argument to `dbx' with the word `core' and all other arguments with commands. Note that the positional completion is specified before the next-word completion. Because 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 select pattern is useful when a command takes files with only particular forms as arguments. For example,
completes `cc' arguments to files ending in only `.c', `.a', or `.o'. select can also exclude files, using negation of a glob-pattern as described under Filename substitution. One might use
to exclude precious source code from `rm' completion. Of course, one could still type excluded names manually or override the completion mechanism using the complete-word-raw or list-choices-raw editor commands (q.v.).
The `C', `D', `F' and `T' lists are like `c', `d', `f' and `t' respectively, but they use the select 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
to complete `elm -f =' as if it were `elm -f ~/Mail/'. Note that we used `@' instead of `/' to avoid confusion with the select argument, and we used `$HOME' instead of `~' because home directory substitution works at only the beginning of a word.
suffix is used to add a nonstandard suffix (not space or `/' for directories) to completed words.
completes arguments to `finger' from the list of users, appends an `@', and then completes after the `@' from the `hostnames' variable. Note again the order in which the completions are specified.
Finally, here's a complex example for inspiration:
'n/-name/f/' 'n/-newer/f/' 'n/-{,n}cpio/f/' \e
\'n/-exec/c/' 'n/-ok/c/' 'n/-user/u/' \e
'n/-group/g/' 'n/-fstype/(nfs 4.2)/' \e
'n/-type/(b c d f l p s)/' \e
\'c/-/(name newer cpio ncpio exec ok user \e
group fstype type atime ctime depth inum \e
ls mtime nogroup nouser perm print prune \e
size xdev)/' \e
'p/*/d/'
This completes words following `-name', `-newer', `-cpio' or `ncpio' (note the pattern which matches both) to files, words following `-exec' or `-ok' to commands, words following `user' and `group' to users and groups respectively and words following `-fstype' or `-type' to members of the given lists. It also completes the switches themselves from the given list (note the use of c-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 `$'). complete is an experimental feature, and the syntax may change in future versions of the shell. See also the uncomplete builtin command.
8 continue Continues execution of the nearest enclosing while or foreach. The rest of the commands on the current line are executed.
8 default: Labels the default case in a switch statement. It should come after all case labels.
dirs [-l] [-n|-v]
dirs -S|-L [filename] (+)
0
8 dirs -c (+) 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 -l, `~' or `~name' in the output is expanded explicitly to home or the pathname of the home directory for user name. (+) With -n, entries are wrapped before they reach the edge of the screen. (+) With -v, entries are printed one per line, preceded by their stack positions. (+) If more than one of -n or -v is given, -v takes precedence. -p is accepted but does nothing.
With -S, the second form saves the directory stack to filename as a series of cd and pushd commands. With -L, the shell sources filename, which is presumably a directory stack file saved by the -S option or the savedirs mechanism. In either case, dirsfile is used if filename is not given and ~/.cshdirs is used if dirsfile is unset.
Note that login shells do the equivalent of `dirs -L' on startup and, if savedirs is set, `dirs -S' before exiting. Because only ~/.tcshrc is normally sourced before ~/.cshdirs, dirsfile should be set in ~/.tcshrc rather than ~/.login.
The last form clears the directory stack.
8 echo [-n] word ... Writes each word to the shell's standard output, separated by spaces and terminated with a newline. The echo_style shell variable may be set to emulate (or not) the flags and escape sequences of the BSD and/or System V versions of echo; see echo(1).
8 echotc [-sv] arg ... (+) Exercises the terminal capabilities (see termcap(5)) in args. For example, 'echotc home' sends the cursor to the home position, 'echotc cm 3 10' sends it to column 3 and row 10, and 'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test." in the status line.
If arg is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the value of that capability ("yes" or "no" indicating that the terminal does or does not have that capability). One might use this to make the output from a shell script less verbose on slow terminals, or limit command output to the number of lines on the screen:
> @ 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 frsl="`echotc fs`"
> echo -n "$tosl";date; echo -n "$frsl"
With -s, nonexistent capabilities return the empty string rather than causing an error. With -v, messages are verbose.
else
end
endif
0
8 endsw See the description of the foreach, if, switch, and while statements below.
8 eval arg ... 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 tset(1) for a sample use of eval.
8 exec command Executes the specified command in place of the current shell.
8 exit [expr] The shell exits either with the value of the specified expr (an expression, as described under Expressions) or, without expr, with the value 0.
8 fg [%job ...] Brings the specified jobs (or, without arguments, the current job) into the foreground, continuing each if it is stopped. job may be a number, a string, `', `%', `+' or `-' as described under Jobs. See also the run-fg-editor editor command.
8 filetest -op file ... (+) Applies op (which is a file inquiry operator as described under File inquiry operators) to each file and returns the results as a space-separated list.
foreach name (wordlist)
...
0
8 end Successively sets the variable name to each member of wordlist and executes the sequence of commands between this command and the matching end. (Both foreach and end must appear alone on separate lines.) The builtin command continue may be used to continue the loop prematurely and the builtin command break to terminate it prematurely. When this command is read from the terminal, the loop is read once prompting with `foreach? ' (or prompt2) 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.
8 getspath (+) Prints the system execution path. (TCF only)
8 getxvers (+) Prints the experimental version prefix. (TCF only)
8 glob wordlist Like echo, but the `-n' 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.
8 goto word word is filename and command-substituted to yield a string of the form `label'. The shell rewinds its input as much as possible, searches for a line of the form `label:', possibly preceded by blanks or tabs, and continues execution after that line.
8 hashstat Prints a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding exec's). An exec is attempted for each component of the path where the hash function indicates a possible hit, and in each component which does not begin with a `/'.
On machines without vfork(2), prints only the number and size of hash buckets.history [-hTr] [n]
history -S|-L|-M [filename] (+)
0
8 history -c (+) The first form prints the history event list. If n is given only the n most recent events are printed or saved. With -h, the history list is printed without leading numbers. If -T is specified, timestamps are printed also in comment form. (This can be used to produce files suitable for loading with 'history -L' or 'source -h'.) With -r, the order of printing is most recent first rather than oldest first.
With -S, the second form saves the history list to filename. If the first word of the savehist shell variable is set to a number, at most that many lines are saved. If the second word of savehist is set to `merge', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp. (+) Merging is intended for an environment like the X Window System with several shells in simultaneous use. Currently it succeeds only when the shells quit nicely one after another.
With -L, the shell appends filename, which is presumably a history list saved by the -S option or the savehist mechanism, to the history list. -M is like -L, but the contents of filename are merged into the history list and sorted by timestamp. In either case, histfile is used if filename is not given and ~/.history is used if histfile is unset. `history -L' is exactly like 'source -h' except that it does not require a filename.
Note that login shells do the equivalent of `history -L' on startup and, if savehist is set, `history -S' before exiting. Because only ~/.tcshrc is normally sourced before ~/.history, histfile should be set in ~/.tcshrc rather than ~/.login.
If histlit is set, the first and second forms print and save the literal (unexpanded) form of the history list.
The last form clears the history list.
8 hup [command] (+) With command, runs command 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 hup. Without an argument, causes the non-interactive shell only to exit on a hangup for the remainder of the script. See also Signal handling and the nohup builtin command.
8 if (expr) command If expr (an expression, as described under Expressions) evaluates true, then command is executed. Variable substitution on command happens early, at the same time it does for the rest of the if command. 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 expr is false and command is thus not executed; this is a bug.
if (expr) then
...
else if (expr2) then
...
else
...
0
8 endif If the specified expr is true then the commands to the first else are executed; otherwise if expr2 is true then the commands to the second else are executed, etc. Any number of else-if pairs are possible; only one endif is needed. The else part is likewise optional. (The words else and endif must appear at the beginning of input lines; the if must appear alone on its input line or after an else.)
8 inlib shared-library ... (+) Adds each shared-library to the current environment. There is no way to remove a shared library. (Domain/OS only)
8 jobs [-l] Lists the active jobs. With -l, lists process IDs in addition to the normal information. On TCF systems, prints the site on which each job is executing.
0
8 kill [-s signal] %job|pid ...
0
8 kill -l The first and second forms sends the specified signal (or, if none is given, the TERM (terminate) signal) to the specified jobs or processes. job may be a number, a string, `', `%', `+' or `-' as described under Jobs. Signals are either given by number or by name (as given in /usr/include/signal.h, stripped of the prefix `SIG'). There is no default job; saying just `kill' does not send a signal to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process is sent a CONT (continue) signal as well. The third form lists the signal names.
8 limit [-h] [resource [maximum-use]] Limits the consumption by the current process and each process it creates to not individually exceed maximum-use on the specified resource. If no maximum-use is given, then the current limit is printed; if no resource is given, then all limitations are given. If the -h 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 resources currently include (if supported by the OS):
cputime the maximum number of cpu-seconds to be used by each process
filesize the largest single file which can be created
datasize the maximum growth of the data+stack region via sbrk(2) beyond the end of the program text
stacksize the maximum size of the automatically-extended stack region
coredumpsize the size of the largest core dump that will be created
memoryuse the maximum amount of physical memory a process may have allocated to it at a given time
vmemoryuse the maximum amount of virtual memory a process may have allocated to it at a given time (address space)
vmemoryuse the maximum amount of virtual memory a process may have allocated to it at a given time
heapsize the maximum amount of memory a process may allocate per brk() system call
descriptors or openfiles the maximum number of open files for this process
concurrency the maximum number of threads for this process
memorylocked the maximum size which a process may lock into memory using mlock(2)
maxproc the maximum number of simultaneous processes for this user id
sbsize the maximum size of socket buffer usage for this user
swapsize the maximum amount of swap space reserved or used for this user
maxlocks the maximum number of locks for this user
maxsignal the maximum number of pending signals for this user
maxmessage the maximum number of bytes in POSIX mqueues for this user
maxnice the maximum nice priority the user is allowed to raise mapped from [19...-20] to [0...39] for this user
maxrtprio the maximum realtime priority for this user maxrttime the timeout for RT tasks in microseconds for this user.
maximum-use may be given as a (floating point or integer) number followed by a scale factor. For all limits other than cputime the default scale is `k' or `kilobytes' (1024 bytes); a scale factor of `m' or `megabytes' or `g' or `gigabytes' may also be used. For cputime the default scaling is `seconds', while `m' for minutes or `h' for hours, or a time of the form `mm:ss' giving minutes and seconds may be used.
If maximum-use is `unlimited', then the limitation on the specified resource is removed (this is equivalent to the unlimit builtin command).
For both resource names and scale factors, unambiguous prefixes of the names suffice.
8 log (+) Prints the watch shell variable and reports on each user indicated in watch who is logged in, regardless of when they last logged in. See also watchlog.
8 login Terminates a login shell, replacing it with an instance of /bin/login. This is one way to log off, included for compatibility with sh(1).
8 logout Terminates a login shell. Especially useful if ignoreeof is set.
8 ls-F [-switch ...] [file ...] (+) Lists files like `ls -F', but much faster. It identifies each type of special file in the listing with a special character:
0
4 / Directory
4 * Executable
4 # Block device
4 % Character device
4 | Named pipe (systems with named pipes only)
4 = Socket (systems with sockets only)
4 @ Symbolic link (systems with symbolic links only)
4 + Hidden directory (AIX only) or context dependent (HP/UX only)
4 : Network special (HP/UX only)
If the listlinks shell variable is set, symbolic links are identified in more detail (on only systems that have them, of course):
0
4 @ Symbolic link to a non-directory
4 > Symbolic link to a directory
4 & Symbolic link to nowhere
listlinks also slows down ls-F and causes partitions holding files pointed to by symbolic links to be mounted.
If the listflags shell variable is set to `x', `a' or `A', or any combination thereof (e.g., `xA'), they are used as flags to ls-F, making it act like `ls -xF', `ls -Fa', `ls -FA' or a combination (e.g., `ls -FxA'). On machines where `ls -C' is not the default, ls-F acts like `ls -CF', unless listflags contains an `x', in which case it acts like `ls -xF'. ls-F passes its arguments to ls(1) if it is given any switches, so `alias ls ls-F' generally does the right thing.
The ls-F builtin can list files using different colors depending on the filetype or extension. See the color shell variable and the LS_COLORS environment variable.
migrate [-site] pid|%jobid ... (+)
0
8 migrate -site (+) The first form migrates the process or job to the site specified or the default site determined by the system path. The second form is equivalent to `migrate -site $$': 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)
8 newgrp [-] [group] (+) Equivalent to `exec newgrp'; see newgrp(1). Available only if the shell was so compiled; see the version shell variable.
8 nice [+number] [command] Sets the scheduling priority for the shell to number, or, without number, to 4. With command, runs command at the appropriate priority. The greater the number, the less cpu the process gets. The super-user may specify negative priority by using `nice -number ...'. Command is always executed in a sub-shell, and the restrictions placed on commands in simple if statements apply.
8 nohup [command] With command, runs command such that it will ignore hangup signals. Note that commands may set their own response to hangups, overriding nohup. Without an argument, causes the non-interactive shell only to ignore hangups for the remainder of the script. See also Signal handling and the hup builtin command.
8 notify [%job ...] Causes the shell to notify the user asynchronously when the status of any of the specified jobs (or, without %job, the current job) changes, instead of waiting until the next prompt as is usual. job may be a number, a string, `', `%', `+' or `-' as described under Jobs. See also the notify shell variable.
8 onintr [-|label] 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 label, causes the shell to execute a `goto label' when an interrupt is received or a child process terminates because it was interrupted.
8 popd [-p] [-l] [-n|-v] [+n] Without arguments, pops the directory stack and returns to the new top directory. With a number `+n', discards the n'th entry in the stack.
8 printenv [name] (+) Prints the names and values of all environment variables or, with name, the value of the environment variable name.
8 pushd [-p] [-l] [-n|-v] [name|+n] Without arguments, exchanges the top two elements of the directory stack. If pushdtohome is set, pushd without arguments does `pushd ~', like cd. (+) With name, pushes the current working directory onto the directory stack and changes to name. If name is `-' it is interpreted as the previous working directory (see Filename substitution). (+) If dunique is set, pushd removes any instances of name from the stack before pushing it onto the stack. (+) With a number `+n', rotates the nth element of the directory stack around to be the top element and changes to it. If dextract is set, however, `pushd +n' extracts the nth directory, pushes it onto the top of the stack and changes to it. (+)
8 rehash Causes the internal hash table of the contents of the directories in the path variable to be recomputed. This is needed if the autorehash shell variable is not set and new commands are added to directories in path while you are logged in. With autorehash, 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.
8 repeat count command The specified command, which is subject to the same restrictions as the command in the one line if statement above, is executed count times. I/O redirections occur exactly once, even if count is 0.
8 rootnode //nodename (+) Changes the rootnode to //nodename, so that `/' will be interpreted as `//nodename'. (Domain/OS only)
sched (+)
sched [+]hh:mm command (+)
0
8 sched -n (+) The first form prints the scheduled-event list. The sched shell variable may be set to define the format in which the scheduled-event list is printed. The second form adds command to the scheduled-event list. For example,
causes the shell to echo `It's eleven o'clock.' at 11 AM. The time may be in 12-hour AM/PM format
or may be relative to the current time:
A relative time specification may not use AM/PM format. The third form removes item n from the event list:
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 at(1) command on some Unix systems. Its major disadvantage is that it may not run a command at exactly the specified time. Its major advantage is that because sched 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.
set
set name ...
set name=word ...
set [-r] [-f|-l] name=(wordlist) ... (+)
set name[index]=word ...
set -r (+)
set -r name ... (+)
0
8 set -r name=word ... (+) 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 name to the null string. The third form sets name to the single word. The fourth form sets name to the list of words in wordlist. In all cases the value is command and filename expanded. If -r is specified, the value is set read-only. If -f or -l are specified, set only unique words keeping their order. -f prefers the first occurrence of a word, and -l the last. The fifth form sets the index'th component of name to word; this component must already exist. The sixth form lists only the names of all shell variables that are read-only. The seventh form makes name read-only, whether or not it has a value. The eighth form is the same as the third form, but make name read-only at the same time.
8 setenv [name [value]] Without arguments, prints the names and values of all environment variables. Given name, sets the environment variable name to value or, without value, to the null string.
8 setpath path (+) Equivalent to setpath(1). (Mach only)
8 setspath LOCAL|site|cpu ... (+) Sets the system execution path. (TCF only)
8 settc cap value (+) Tells the shell to believe that the terminal capability cap (as defined in termcap(5)) has the value value. No sanity checking is done. Concept terminal users may have to `settc xn no' to get proper wrapping at the rightmost column.
8 setty [-d|-q|-x] [-a] [[+|-]mode] (+) Controls which tty modes (see Terminal management) the shell does not allow to change. -d, -q or -x tells setty to act on the `edit', `quote' or `execute' set of tty modes respectively; without -d, -q or -x, `execute' is used.
8 setxvers [string] (+) Set the experimental version prefix to string, or removes it if string is omitted. (TCF only)
8 shift [variable] Without arguments, discards argv[1] and shifts the members of argv to the left. It is an error for argv not to be set or to have less than one word as value. With variable, performs the same function on variable.
8 source [-h] name [args ...] The shell reads and executes commands from name. The commands are not placed on the history list. If any args are given, they are placed in argv. (+) source commands may be nested; if they are nested too deeply the shell may run out of file descriptors. An error in a source at any level terminates all nested source commands. With -h, commands are placed on the history list instead of being executed, much like `history -L'.
8 stop %job|pid ... Stops the specified jobs or processes which are executing in the background. job may be a number, a string, `', `%', `+' or `-' as described under Jobs. There is no default job; saying just `stop' does not stop the current job.
8 suspend Causes the shell to stop in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su(1).
switch (string)
case str1:
0
breaksw
...
default:
breaksw
8 endsw Each case label is successively matched, against the specified string which is first command and filename expanded. The file metacharacters `*', `?' and `[...]' may be used in the case labels, which are variable expanded. If none of the labels match before a `default' label is found, then the execution begins after the default label. Each case label and the default label must appear at the beginning of a line. The command breaksw causes execution to continue after the endsw. 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 endsw.
8 telltc (+) Lists the values of all terminal capabilities (see termcap(5)).
8 termname [terminal type] (+) Tests if terminal type (or the current value of TERM if no terminal type is given) has an entry in the hosts termcap(5) or terminfo(5) database. Prints the terminal type to stdout and returns 0 if an entry is present otherwise returns 1.
8 time [command] Executes command (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 time variable. If necessary, an extra shell is created to print the time statistic when the command completes. Without command, prints a time summary for the current shell and its children.
8 umask [value] Sets the file creation mask to value, 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 value, prints the current file creation mask.
8 unalias pattern
Removes all aliases whose names match pattern. `unalias *' thus removes all aliases. It is not an error for nothing to be unaliased.
8 uncomplete pattern (+) Removes all completions whose names match pattern. `uncomplete *' thus removes all completions. It is not an error for nothing to be uncompleted.
8 unhash Disables use of the internal hash table to speed location of executed programs.
8 universe universe (+) Sets the universe to universe. (Masscomp/RTU only)
8 unlimit [-hf] [resource] Removes the limitation on resource or, if no resource is specified, all resource limitations. With -h, the corresponding hard limits are removed. Only the super-user may do this. Note that unlimit may not exit successful, since most systems do not allow descriptors to be unlimited. With -f errors are ignored.
8 unset pattern Removes all variables whose names match pattern, unless they are read-only. `unset *' thus removes all variables unless they are read-only; this is a bad idea. It is not an error for nothing to be unset.
8 unsetenv pattern Removes all environment variables whose names match pattern. `unsetenv *' thus removes all environment variables; this is a bad idea. It is not an error for nothing to be unsetenved.
8 ver [systype [command]] (+) Without arguments, prints SYSTYPE. With systype, sets SYSTYPE to systype. With systype and command, executes command under systype. systype may be `bsd4.3' or `sys5.3'. (Domain/OS only)
8 wait 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.
8 warp universe (+) Sets the universe to universe. (Convex/OS only)
8 watchlog (+) An alternate name for the log builtin command (q.v.). Available only if the shell was so compiled; see the version shell variable.
8 where command (+) Reports all known instances of command, including aliases, builtins and executables in path.
8 which command (+) Displays the command that will be executed by the shell after substitutions, path searching, etc. The builtin command is just like which(1), but it correctly reports tcsh aliases and builtins and is 10 to 100 times faster. See also the which-command editor command.
while (expr)
...
0
8 end Executes the commands between the while and the matching end while expr (an expression, as described under Expressions) evaluates non-zero. while and end must appear alone on their input lines. break and continue 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 foreach.
8 beepcmd Runs when the shell wants to ring the terminal bell.
8 cwdcmd Runs after every change of working directory. For example, if the user is working on an X window system using xterm(1) and a re-parenting window manager that supports title bars such as twm(1) and does
then the shell will change the title of the running xterm(1) to be the name of the host, a colon, and the full current working directory. A fancier way to do that is
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 cd, pushd or popd in cwdcmd may cause an infinite loop. It is the author's opinion that anyone doing so will get what they deserve.
8 jobcmd Runs before each command gets executed, or when the command changes state. This is similar to postcmd, but it does not print builtins.
then executing vi foo.c will put the command string in the xterm title bar.
8 helpcommand Invoked by the run-help editor command. The command name for which help is sought is passed as sole argument. For example, if one does
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 `-h'), except by using a table of many commands.
8 periodic Runs every tperiod minutes. This provides a convenient means for checking on common but infrequent changes such as new mail. For example, if one does
> alias periodic checknews
then the checknews(1) program runs every 30 minutes. If periodic is set but tperiod is unset or set to 0, periodic behaves like precmd.
8 precmd Runs just before each prompt is printed. For example, if one does
then date(1) runs just before the shell prompts for each command. There are no limits on what precmd can be set to do, but discretion should be used.
8 postcmd Runs before each command gets executed.
then executing vi foo.c will put the command string in the xterm title bar.
8 shell Specifies the interpreter for executable scripts which do not themselves specify an interpreter. The first word should be a full path name to the desired interpreter (e.g., `/bin/csh' or `/usr/local/bin/tcsh').
The shell sets addsuffix, argv, autologout, csubstnonl, command, echo_style, edit, gid, group, home, loginsh, oid, path, prompt, prompt2, prompt3, shell, shlvl, tcsh, term, tty, uid, user and version at startup; they do not change thereafter unless changed by the user. The shell updates cwd, dirstack, owd and status when necessary, and sets logout on logout.
The shell synchronizes group, home, path, shlvl, term and user 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 cwd and PWD have identical meanings, they are not synchronized in this manner, and that the shell automatically interconverts the different formats of path and PATH.
8 addsuffix (+) 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.
8 afsuser (+) If set, autologout's autolock feature uses its value instead of the local username for kerberos authentication.
8 ampm (+) If set, all times are shown in 12-hour AM/PM format.
8 argv The arguments to the shell. Positional parameters are taken from argv, i.e., `$1' is replaced by `$argv[1]', etc. Set by default, but usually empty in interactive shells.
8 autocorrect (+) If set, the spell-word editor command is invoked automatically before each completion attempt.
8 autoexpand (+) If set, the expand-history editor command is invoked automatically before each completion attempt. If this is set to onlyhistory, then only history will be expanded and a second completion will expand filenames.
8 autolist (+) If set, possibilities are listed after an ambiguous completion. If set to `ambiguous', possibilities are listed only when no new characters are added by completion.
8 autologout (+) 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 `auto-logout', sets the variable logout to `automatic' and exits. When the shell automatically locks, the user is required to enter his password to continue working. Five incorrect attempts result in automatic logout. Set to `60' (automatic logout after 60 minutes, and no locking) by default in login and superuser shells, but not if the shell thinks it is running under a window system (i.e., the DISPLAY environment variable is set), the tty is a pseudo-tty (pty) or the shell was not so compiled (see the version shell variable). See also the afsuser and logout shell variables.
8 autorehash (+) If set, the internal hash table of the contents of the directories in the path 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 `complete' or `correct' respectively; if set to `always', this will be done for both cases.
8 backslash_quote (+) If set, backslashes (`\\') always quote `\\', `'', and `"'. This may make complex quoting tasks easier, but it can cause syntax errors in csh(1) scripts.
8 catalog The file name of the message catalog. If set, tcsh use `tcsh.${catalog}' as a message catalog instead of default `tcsh'.
8 cdpath A list of directories in which cd should search for subdirectories if they aren't found in the current directory.
8 color If set, it enables color display for the builtin ls-F and it passes --color=auto to ls. Alternatively, it can be set to only ls-F or only ls to enable color to only one command. Setting it to nothing is equivalent to setting it to (ls-F ls).
8 colorcat If set, it enables color escape sequence for NLS message files. And display colorful NLS messages.
8 command (+) If set, the command which was passed to the shell with the -c flag (q.v.).
8 compat_expr (+) If set, the shell will evaluate expressions right to left, like the original csh.
8 complete (+) If set to `igncase', the completion becomes case insensitive. If set to `enhance', 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 `Enhance', completion matches uppercase and underscore characters explicitly and matches lowercase and hyphens in a case-insensivite manner; it will treat periods, hypens and underscores as word separators.
8 continue (+) If set to a list of commands, the shell will continue the listed commands, instead of starting a new one.
8 continue_args (+) Same as continue, but the shell will execute:
8 correct (+) If set to `cmd', commands are automatically spelling-corrected. If set to `complete', commands are automatically completed. If set to `all', the entire command line is corrected.
8 csubstnonl (+) If set, newlines and carriage returns in command substitution are replaced by spaces. Set by default.
8 cwd The full pathname of the current directory. See also the dirstack and owd shell variables.
8 dextract (+) If set, `pushd +n' extracts the nth directory from the directory stack rather than rotating it to the top.
8 dirsfile (+) The default location in which `dirs -S' and `dirs -L' look for a history file. If unset, ~/.cshdirs is used. Because only ~/.tcshrc is normally sourced before ~/.cshdirs, dirsfile should be set in ~/.tcshrc rather than ~/.login.
8 dirstack (+) An array of all the directories on the directory stack. `$dirstack[1]' is the current working directory, `$dirstack[2]' the first directory on the stack, etc. Note that the current working directory is `$dirstack[1]' but `=0' in directory stack substitutions, etc. One can change the stack arbitrarily by setting dirstack, but the first element (the current working directory) is always correct. See also the cwd and owd shell variables.
8 dspmbyte (+) Has an effect iff 'dspm' is listed as part of the version shell variable. If set to `euc', it enables display and editing EUC-kanji(Japanese) code. If set to `sjis', it enables display and editing Shift-JIS(Japanese) code. If set to `big5', it enables display and editing Big5(Chinese) code. If set to `utf8', it enables display and editing Utf8(Unicode) code. If set to the following format, it enables display and editing of original multi-byte code format:
The table requires just 256 bytes. Each character of 256 characters
corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff. Each
character
(position in this table?)
is set to number 0,1,2 and 3. Each number has the following meaning:
0 ... not used for multi-byte characters.
1 ... used for the first byte of a multi-byte character.
2 ... used for the second byte of a multi-byte character.
3 ... used for both the first byte and second byte of a multi-byte character.
SHK: I tried my best to get the following to be grammatically correct.
However, I still don't understand what's going on here. In the
following example, there are three bytes, but the text seems to refer to
each nybble as a character. What's going on here? It this 3-byte code
in the table? The text above seems to imply that there are 256
characters/bytes in the table. If I get some more info on this (perhaps
a complete example), I could fix the text to be grammatically correct.
(steve.kelem@xilinx.com 1999/09/13)
Example:
If set to `001322', the first character (means 0x00 of the ASCII code) and second character (means 0x01 of ASCII code) are set to `0'. Then, it is not used for multi-byte characters. The 3rd character (0x02) is set to '1', indicating that it is used for the first byte of a multi-byte character. The 4th character(0x03) is set '3'. It is used for both the first byte and the second byte of a multi-byte character. The 5th and 6th characters (0x04,0x05) are set to '2', indicating that they are used for the second byte of a multi-byte character.
The GNU fileutils version of ls cannot display multi-byte filenames without the -N ( --literal ) option. If you are using this version, set the second word of dspmbyte to "ls". If not, for example, "ls-F -l" cannot display multi-byte filenames.
Note:
This variable can only be used if KANJI and DSPMBYTE has been defined at compile time.
8 dunique (+) If set, pushd removes any instances of name from the stack before pushing it onto the stack.
8 echo 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 -x command line option.
8 echo_style (+) The style of the echo builtin. May be set to
0
8 bsd Don't echo a newline if the first argument is `-n'.
8 sysv Recognize backslashed escape sequences in echo strings.
8 both Recognize both the `-n' flag and backslashed escape sequences; the default.
8 none Recognize neither.
Set by default to the local system default. The BSD and System V options are described in the echo(1) man pages on the appropriate systems.
8 edit (+) If set, the command-line editor is used. Set by default in interactive shells.
8 ellipsis (+) If set, the `%c'/`%.' and `%C' prompt sequences (see the prompt shell variable) indicate skipped directories with an ellipsis (`...') instead of `/<skipped>'.
8 euid (+) The user's effective user ID.
8 euser (+) The first matching passwd entry name corresponding to the effective user ID.
8 fignore (+) Lists file name suffixes to be ignored by completion.
8 filec In tcsh, completion is always used and this variable is ignored by default. If edit is unset, then the traditional csh completion is used. If set in csh, filename completion is used.
8 gid (+) The user's real group ID.
8 globdot (+) If set, wild-card glob patterns will match files and directories beginning with `.' except for `.' and `..'
8 globstar (+) If set, the `**' and `***' file glob patterns will match any string of characters including `/' traversing any existing sub-directories. (e.g. `ls **.c' will list all the .c files in the current directory tree). If used by itself, it will match match zero or more sub-directories (e.g. `ls /usr/include/**/time.h' will list any file named `time.h' in the /usr/include directory tree; whereas `ls /usr/include/**time.h' will match any file in the /usr/include directory tree ending in `time.h'). To prevent problems with recursion, the `**' glob-pattern will not descend into a symbolic link containing a directory. To override this, use `***'
8 group (+) The user's group name.
8 highlight If set, the incremental search match (in i-search-back and i-search-fwd) and the region between the mark and the cursor are highlighted in reverse video.
8 histchars A string value determining the characters used in History substitution (q.v.). The first character of its value is used as the history substitution character, replacing the default character `!'. The second character of its value replaces the character `^' in quick substitutions.
8 histdup (+) Controls handling of duplicate entries in the history list. If set to `all' only unique history events are entered in the history list. If set to `prev' and the last history event is the same as the current command, then the current command is not entered in the history. If set to `erase' and the same event is found in the history list, that old event gets erased and the current one gets inserted. Note that the `prev' and `all' options renumber history events so there are no gaps.
8 histfile (+) The default location in which `history -S' and `history -L' look for a history file. If unset, ~/.history is used. histfile is useful when sharing the same home directory between different machines, or when saving separate histories on different terminals. Because only ~/.tcshrc is normally sourced before ~/.history, histfile should be set in ~/.tcshrc rather than ~/.login.
8 histlit (+) If set, builtin and editor commands and the savehist mechanism use the literal (unexpanded) form of lines in the history list. See also the toggle-literal-history editor command.
8 history The first word indicates the number of history events to save. The optional second word (+) indicates the format in which history is printed; if not given, `%h\\t%T\\t%R\\n' is used. The format sequences are described below under prompt; note the variable meaning of `%R'. Set to `100' by default.
8 home Initialized to the home directory of the invoker. The filename expansion of `~' refers to this variable.
8 ignoreeof If set to the empty string or `0' and the input device is a terminal, the end-of-file command (usually generated by the user by typing `^D' on an empty line) causes the shell to print `Use "exit" to leave tcsh.' instead of exiting. This prevents the shell from accidentally being killed. Historically this setting exited after 26 successive EOF's to avoid infinite loops. If set to a number n, the shell ignores n - 1 consecutive end-of-files and exits on the nth. (+) If unset, `1' is used, i.e., the shell exits on a single `^D'.
8 implicitcd (+) 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 verbose, 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.
8 inputmode (+) If set to `insert' or `overwrite', puts the editor into that input mode at the beginning of each line.
8 killdup (+) Controls handling of duplicate entries in the kill ring. If set to `all' only unique strings are entered in the kill ring. If set to `prev' 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 `erase' and the same string is found in the kill ring, the old string is erased and the current one is inserted.
8 killring (+) Indicates the number of killed strings to keep in memory. Set to `30' by default. If unset or set to less than `2', 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. backward-delete-word, kill-line, etc, as well as the copy-region-as-kill command. The yank editor command will yank the most recently killed string into the command-line, while yank-pop (see Editor commands) can be used to yank earlier killed strings.
8 listflags (+) If set to `x', `a' or `A', or any combination thereof (e.g., `xA'), they are used as flags to ls-F, making it act like `ls -xF', `ls -Fa', `ls -FA' or a combination (e.g., `ls -FxA'): `a' shows all files (even if they start with a `.'), `A' shows all files but `.' and `..', and `x' sorts across instead of down. If the second word of listflags is set, it is used as the path to `ls(1)'.
8 listjobs (+) If set, all jobs are listed when a job is suspended. If set to `long', the listing is in long format.
8 listlinks (+) If set, the ls-F builtin command shows the type of file to which each symbolic link points.
8 listmax (+) The maximum number of items which the list-choices editor command will list without asking first.
8 listmaxrows (+) The maximum number of rows of items which the list-choices editor command will list without asking first.
8 loginsh (+) Set by the shell if it is a login shell. Setting or unsetting it within a shell has no effect. See also shlvl.
8 logout (+) Set by the shell to `normal' before a normal logout, `automatic' before an automatic logout, and `hangup' if the shell was killed by a hangup signal (see Signal handling). See also the autologout shell variable.
8 mail 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 says `You have new mail.' (or, if mail contains multiple files, `You have new mail in name.') 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 mail is a directory, the shell will count each file within that directory as a separate message, and will report `You have n mails.' or `You have n mails in name.' 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 mail is numeric it is taken as a different mail checking interval, in seconds.
Under very rare circumstances, the shell may report `You have mail.' instead of `You have new mail.'
8 matchbeep (+) If set to `never', completion never beeps. If set to `nomatch', it beeps only when there is no match. If set to `ambiguous', it beeps when there are multiple matches. If set to `notunique', it beeps when there is one exact and other longer matches. If unset, `ambiguous' is used.
8 nobeep (+) If set, beeping is completely disabled. See also visiblebell.
8 noclobber 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 Input/output section.
8 noding If set, disable the printing of `DING!' in the prompt time specifiers at the change of hour.
8 noglob If set, Filename substitution and Directory stack substitution (q.v.) are inhibited. This is most useful in shell scripts which do not deal with filenames, or after a list of filenames has been obtained and further expansions are not desirable.
8 nokanji (+) If set and the shell supports Kanji (see the version shell variable), it is disabled so that the meta key can be used.
8 nonomatch If set, a Filename substitution or Directory stack substitution (q.v.) 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, e.g., `echo [' still gives an error.
8 nostat (+) A list of directories (or glob-patterns which match directories; see Filename substitution) that should not be stat(2)ed during a completion operation. This is usually used to exclude directories which take too much time to stat(2), for example /afs.
8 notify If set, the shell announces job completions asynchronously. The default is to present job completions just before printing a prompt.
8 oid (+) The user's real organization ID. (Domain/OS only)
8 owd (+) The old working directory, equivalent to the `-' used by cd and pushd. See also the cwd and dirstack shell variables.
8 padhour If set, enable the printing of padding '0' for hours, in 24 and 12 hour formats. E.G.: 07:45:42 vs. 7:45:42.
8 parseoctal To retain compatibily with older versions numeric variables starting with 0 are not interpreted as octal. Setting this variable enables proper octal parsing.
8 path A list of directories in which to look for executable commands. A null word specifies the current directory. If there is no path variable then only full path names will execute. path is set by the shell at startup from the PATH environment variable or, if PATH does not exist, to a system-dependent default something like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'. The shell may put `.' first or last in path or omit it entirely depending on how it was compiled; see the version shell variable. A shell which is given neither the -c nor the -t option hashes the contents of the directories in path after reading ~/.tcshrc and each time path is reset. If one adds a new command to a directory in path while the shell is active, one may need to do a rehash for the shell to find it.
8 printexitvalue (+) If set and an interactive program exits with a non-zero status, the shell prints `Exit status'.
8 prompt The string which is printed before reading each command from the terminal. prompt may include any of the following formatting sequences (+), which are replaced by the given information:
0
4 %/ The current working directory.
4 %~ The current working directory, but with one's home directory represented by `~' and other users' home directories represented by `~user' as per Filename substitution. `~user' substitution happens only if the shell has already used `~user' in a pathname in the current session.
4 %c[[0]n], %.[[0]n] The trailing component of the current working directory, or n trailing components if a digit n is given. If n begins with `0', the number of skipped components precede the trailing component(s) in the format `/<skipped>trailing'. If the ellipsis shell variable is set, skipped components are represented by an ellipsis so the whole becomes `...trailing'. `~' substitution is done as in `%~' above, but the `~' component is ignored when counting trailing components.
4 %C Like %c, but without `~' substitution.
4 %h, %!, ! The current history event number.
4 %M The full hostname.
4 %m The hostname up to the first `.'.
4 %S (%s) Start (stop) standout mode.
4 %B (%b) Start (stop) boldfacing mode.
4 %U (%u) Start (stop) underline mode.
4 %t, %@ The time of day in 12-hour AM/PM format.
4 %T Like `%t', but in 24-hour format (but see the ampm shell variable).
4 %p The `precise' time of day in 12-hour AM/PM format, with seconds.
4 %P Like `%p', but in 24-hour format (but see the ampm shell variable).
4 \ec c is parsed as in bindkey.
4 ^c c is parsed as in bindkey.
4 %% A single `%'.
4 %n The user name.
4 %N The effective user name.
4 %j The number of jobs.
4 %d The weekday in `Day' format.
4 %D The day in `dd' format.
4 %w The month in `Mon' format.
4 %W The month in `mm' format.
4 %y The year in `yy' format.
4 %Y The year in `yyyy' format.
4 %l The shell's tty.
4 %L Clears from the end of the prompt to end of the display or the end of the line.
4 %$ Expands the shell or environment variable name immediately after the `$'.
4 %# `>' (or the first character of the promptchars shell variable) for normal users, `#' (or the second character of promptchars) for the superuser.
4 %{string%} Includes string 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 prompt.
4 %? The return code of the command executed just before the prompt.
4 %R In prompt2, the status of the parser. In prompt3, the corrected string. In history, the history string.
`%B', `%S', `%U' and `%{string%}' are available in only eight-bit-clean shells; see the version shell variable.
The bold, standout and underline sequences are often used to distinguish a superuser shell. For example,
tut [37] [2:54pm] [/usr/accts/sys] you rang? _
If `%t', `%@', `%T', `%p', or `%P' is used, and noding is not set, then print `DING!' on the change of hour (i.e, `:00' minutes) instead of the actual time.
Set by default to `%# ' in interactive shells.
8 prompt2 (+) The string with which to prompt in while and foreach loops and after lines ending in `\\'. The same format sequences may be used as in prompt (q.v.); note the variable meaning of `%R'. Set by default to `%R? ' in interactive shells.
8 prompt3 (+) The string with which to prompt when confirming automatic spelling correction. The same format sequences may be used as in prompt (q.v.); note the variable meaning of `%R'. Set by default to `CORRECT>%R (y|n|e|a)? ' in interactive shells.
8 promptchars (+) If set (to a two-character string), the `%#' formatting sequence in the prompt shell variable is replaced with the first character for normal users and the second character for the superuser.
8 pushdtohome (+) If set, pushd without arguments does `pushd ~', like cd.
8 pushdsilent (+) If set, pushd and popd do not print the directory stack.
8 recexact (+) If set, completion completes on an exact match even if a longer match is possible.
8 recognize_only_executables (+) If set, command listing displays only files in the path that are executable. Slow.
8 rmstar (+) If set, the user is prompted before `rm *' is executed.
8 rprompt (+) 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 prompt. 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 edit isn't set, then rprompt will be printed after the prompt and before the command input.
8 savedirs (+) If set, the shell does `dirs -S' before exiting. If the first word is set to a number, at most that many directory stack entries are saved.
8 savehist If set, the shell does `history -S' before exiting. If the first word is set to a number, at most that many lines are saved. (The number must be less than or equal to history.) If the second word is set to `merge', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp and the most recent events are retained. (+)
8 sched (+) The format in which the sched builtin command prints scheduled events; if not given, `%h\\t%T\\t%R\\n' is used. The format sequences are described above under prompt; note the variable meaning of `%R'.
8 shell 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 Builtin and non-builtin command execution.) Initialized to the (system-dependent) home of the shell.
8 shlvl (+) The number of nested shells. Reset to 1 in login shells. See also loginsh.
8 status The status returned by the last command, unless the variable anyerror is set, and any error in a pipeline or a backquote expansion will be propagated (this is the default csh behavior, and the current tcsh default). If it terminated abnormally, then 0200 is added to the status. Builtin commands which fail return exit status `1', all other builtin commands return status `0'.
8 symlinks (+) Can be set to several different values to control symbolic link (`symlink') resolution:
If set to `chase', whenever the current directory changes to a directory containing a symbolic link, it is expanded to the real name of the directory to which the link points. This does not work for the user's home directory; this is a bug.
If set to `ignore', the shell tries to construct a current directory relative to the current directory before the link was crossed. This means that cding through a symbolic link and then `cd ..'ing returns one to the original directory. This affects only builtin commands and filename completion.
If set to `expand', 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 `ignore' and use the editor command normalize-path (bound by default to ^X-n) when necessary.
Some examples are in order. First, let's set up some play directories:
Here's the behavior with symlinks unset,
> cd ..; echo $cwd
here's the behavior with symlinks set to `chase',
> cd ..; echo $cwd
here's the behavior with symlinks set to `ignore',
> cd ..; echo $cwd
and here's the behavior with symlinks set to `expand'.
> cd ..; echo $cwd
> cd ".."; echo $cwd
..
Note that `expand' expansion 1) works just like `ignore' for builtins like cd, 2) is prevented by quoting, and 3) happens before filenames are passed to non-builtin commands.
8 tcsh (+) The version number of the shell in the format `R.VV.PP', where `R' is the major release number, `VV' the current version and `PP' the patchlevel.
8 term The terminal type. Usually set in ~/.login as described under Startup and shutdown.
8 time If set to a number, then the time builtin (q.v.) executes automatically after each command which takes more than that many CPU seconds. If there is a second word, it is used as a format string for the output of the time builtin. (u) The following sequences may be used in the format string:
0
4 %U The time the process spent in user mode in cpu seconds.
4 %S The time the process spent in kernel mode in cpu seconds.
4 %E The elapsed (wall clock) time in seconds.
4 %P The CPU percentage computed as (%U + %S) / %E.
4 %W Number of times the process was swapped.
4 %X The average amount in (shared) text space used in Kbytes.
4 %D The average amount in (unshared) data/stack space used in Kbytes.
4 %K The total space used (%X + %D) in Kbytes.
4 %M The maximum memory the process had in use at any time in Kbytes.
4 %F The number of major page faults (page needed to be brought from disk).
4 %R The number of minor page faults.
4 %I The number of input operations.
4 %O The number of output operations.
4 %r The number of socket messages received.
4 %s The number of socket messages sent.
4 %k The number of signals received.
4 %w The number of voluntary context switches (waits).
4 %c The number of involuntary context switches.
Only the first four sequences are supported on systems without BSD resource limit functions. The default time format is `%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww' for systems that support resource usage reporting and `%Uu %Ss %E %P' for systems that do not.
Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not available, but the following additional sequences are:
0
4 %Y The number of system calls performed.
4 %Z The number of pages which are zero-filled on demand.
4 %i The number of times a process's resident set size was increased by the kernel.
4 %d The number of times a process's resident set size was decreased by the kernel.
4 %l The number of read system calls performed.
4 %m The number of write system calls performed.
4 %p The number of reads from raw disk devices.
4 %q The number of writes to raw disk devices.
and the default time format is `%Uu %Ss %E %P %I+%Oio %Fpf+%Ww'. Note that the CPU percentage can be higher than 100% on multi-processors.
8 tperiod (+) The period, in minutes, between executions of the periodic special alias.
8 tty (+) The name of the tty, or empty if not attached to one.
8 uid (+) The user's real user ID.
8 user The user's login name.
8 verbose If set, causes the words of each command to be printed, after history substitution (if any). Set by the -v command line option.
8 version (+) The version ID stamp. It contains the shell's version number (see tcsh), origin, release date, vendor, operating system and machine (see VENDOR, OSTYPE and MACHTYPE) and a comma-separated list of options which were set at compile time. Options which are set by default in the distribution are noted.
0
6 8b The shell is eight bit clean; default
6 7b The shell is not eight bit clean
6 wide The shell is multibyte encoding clean (like UTF-8)
6 nls The system's NLS is used; default for systems with NLS
6 lf Login shells execute /etc/csh.login before instead of after /etc/csh.cshrc and ~/.login before instead of after ~/.tcshrc and ~/.history.
6 dl `.' is put last in path for security; default
6 nd `.' is omitted from path for security
6 vi vi-style editing is the default rather than emacs
6 dtr Login shells drop DTR when exiting
6 bye bye is a synonym for logout and log is an alternate name for watchlog
6 al autologout is enabled; default
6 kan Kanji is used if appropriate according to locale settings, unless the nokanji shell variable is set
6 sm The system's malloc(3) is used
6 hb The `#!<program> <args>' convention is emulated when executing shell scripts
6 ng The newgrp builtin is available
6 rh The shell attempts to set the REMOTEHOST environment variable
6 afs The shell verifies your password with the kerberos server if local authentication fails. The afsuser shell variable or the AFSUSER environment variable override your local username if set.
An administrator may enter additional strings to indicate differences in the local version.
8 visiblebell (+) If set, a screen flash is used rather than the audible bell. See also nobeep.
8 watch (+) A list of user/terminal pairs to watch for logins and logouts. If either the user is `any' all terminals are watched for the given user and vice versa. Setting watch to `(any any)' watches all users and terminals. For example,
reports activity of the user `george' on ttyd1, 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 watch can be set to a number to check every so many minutes. For example,
reports any login/logout once every minute. For the impatient, the log builtin command triggers a watch report at any time. All current logins are reported (as with the log builtin) when watch is first set.
The who shell variable controls the format of watch reports.
8 who (+) The format string for watch messages. The following sequences are replaced by the given information:
0
4 %n The name of the user who logged in/out.
4 %a The observed action, i.e., `logged on', `logged off' or `replaced olduser on'.
4 %l The terminal (tty) on which the user logged in/out.
4 %M The full hostname of the remote host, or `local' if the login/logout was from the local host.
4 %m The hostname of the remote host up to the first `.'. The full name is printed if it is an IP address or an X Window System display.
%M and %m are available on only systems that store the remote hostname in /etc/utmp. If unset, `%n has %a %l from %m.' is used, or `%n has %a %l.' on systems which don't store the remote hostname.
8 wordchars (+) A list of non-alphanumeric characters to be considered part of a word by the forward-word, backward-word etc., editor commands. If unset, `*?_-.[]~=' is used.
8 AFSUSER (+) Equivalent to the afsuser shell variable.
8 COLUMNS The number of columns in the terminal. See Terminal management.
8 DISPLAY Used by X Window System (see X(1)). If set, the shell does not set autologout (q.v.).
8 EDITOR The pathname to a default editor. See also the VISUAL environment variable and the run-fg-editor editor command.
8 GROUP (+) Equivalent to the group shell variable.
8 HOME Equivalent to the home shell variable.
8 HOST (+) Initialized to the name of the machine on which the shell is running, as determined by the gethostname(2) system call.
8 HOSTTYPE (+) 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.
8 HPATH (+) A colon-separated list of directories in which the run-help editor command looks for command documentation.
8 LANG Gives the preferred character environment. See Native Language System support.
8 LC_CTYPE If set, only ctype character handling is changed. See Native Language System support.
8 LINES The number of lines in the terminal. See Terminal management.
8 LS_COLORS The format of this variable is reminiscent of the termcap(5) file format; a colon-separated list of expressions of the form "xx=string", where "xx" is a two-character variable name. The variables with their associated defaults are:
0
12 no 0 Normal (non-filename) text
12 fi 0 Regular file
12 di 01;34 Directory
12 ln 01;36 Symbolic link
12 pi 33 Named pipe (FIFO)
12 so 01;35 Socket
12 do 01;35 Door
12 bd 01;33 Block device
12 cd 01;32 Character device
12 ex 01;32 Executable file
12 mi (none) Missing file (defaults to fi)
12 or (none) Orphaned symbolic link (defaults to ln)
12 lc ^[[ Left code
12 rc m Right code
12 ec (none) End code (replaces lc+no+rc)
You need to include only the variables you want to change from the default.
File names can also be colorized based on filename extension. This is specified in the LS_COLORS variable using the syntax "*ext=string". For example, using ISO 6429 codes, to color all C-language source files blue you would specify "*.c=34". This would color all files ending in .c in blue (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 file will be written as <lc> <color-code> <rc> <filename> <ec>. If the <ec> code is undefined, the sequence <lc> <no> <rc> will be used instead. This is generally more convenient to use, but less general. The left, right and end codes are provided so you don't have to type 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 sequences but a different system.
If your terminal does use ISO 6429 color codes, you can compose the type codes (i.e., all except the lc, rc, and ec codes) from numerical commands separated by semicolons. The most common commands are:
0
4 0 to restore default color
4 1 for brighter colors
4 4 for underlined text
4 5 for flashing text
4 30 for black foreground
4 31 for red foreground
4 32 for green foreground
4 33 for yellow (or brown) foreground
4 34 for blue foreground
4 35 for purple foreground
4 36 for cyan foreground
4 37 for white (or gray) foreground
4 40 for black background
4 41 for red background
4 42 for green background
4 43 for yellow (or brown) background
4 44 for blue background
4 45 for purple background
4 46 for cyan background
4 47 for white (or gray) background
Not all commands 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 no and fi codes from 0 to the numerical codes for your standard fore- and background colors.
8 MACHTYPE (+) The machine type (microprocessor class or machine model), as determined at compile time.
8 NOREBIND (+) If set, printable characters are not rebound to self-insert-command. See Native Language System support.
8 OSTYPE (+) The operating system, as determined at compile time.
8 PATH A colon-separated list of directories in which to look for executables. Equivalent to the path shell variable, but in a different format.
8 PWD (+) Equivalent to the cwd shell variable, but not synchronized to it; updated only after an actual directory change.
8 REMOTEHOST (+) 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 version shell variable.
8 SHLVL (+) Equivalent to the shlvl shell variable.
8 SYSTYPE (+) The current system type. (Domain/OS only)
8 TERM Equivalent to the term shell variable.
8 TERMCAP The terminal capability string. See Terminal management.
8 USER Equivalent to the user shell variable.
8 VENDOR (+) The vendor, as determined at compile time.
8 VISUAL The pathname to a default full-screen editor. See also the EDITOR environment variable and the run-fg-editor editor command.
0
16 /etc/csh.cshrc Read first by every shell. ConvexOS, Stellix and Intel use /etc/cshrc and NeXTs use /etc/cshrc.std. A/UX, AMIX, Cray and IRIX have no equivalent in csh(1), but read this file in tcsh anyway. Solaris 2.x does not have it either, but tcsh reads /etc/.cshrc. (+)
16 /etc/csh.login Read by login shells after /etc/csh.cshrc. ConvexOS, Stellix and Intel use /etc/login, NeXTs use /etc/login.std, Solaris 2.x uses /etc/.login and A/UX, AMIX, Cray and IRIX use /etc/cshrc.
16 ~/.tcshrc (+) Read by every shell after /etc/csh.cshrc or its equivalent.
16 ~/.cshrc Read by every shell, if ~/.tcshrc doesn't exist, after /etc/csh.cshrc or its equivalent. This manual uses `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is not found, ~/.cshrc'.
16 ~/.history Read by login shells after ~/.tcshrc if savehist is set, but see also histfile.
16 ~/.login Read by login shells after ~/.tcshrc or ~/.history. The shell may be compiled to read ~/.login before instead of after ~/.tcshrc and ~/.history; see the version shell variable.
16 ~/.cshdirs (+) Read by login shells after ~/.login if savedirs is set, but see also dirsfile.
16 /etc/csh.logout Read by login shells at logout. ConvexOS, Stellix and Intel use /etc/logout and NeXTs use /etc/logout.std. A/UX, AMIX, Cray and IRIX have no equivalent in csh(1), but read this file in tcsh anyway. Solaris 2.x does not have it either, but tcsh reads /etc/.logout. (+)
16 ~/.logout Read by login shells at logout after /etc/csh.logout or its equivalent.
16 /bin/sh Used to interpret shell scripts not starting with a `#'.
16 /tmp/sh* Temporary file for `<<'.
16 /etc/passwd Source of home directories for `~name' substitutions.
The order in which startup files are read may differ if the shell was so compiled; see Startup and shutdown and the version shell variable.
A command-line editor, which supports GNU Emacs or vi(1)-style key bindings. See The command-line editor and Editor commands.
Programmable, interactive word completion and listing. See Completion and listing and the complete and uncomplete builtin commands.
Spelling correction (q.v.) of filenames, commands and variables.
Editor commands (q.v.) which perform other useful functions in the middle of typed commands, including documentation lookup (run-help), quick editor restarting (run-fg-editor) and command resolution (which-command).
An enhanced history mechanism. Events in the history list are time-stamped. See also the history command and its associated shell variables, the previously undocumented `#' event specifier and new modifiers under History substitution, the *-history, history-search-*, i-search-*, vi-search-* and toggle-literal-history editor commands and the histlit shell variable.
Enhanced directory parsing and directory stack handling. See the cd, pushd, popd and dirs commands and their associated shell variables, the description of Directory stack substitution, the dirstack, owd and symlinks shell variables and the normalize-command and normalize-path editor commands.
Negation in glob-patterns. See Filename substitution.
New File inquiry operators (q.v.) and a filetest builtin which uses them.
A variety of Automatic, periodic and timed events (q.v.) including scheduled events, special aliases, automatic logout and terminal locking, command timing and watching for logins and logouts.
Support for the Native Language System (see Native Language System support), OS variant features (see OS variant support and the echo_style shell variable) and system-dependent file locations (see FILES).
Extensive terminal-management capabilities. See Terminal management.
New builtin commands including builtins, hup, ls-F, newgrp, printenv, which and where (q.v.).
New variables that make useful information easily available to the shell. See the gid, loginsh, oid, shlvl, tcsh, tty, uid and version shell variables and the HOST, REMOTEHOST, VENDOR, OSTYPE and MACHTYPE environment variables.
A new syntax for including useful information in the prompt string (see prompt), and special prompts for loops and spelling correction (see prompt2 and prompt3).
Read-only variables. See Variable substitution.
Shell builtin functions are not stoppable/restartable. Command sequences of the form `a ; b ; c' are also not handled gracefully when stopping is attempted. If you suspend `b', the shell will then immediately execute `c'. This is especially noticeable if this expansion results from an alias. It suffices to place the sequence of commands in ()'s to force it to a subshell, i.e., `( a ; b ; c )'.
Control over tty output after processes are started is primitive; perhaps this will inspire someone to work on a good virtual terminal interface. In a virtual terminal interface much more interesting things could be done with output control.
Alias substitution is most often used to clumsily simulate shell procedures; shell procedures should be provided rather than aliases.
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.
foreach doesn't ignore here documents when looking for its end.
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 `dumb').
HPATH and NOREBIND 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 if does output redirection even if the expression is false and the command is not executed.
ls-F 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 gotos.
Report bugs at http://bugs.gw.com/, preferably with fixes. If you want to help maintain and test tcsh, send mail to tcsh-request@mx.gw.com with the text `subscribe tcsh' on a line by itself in the body.
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 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 alias substitutions on a single line to 20.
0
2 William Joy Original author of csh(1)
2 J.E. Kulp, IIASA, Laxenburg, Austria Job control and directory stack features
2 Ken Greer, HP Labs, 1981 File name completion
2 Mike Ellis, Fairchild, 1983 Command name recognition/completion
2 Paul Placeway, Ohio State CIS Dept., 1983-1993 Command line editor, prompt routines, new glob syntax and numerous fixes and speedups
2 Karl Kleinpaste, CCI 1983-4 Special aliases, directory stack extraction stuff, login/logout watch, scheduled events, and the idea of the new prompt format
2 Rayan Zachariassen, University of Toronto, 1984 ls-F and which builtins and numerous bug fixes, modifications and speedups
2 Chris Kingsley, Caltech Fast storage allocator routines
2 Chris Grevstad, TRW, 1987 Incorporated 4.3BSD csh into tcsh
2 Christos S. Zoulas, Cornell U. EE Dept., 1987-94 Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support and a new version of sh.glob.c
2 James J Dempsey, BBN, and Paul Placeway, OSU, 1988 A/UX port
2 Daniel Long, NNSC, 1988 wordchars
2 Patrick Wolfe, Kuck and Associates, Inc., 1988 vi mode cleanup
2 David C Lawrence, Rensselaer Polytechnic Institute, 1989 autolist and ambiguous completion listing
2 Alec Wolman, DEC, 1989 Newlines in the prompt
2 Matt Landau, BBN, 1989 ~/.tcshrc
2 Ray Moody, Purdue Physics, 1989 Magic space bar history expansion
2 Mordechai ????, Intel, 1989 printprompt() fixes and additions
2 Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989 Automatic spelling correction and prompt3
2 Per Hedeland, Ellemtel, Sweden, 1990- Various bugfixes, improvements and manual updates
2 Hans J. Albertsson (Sun Sweden) ampm, settc and telltc
2 Michael Bloom Interrupt handling fixes
2 Michael Fine, Digital Equipment Corp Extended key support
2 Eric Schnoebelen, Convex, 1990 Convex support, lots of csh bug fixes, save and restore of directory stack
2 Ron Flax, Apple, 1990 A/UX 2.0 (re)port
2 Dan Oscarsson, LTH Sweden, 1990 NLS support and simulated NLS support for non NLS sites, fixes
2 Johan Widen, SICS Sweden, 1990 shlvl, Mach support, correct-line, 8-bit printing
2 Matt Day, Sanyo Icon, 1990 POSIX termio support, SysV limit fixes
2 Jaap Vermeulen, Sequent, 1990-91 Vi mode fixes, expand-line, window change fixes, Symmetry port
2 Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991 autolist beeping options, modified the history search to search for the whole string from the beginning of the line to the cursor.
2 Scott Krotz, Motorola, 1991 Minix port
2 David Dawes, Sydney U. Australia, Physics Dept., 1991 SVR4 job control fixes
2 Jose Sousa, Interactive Systems Corp., 1991 Extended vi fixes and vi delete command
2 Marc Horowitz, MIT, 1991 ANSIfication fixes, new exec hashing code, imake fixes, where
2 Bruce Sterling Woodcock, sterling@netcom.com, 1991-1995 ETA and Pyramid port, Makefile and lint fixes, ignoreeof=n addition, and various other portability changes and bug fixes
2 Jeff Fink, 1992 complete-word-fwd and complete-word-back
2 Harry C. Pulley, 1992 Coherent port
2 Andy Phillips, Mullard Space Science Lab U.K., 1992 VMS-POSIX port
2 Beto Appleton, IBM Corp., 1992 Walking process group fixes, csh bug fixes, POSIX file tests, POSIX SIGHUP
2 Scott Bolte, Cray Computer Corp., 1992 CSOS port
2 Kaveh R. Ghazi, Rutgers University, 1992 Tek, m88k, Titan and Masscomp ports and fixes. Added autoconf support.
2 Mark Linderman, Cornell University, 1992 OS/2 port
2 Mika Liljeberg, liljeber@kruuna.Helsinki.FI, 1992 Linux port
2 Tim P. Starrin, NASA Langley Research Center Operations, 1993 Read-only variables
2 Dave Schweisguth, Yale University, 1993-4 New man page and tcsh.man2html
2 Larry Schwimmer, Stanford University, 1993 AFS and HESIOD patches
2 Luke Mewburn, RMIT University, 1994-6 Enhanced directory printing in prompt, added ellipsis and rprompt.
2 Edward Hutchins, Silicon Graphics Inc., 1996 Added implicit cd.
2 Martin Kraemer, 1997 Ported to Siemens Nixdorf EBCDIC machine
2 Amol Deshpande, Microsoft, 1997 Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library and message catalog code to interface to Windows.
2 Taga Nayuta, 1998 Color ls additions.
All the people on the net, for putting up with, reporting bugs in, and suggesting new additions to each and every version
Richard M. Alderson III, for writing the `T in tcsh' section