The rest of the flag arguments are interpreted as follows:
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: Lk 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 before using -specific commands, or can have both a ~/.cshrc and a ~/.tcshrc which source s (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 Sx FILES .
The shell always binds the arrow keys (as defined in the TERMCAP environment variable) to editor commands:
unless doing so would alter another single-character binding. One can set the arrow key escape sequences to the empty string with 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(1) 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. Certain key bindings have different behavior depending if emacs(1) or vi(1) -style bindings are being used; see vimode for more information.
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 Sx Lexical structure .
ls /usr/lostand hit the tab key to run the complete-word editor command. The shell completes the filename /usr/lost to /usr/lost+found/ replacing the incomplete word with the complete word in the input buffer. (Note the terminal `/ ' completion adds a `/' to the end of completed directories and a space to the end of other completed words, to speed typing and provide a visual indicator of successful completion. The addsuffix shell variable can be unset to prevent this.) If no match is found (perhaps /usr/lost+found doesn't exist), the terminal bell rings. If the word is already complete (perhaps there is a /usr/lost on your system, or perhaps you were thinking too far ahead and typed the whole thing) a `/' or space is added to the end if it isn't already there.
Completion works anywhere in the line, not at just the end; completed text pushes the rest of the line to the right. Completion in the middle of a word often results in leftover characters to the right of the cursor that need to be deleted.
Commands and variables can be completed in much the same way. For example, typing
em[tab]would complete `em' to `emacs' if `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 and reprints the prompt and unfinished command line, for example:
> ls /usr/l[^D] 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:
> set autolist > nm /usr/lib/libt[tab] libtermcap.a@ libtermlib.a@ > nm /usr/lib/libterm
If the autolist shell variable 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 Sx Filename substitution ) and directory stack entries abbreviated with `=' (see Sx Directory stack substitution (+) ) . For example,
> ls ~k[^D] kahn kas kellogg > ls ~ke[tab] > ls ~kellogg/
or
> set local = /usr/local > ls $lo[tab] > ls $local/[^D] bin/ etc/ lib/ man/ src/ > ls $local/
Note that variables can also be expanded explicitly with the 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 the ignoreeof variable 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:
> ls Makefile condiments.h~ main.o side.c README main.c meal side.o condiments.h main.c~ > set fignore = (.o \~) > emacs ma[^D] main.c main.c~ main.o > emacs ma[tab] > emacs main.c
`main.c~' and `main.o' are ignored by completion (but not listing), because they end in suffixes in fignore Note that a `\' was needed in front of `~' to prevent it from being expanded to home as described under Sx 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 Po `.' , `-' , and `_' Pc to be word separators and hyphens and underscores to be equivalent. If you had the following files
comp.lang.c comp.lang.perl comp.std.c++ comp.lang.c++ comp.std.c
and typed
mail -f c.l.c[tab]it would be completed to
mail -f comp.lang.cand typing
mail -f c.l.c[^D]would list `comp.lang.c' and `comp.lang.c++'
Typing
mail -f c..c++[^D]would list `comp.lang.c++' and `comp.std.c++'
Typing
rm a--file[^D]in the following directory
A_silly_file a-hyphenated-file another_silly_file
would list all three files, because case is ignored and hyphens and underscores are equivalent. Periods, however, are not equivalent to hyphens or underscores.
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--filewould 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:
> ls fodder foo food foonly > set recexact > rm fo[tab]
just beeps, because `fo' could expand to `fod' or `foo' , but if we type another `o' ,
> rm foo[tab] > rm foo
the completion completes on `foo' , even though `food' and `foonly' also match. 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 Sx 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 Sx 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:
> set correct = cmd > lz /usr/bin CORRECT>ls /usr/bin (y|n|e|a)?
One can answer `y' or space to execute the corrected line, `e' to leave the uncorrected command in the input buffer, `a' to abort the command as if ^C had been hit, and 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.
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 (or ^ [ 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.
Supported editor commands are:
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:
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. See also i-search-fwd and history-search-backward Word boundary behavior modified by vimode
?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.
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 Sx Substitutions except Sx 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 Sx Variable substitution or Sx Command substitution respectively) with `\' Sx ( 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.) Sx History substitution is prevented by backslashes but not by single quotes. Strings quoted with double or backward quotes undergo Sx Variable substitution and Sx 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 Sx Command substitution ) can a double-quoted string yield parts of more than one word; single-quoted strings never do. Backward quotes are special: they signal Sx Command substitution , which may result in more than one word.
C-style escape sequences can be used in single quoted strings by preceding the leading quote with `$' (+) See Sx Escape sequences (+) for a complete list of recognized escape sequences.
Quoting complex strings, particularly strings which themselves contain quoting characters, can be confusing. Remember that quotes need not be used as they are in human writing! It may be easier to quote not an entire string, but only those parts of the string which need quoting, using different types of quoting to do so if appropriate.
The backslash_quote shell variable can be set to make backslashes always quote `\' , `'' , and `' (+). This may make complex quoting tasks easier, but it can cause syntax errors in csh(1) scripts.
Supported escape sequences are:
The implementations of `\x' , `\u' , and `\U' in other shells may take a varying number of digits. It is often safest to use leading zeros to provide the maximum expected number of digits.
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.
By default history entries are displayed by printing each parsed token separated by space; thus the redirection operator `>&!' will be displayed as `> & !' The shell actually saves history in expanded and literal (unexpanded) forms. If the 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 `^' ; see Sx History substitution abbreviation .
The characters used to signal history substitution Po `!' and `^' Pc 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'' (see Sx History event specification ) , which indicates the event from which words are to be taken, a ``word designator'' (see Sx History word designators ) , which selects particular words from the chosen event, and/or a ``word modifier'' (see Sx History word modifiers ) , which manipulates the selected words.
For example, consider this bit of someone's history list:
9 8:30 nroff -man wumpus.man 10 8:31 cp wumpus.man wumpus.man.old 11 8:36 vi wumpus.man 12 8:37 diff wumpus.man.old wumpus.man
The commands are shown with their event numbers and time stamps. The current event, which we haven't typed in yet, is event 13.
Typing
!11or
!-2refers to event 11.
Typing
!!refers to the previous event, 12. `!!' can be abbreviated `!' if it is followed by `:' , which is described in Sx History word designators and Sx History word modifiers .
Typing
!nrefers to event 9, which begins with `n'
Typing
!?old?refers to event 12, which contains `old'
Without word designators or modifiers history references simply expand to the entire event, so we might type
!cpto redo the `cp' command (event 10) or
!!|moreif the `diff' output in the previous event, 12, scrolled off the top of the screen.
History references may be insulated from the surrounding text with braces if necessary. For example,
!vdocwould look for a command beginning with `vdoc' , and, in this example, not find one, but
!{v}docwould expand unambiguously to `vi' wumpus.mandoc by matching event 11. Even in braces, history substitutions do not nest.
(+) While csh(1) expands, for example,
!3dto 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
!3das in csh(1) type
!{3}d
The basic word designators are, with columns for a leading `:' and a leading `!' (for the abbreviated word designators - see Sx History substitution abbreviation ) :
Selected words are inserted into the command line separated by single blanks.
For example, the `diff' command (event 12) in the history list example in Sx History event specification ,
diff wumpus.man.old wumpus.manmight have been typed as
diff !!:1.old !!:1(using `:1' to select the first argument from the previous event) or
diff !-2:2 !-2:1to select and swap the arguments from the `cp' command (event 10). If we didn't care about the order of the `diff' we might have typed
diff !-2:1-2or simply
diff !-2:*
The `cp' command (event 10) might have been typed
cp wumpus.man !#:1.oldusing `#' to refer to the current event.
Typing
!n:- hurkle.manwould reuse the first two words from the `nroff' command (event 9) to expand to
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 (event 12) might have been typed
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' command example (event 12), we could have typed simply
diff !^.old !^or, to get the arguments in the opposite order, just
diff !*
> set args=('arg 1' '' 'arg 3') > tcsh -f -c 'echo ${#argv}' $args:gQ 3
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 (event 12) in the history list example in Sx History event specification ,
diff wumpus.man.old wumpus.manmight have been typed as
diff wumpus.man.old !#^:rusing `:r' to remove `.old' from the first argument on the same line (`!#^' )
We could type
echo hello out therethen
echo !*:uto capitalize `hello' ,
echo !*:auto upper case the first word to `HELLO' , or
echo !*:aguto upper case all words.
We might follow
mail -s "I forgot my password" rotwith
!:s/rot/rootto correct the spelling of `root' (see Sx History word modifiers and Sx Spelling correction (+) for different approaches).
(+) In csh(1) as such, only one modifier may be applied to each history or variable expansion. In tcsh, more than one may be used, for example
% mv wumpus.man /usr/share/man/man1/wumpus.1 % man !$:t:r man wumpus
In csh(1), the result would be
wumpus.1:r
A substitution followed by a colon may need to be insulated from it with braces:
> mv a.out /usr/games/wumpus > setenv PATH !$:h:$PATH Bad ! modifier: $. > setenv PATH !{-2$:h}:$PATH setenv PATH /usr/games:/bin:/usr/bin:.
The first attempt would succeed in csh(1) but fails in tcsh, because tcsh expects another modifier after the second colon rather than `$'
mail -s "I forgot my password" rotwith
^rot^rootto make the spelling correction. This is the only history substitution which does not explicitly begin with `!'
Thus if the alias for `ls' were
ls -lthe command
ls /usrwould become
ls -l /usrthe argument list here being undisturbed.
If the alias for `lookup' were
grep !^ /etc/passwdthen
lookup billwould become
grep bill /etc/passwd
Aliases can be used to introduce parser metasyntax. For example,
alias print 'pr \!* | lpr'defines a ``command'' (`print' ) which pr(1)Nss 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 Sx Special aliases (+) .
(+) Variables may be made read-only with
set -rRead-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 -rshould 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. Sx 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 `\' except within `' pairs where it always occurs, and within `'' pairs where it never occurs. Strings quoted by ``' are interpreted later (see Sx Command substitution ) 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 editor command expand-variables normally bound to ^X-$ can be used to interactively expand individual variables.
Except as noted, it is an error to reference a variable which is not set.
The `:' modifiers described under Sx History word modifiers , 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 Sx History word modifiers ; any modifiers must appear within the braces.
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 `^' :
> echo * bang crash crunch ouch > echo ^cr* bang ouch
Glob-patterns which do not use `?' , `*' , or `[]' , or which use `{}' or `~' (below) are not negated correctly.
The metanotation `a{b,c,d}e' is a shorthand for `abe' ace ade . Left-to-right order is preserved:
/usr/source/s1/{oldls,ls}.cexpands to
/usr/source/s1/oldls.c /usr/source/s1/ls.cThe 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
~kenmight expand to
/usr/kenand
~ken/chmachmight expand to
/usr/ken/chmachIf 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/share/man:/usr/local/share/man:~/lib/mandoes 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 *.owould 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 **.cwill list all the .c files in the current directory tree. If used by itself, it will match zero or more sub-directories. For example
ls /usr/include/**/time.hwill list any file named `time.h' in the /usr/include directory tree;
ls /usr/include/**time.hwill match any file in the /usr/include directory tree ending in `time.h' ; and
ls /usr/include/**time**.hwill 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,
> dirs -v 0 /usr/bin 1 /usr/spool/uucp 2 /usr/accts/sys > echo =1 /usr/spool/uucp > echo =0/calendar /usr/bin/calendar > echo =- /usr/accts/sys
The 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.
(cd; pwd); pwd
thus prints the home directory, leaving you where you were (printing this after the home directory), while
cd; pwd
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:
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 arg s and feeds the file to it on standard input.
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. If `notempty' is given in noclobber `>' is allowed on empty files; if `ask' is given in noclobber an interacive confirmation is presented, rather than an error.
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.
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 Sx 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-fileis 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 goto s will succeed on non-seekable inputs.)
The operators, in descending precedence, with equivalent precedence per line, are:
The `==' `!=' `=~' and `!~' operators compare their arguments as strings; all others operate on numbers. The operators `=~' and `!~' are like `==' and `!=' except that the right hand side is a glob-pattern (see Sx 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 Po `&' , `|' , `<' , `>' , `(' , `)' Pc they should be surrounded by spaces.
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 inquiries return false, i.e., `0'
These operators may be combined for conciseness:
-xy fileis 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:
-P file & modeFor example, `-P22' Ar file returns `22' if file is writable by group and other, `20' if by group only, and `0' if by neither.
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 (+).
[1] 1234
indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process id was 1234.
If you are running a job and wish to do something else you may hit the suspend key (usually ^Z ) which sends a STOP signal to the current job. The shell will then normally indicate that the job has been
Suspendedand 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 tostopIf 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
%1Just naming a job brings it to the foreground; thus
%1is a synonym for
fg %1bringing job 1 back into the foreground. Similarly, typing
%1resumes job 1 in the background, just like
bg %1A job can also be named by an unambiguous prefix of the string typed in to start it:
%exwould 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 type
%? stringto 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.
notifyafter starting a background job to mark it for immediate status reporting.
When you try to leave the shell while jobs are stopped, you will be warned that
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 jobcmd periodic precmd and postcmd Sx Special aliases (+) can be set, respectively, to execute commands: when the shell wants to ring the bell, when the working directory changes, when a job is started or is brought into the foreground, every tperiod minutes, before each prompt, and before each command gets executed.
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
rmis 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., `en_CA.UTF-8' would yield `UTF-8' as the 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 \200-\377, 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 \240-\377 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 \nnn. If the tty is not in 8 bit mode, other 8 bit characters are printed by converting them to ASCII and using standout mode. The shell never changes the 7/8 bit mode of the tty and tracks user-initiated changes of 7/8 bit mode. NLS users (or, for that matter, those who want to use a meta key) may need to explicitly set the tty in 8 bit mode through the appropriate 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,
set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
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 Sx 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.
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 `(' and `)' Note that the syntax of expr has nothing to do with that described under Sx 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.
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.
The second form lists the editor command to which key is bound.
The third form binds the editor command command to key
Supported bindkey options:
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:
`\' nullifies the special meaning of the following character, if it has any, notably `\' and `^'
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 and cdtohome shell variables.
With command lists completions for command
With command and word ..., defines completions.
command may be a full command name or a glob-pattern (see Sx 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:
list the list of possible completions, may be one of the following:
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 list types `$' Ns Ar var , `(...)' , and ``...`' 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 list ``...`' has the additional environment variable COMMAND_LINE set, which contains (as its name indicates) contents of the current (already typed in) command line. One can examine and use contents of the COMMAND_LINE environment variable in a 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.
> complete cd 'p/1/d/'
completes only the first word following `cd' (`p/1' ) with a directory. `p' Ns -type completion can also be used to narrow down command completion:
> co[^D] complete compress > complete -co* 'p/0/(compress)/' > co[^D] > compress
This completion completes commands (words in position 0, `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.
> complete find 'n/-user/u/'
is an example of `n' Ns -type completion. Any word following `find' and immediately following `-user' is completed from the list of users.
> complete cc 'c/-I/d/'
demonstrates `c' Ns -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 list s are useful with different commands.
> complete alias 'p/1/a/' > complete man 'p/*/c/' > complete set 'p/1/s/' > complete true 'p/1/x:Truth has no options./'
These complete words following `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,
> complete ftp 'p/1/$hostnames/' > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu) > ftp [^D] rtfm.mit.edu tesla.ee.cornell.edu > ftp [^C] > set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net) > ftp [^D] rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
or from a command run at completion time:
> complete kill 'p/*/`ps | awk \{print\ \$1\}`/' > kill -9 [^D] 23113 23377 23380 23406 23429 23529 23530 PID
Note that the 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:
> complete dbx 'p/2/(core)/' 'p/*/c/'
completes the second argument to `dbx' with the word `core' and all other arguments with commands. Note that the positional completion is specified before the next-word completion. Because 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,
> complete cc 'p/*/f:*.[cao]/'
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 Sx Filename substitution . One might use
> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
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.
The `C' , `D' , `F' , and `T' list s 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
> complete elm c@=@F:$HOME/Mail/@
to complete
elm -fas if it were
elm -f ~/Mail/Note that we used the separator `@' 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.
> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
completes arguments to `finger' from the list of users, appends an `@' , and then completes after the `@' from the `hostnames' variable. Note again the order in which the completions are specified.
Finally, here's a complex example for inspiration:
> complete find \ 'n/-name/f/' 'n/-newer/f/' 'n/-{,n}cpio/f/' \ 'n/-exec/c/' 'n/-ok/c/' 'n/-user/u/' \ 'n/-group/g/' 'n/-fstype/(nfs 4.2)/' \ 'n/-type/(b c d f l p s)/' \ 'c/-/(name newer cpio ncpio exec ok user \ group fstype type atime ctime depth inum \ ls mtime nogroup nouser perm print prune \ size xdev)/' \ 'p/*/d/'
This completes words following `-name' , `-newer' , `-cpio' , or `-ncpio' (note the pattern which matches both) to files, words following `-exec' or `-ok' to commands, words following `-user' and `-group' to users and groups respectively and words following `-fstype' or `-type' to members of the given lists. It also completes the switches themselves from the given list (note the use of `c' Ns -type completion) and completes anything not otherwise completed to a directory. Whew.
Remember that programmed completions are ignored if the word being completed is a tilde substitution (beginning with `~' ) or a variable (beginning with `$' ) . See also the uncomplete builtin command.
The second form with -S saves the directory stack to filename as a series of cd and pushd commands. The second form with -L 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 -Lon startup and, if savedirs is set,
dirs -Sbefore exiting. Because only ~/.tcshrc is normally sourced before ~/.cshdirs dirsfile should be set in ~/.tcshrc rather than ~/.login
The third form clears the directory stack.
echotc homesends the cursor to the home position,
echotc cm 3 10sends it to column 3 and row 10, and
echotc ts 0; echo "This is a test."; echotc fsprints
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:
> set history=`echotc lines` > @ history--
Termcap strings may contain wildcards which will not echo correctly. One should use double quotes when setting a shell variable to a terminal capability string, as in the following example that places the date in the status line:
> set tosl="`echotc ts 0`" > set frsl="`echotc fs`" > echo -n "$tosl";date; echo -n "$frsl"
With -s nonexistent capabilities return the empty string rather than causing an error. With -v messages are verbose.
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.
label :possibly preceded by blanks or tabs, and continues execution after that line.
On machines without vfork(2), prints only the number and size of hash buckets.
history -Lor
source -h
With -r the order of printing is most recent first rather than oldest first.
The second form with -S 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. If the second word of savehist is `merge' and the third word is set to `lock' , the history file update will be serialized with other shell sessions that would possibly like to merge history at exactly the same time.
The second form with -L 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.
Note that
history -Lis exactly like
source -hexcept that it does not require a filename.
Note that login shells do the equivalent of
history -Lon startup and, if savehist is set,
history -Sbefore 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 third form clears the history list.
The second form with the -Z option sets the process title to title using setproctitle(3) where available. If no title is provided, the process title will be cleared.
The second form 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 Sx 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 entering just
killdoes 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.
If no maximum-use is given, then the current limit for resource 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 resource types currently include (if supported by the OS):
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' (1048576 bytes) or `g' or `gigabytes' (1073741824 bytes) 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.
ls -Fbut much faster.
ls-F identifies each type of special file in the listing with a special character suffix:
If the listlinks shell variable is set, symbolic links are identified in more detail (on only systems that have them, of course):
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, for example
ls -FxA
On machines where
ls -Cis not the default, ls-F acts like
ls -CFunless 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-Fgenerally 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.
The second form is equivalent to
migrate - site $$in that it migrates the current process to the specified site. Migrating the shell itself can cause unexpected behavior, because the shell does not like to lose its tty. (TCF only)
exec newgrpas per newgrp(1). Available only if the shell was so compiled; see the version shell variable.
nice - number ...
command is always executed in a sub-shell, and the restrictions placed on commands in simple if statements apply.
Without an argument, causes the non-interactive shell only to ignore hangups for the remainder of the script. See also Sx Signal handling and the hup builtin command.
With `-' , causes all interrupts to be ignored.
With label causes the shell to execute a
goto labelwhen an interrupt is received or a child process terminates because it was interrupted.
onintr is ignored if the shell is running detached and in system startup files (see Sx FILES ) , where interrupts are disabled anyway.
With a number `+' Ns Ar n , discards the n th entry in the stack.
Finally, all forms of popd print the final directory stack, just like dirs The pushdsilent shell variable can be set to prevent this and the -p flag can be given to override pushdsilent The -l -n and -v flags have the same effect on popd as on dirs (+)
pushdlike 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 Sx Filename substitution ) . (+) If dunique is set, pushd removes any instances of name from the stack before pushing it onto the stack. (+)
With a number `+' Ns Ar n , rotates the n th element of the directory stack around to be the top element and changes to it. If dextract is set, however,
pushd + nextracts the n th directory, pushes it onto the top of the stack and changes to it. (+)
Finally, all forms of pushd print the final directory stack, just like dirs The pushdsilent shell variable can be set to prevent this and the -p flag can be given to override pushdsilent The -l -n and -v flags have the same effect on pushd as on dirs (+)
The second form adds command to the scheduled-event list. For example,
> sched 11:00 echo It\'s eleven o\'clock.
causes the shell to echo
It's eleven o'clock.at 11 AM.
The time may be in 12-hour AM/PM format
> sched 5pm set prompt='[%h] It\'s after 5; go home: >'
or may be relative to the current time:
> sched +2:15 /usr/lib/uucp/uucico -r1 -sother
A relative time specification may not use AM/PM format.
The third form removes item n from the event list:
> sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: > > sched -2 > sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother
A command in the scheduled-event list is executed just before the first prompt is printed after the time when the command is scheduled. It is 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.
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.
These arguments can be repeated to set and/or make read-only multiple variables in a single set command. Note, however, that variable expansion happens for all arguments before any setting occurs. Note also that `=' can be adjacent to both name and word or separated from both by whitespace, but cannot be adjacent to only one or the other. See also the unset builtin command.
With name sets the environment variable name to value or, without value to the null string.
settc xn noto get proper wrapping at the rightmost column.
Without other arguments, setty lists the modes in the chosen set which are fixed on (`+ mode ' ) or off (`- mode ' ) The available modes, and thus the display, vary from system to system. With -a lists all tty modes in the chosen set whether or not they are fixed. With + mode - mode or mode fixes mode on or off or removes control from mode in the chosen set. For example,
setty +echok echoefixes `echok' mode on and allows commands to turn `echoe' mode on or off, both when the shell is executing commands.
With variable performs the same function on variable
With -h commands are placed on the history list instead of being executed, much like
history -L
There is no default job entering just
stopdoes not stop the current job.
Without command prints a time summary for the current shell and its children.
Without value prints the current file creation mask.
unaliasremoves all aliases. It is not an error for nothing to be unalias ed.
uncompleteremoves all completions. It is not an error for nothing to be uncomplete d.
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.
unsetremoves all variables unless they are read-only; this is a bad idea.
It is not an error for nothing to be unset
unsetenvremoves all environment variables; this is a bad idea.
It is not an error for nothing to be unsetenv ed.
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)
Supported special aliases are:
> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd ^G"'
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
> alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
This will put the hostname and working directory on the title bar but only the hostname in the icon manager menu.
Note that putting a 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.
> alias jobcmd 'echo -n "^[]2\;\!#:q^G"'
then executing
vi foo.cwill put the command string in the xterm title bar.
> alias helpcommand '\!:1 --help'
then the help display of the command itself will be invoked, using the GNU help calling convention.
Currently there is no easy way to account for various calling conventions (e.g., the customary Unix `-h' ) , except by using a table of many commands.
> set tperiod = 30 > 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
> alias precmd date
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.
> alias postcmd 'echo -n "^[]2\;\!#:q^G"'
then executing
vi foo.cwill put the command string in the xterm title bar.
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 converts between the different formats of path and PATH
Supported special shell variables are:
If this is set to `onlyhistory' , then only history will be expanded and a second completion will expand filenames.
If set to `ambiguous' , possibilities are listed only when no new characters are added by completion.
auto-logoutsets the variable logout to `automatic' and exits. When the shell automatically locks, the user is required to enter their password to continue working. Five incorrect attempts result in automatic logout.
Set to `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).
Unset autologout or set it to `0' to disable automatic logout. See also the afsuser and logout shell variables.
If set to `enhance' , completion ignores case and considers hyphens and underscores to be equivalent; it will also treat periods, hyphens and underscores Po `.' , `-' , and `_' Pc as word separators.
If set to `Enhance' , completion matches uppercase and underscore characters explicitly and matches lowercase and hyphens in a case-insensitive manner; it will treat periods, hyphens and underscores as word separators.
echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
If set to `complete' , commands are automatically completed.
If set to `all' , the entire command line is corrected.
pushd + nextracts the n th directory from the directory stack rather than rotating it to the top.
dirs -Sand
dirs -Llook 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
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 exactly 256 characters in the following format, it enables display and editing of original multi-byte code format:
> set dspmbyte = NNN ... [250 characters] ... NNN
Each character N in the 256 character value corresponds (from left to right) to the ASCII codes 0x00, 0x01, 0x02, ..., 0xfd, 0xfe, 0xff at the same index. Each character is set to number 0, 1, 2 or 3, with the meaning:
For example, if set to 256 characters starting with `001322' , the value is interpreted as:
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 -lcannot display multi-byte filenames.
Note that this variable can only be used if KANJI and DSPMBYTE has been defined at compile time.
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.
If edit is unset, then the traditional csh(1) completion is used.
If set in csh(1), filename completion is used.
ls **.cwill list all the .c files in the current directory tree.
If used by itself, it will match zero or more sub-directories. For example,
ls /usr/include/**/time.hwill list any file named `time.h' in the /usr/include directory tree; whereas
ls /usr/include/**time.hwill 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 `***'
Highlighting requires more frequent terminal writes, which introduces extra overhead. If you care about terminal performance, you may want to leave this unset.
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.
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.
history -Sand
history -Llook 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
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.
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-file s and exits on the n th (+).
If unset, `1' is used, i.e., the shell exits on a single ^D
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.
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.
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 Sx Editor commands (+) ) can be used to yank earlier killed strings.
ls -xF ls -Fa ls -FA
or a combination, for example
ls -FxA
If the first word contains `a' , shows all files (even if they start with a `.' ) .
If the first word contains `A' , shows all files but `.' and `..'
If the first word contains `x' , sorts across instead of down.
If the second word of listflags is set, it is used as the path to ls(1).
If set to `long' , the listing is in long format.
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.
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.
If contains `ask' , an interacive confirmation is presented, rather than an error.
If contains `notempty' , `>' is allowed on empty files.
DING!in the prompt time specifiers at the change of hour.
echo [still gives an error.
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, such as
(/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.
Exit status
prompt may include any of the following formatting sequences (+), which are replaced by the given information:
`%B' , `%S' , `%U' , and `%{' Ns Ar string Ns Li %} 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,
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.
Set by default to `%R? ' in interactive shells.
Set by default to `CORRECT>%R (y|n|e|a)? ' in interactive shells.
pushdlike cd
rmis executed.
If edit isn't set, then rprompt will be printed after the prompt and before the command input.
dirs -Sbefore exiting.
If the first word is set to a number, at most that many directory stack entries are saved.
history -Sbefore exiting.
If the first word is set to a number, at most that many lines are saved. (The number should be less than or equal to the number history entries; if it is set to greater than the number of history settings, only history entries will be saved.)
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.
If the second word is set to `merge' and the third word is set to `lock' , the history file update will be serialized with other shell sessions that would possibly like to merge history at exactly the same time. (+)
If the anyerror variable is unset, the exit status of a pipeline is determined only from the last command in the pipeline, and the exit status of a backquote expansion is not propagated to status
If a command terminated abnormally, then 0200 is added to the status. Builtin commands which fail return exit status `1' , all other builtin commands return status `0'
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
cdthrough a symbolic link and then
cd ..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:
> cd /tmp > mkdir from from/src to > ln -s from/src to/dst
Here's the behavior with symlinks unset,
> cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/from
Here's the behavior with symlinks set to `chase' ,
> cd /tmp/to/dst; echo $cwd /tmp/from/src > cd ..; echo $cwd /tmp/from
Here's the behavior with symlinks set to `ignore' ,
> cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to
Here's the behavior with symlinks set to `expand'
> cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ..; echo $cwd /tmp/to > cd /tmp/to/dst; echo $cwd /tmp/to/dst > cd ".."; echo $cwd /tmp/from > /bin/echo .. /tmp/to > /bin/echo ".." ..
Note that `expand' expansion:
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 time format string:
Only the first four sequences are supported on systems without BSD resource limit functions. The default time format is `%Uu %
Under Sequent's DYNIX/ptx, `%X' , `%D' , `%K' , `%r' , and `%s' are not available, but the following additional sequences are:
and the default time format is `%Uu %
Note that the CPU percentage can be higher than 100% on multi-processors. Ic tperiod No (+) The period, in minutes, between executions of the periodic special alias. Ic tty No (+) The name of the tty, or empty if not attached to one. Ic uid No (+) The user's real user ID. Ic user The user's login name. Ic verbose If set, causes the words of each command to be printed, after history substitution (if any). Set by the -v command line option. Ic version No (+) 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.
Supported version options include:
#! interpreter arg ...convention is emulated when executing shell scripts.
An administrator may enter additional strings to indicate differences in the local version. Ic vimode No (+) If unset, various key bindings change behavior to be more emacs(1) -style: word boundaries are determined by wordchars versus other characters.
If set, various key bindings change behavior to be more vi(1) -style: word boundaries are determined by wordchars versus whitespace versus other characters; cursor behavior depends upon current vi mode (command, delete, insert, replace).
This variable is unset by bindkey -e and set by bindkey -v vimode may be explicitly set or unset by the user after those bindkey operations if required. Ic visiblebell No (+) If set, a screen flash is used rather than the audible bell. See also nobeep Ic watch No (+) 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,
set watch = (george ttyd1 any console $user any)
reports activity of the user `george' on `ttyd1' , any user on the console, and oneself (or a 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,
set watch = (1 any any)
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. Ic who No (+) The format string for watch messages. The following sequences are replaced by the given information:
`%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. Ic wordchars No (+) A list of non-alphanumeric characters to be considered part of a word by the forward-word backward-word etc., editor commands.
If unset, the default value is determined based on the state of vimode if vimode is unset, `*?_-.[]~= ' is used as the default; if vimode is set, `_' is used as the default.
The variables with their associated defaults are:
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 rcwill be used instead. This is generally more convenient to use, but less general.
The left code (`lc' ) right code (`rc' ) and end codes (`ec' ) 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 color commands are:
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.
For symbolic links the `ln' keyword can be set to `target' , which makes the file color the same as the color of the link target.
ConvexOS, Stellix and Intel use /etc/cshrc
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
(+)
ConvexOS, Stellix and Intel use /etc/login
NeXTs use /etc/login.std
Solaris 2.x uses /etc/.login
A/UX, AMIX, Cray and IRIX use /etc/cshrc
This manual uses `~/.tcshrc ' to mean Do ~/.tcshrc or, if ~/.tcshrc is not found, ~/.cshrc Dc .
The shell may be compiled to read ~/.login before instead of after ~/.tcshrc and ~/.history see the version shell variable.
ConvexOS, Stellix and Intel use /etc/logout 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 (+)
The order in which startup files are read may differ if the shell was so compiled; see Sx Startup and shutdown and the version shell variable.
A command-line editor, which supports emacs(1) -style or vi(1) -style key bindings. See Sx The command-line editor (+) and Sx Editor commands (+) .
Programmable, interactive word completion and listing. See Sx Completion and listing (+) and the complete and uncomplete builtin commands.
Sx Spelling correction (+) of filenames, commands and variables.
Sx Editor commands (+) 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 Sx History substitution , the down-history expand-history history-search-backward history-search-forward i-search-back i-search-fwd toggle-literal-history vi-search-back vi-search-fwd and up-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 Sx Directory stack substitution (+) , the dirstack owd and symlinks shell variables and the normalize-command and normalize-path editor commands.
Negation in glob-patterns. See Sx Filename substitution .
New Sx File inquiry operators and a filetest builtin which uses them.
A variety of Sx Automatic, periodic and timed events (+) 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 Sx Native Language System support (+) ) , OS variant features (see Sx OS variant support (+) and the echo_style shell variable) and system-dependent file locations (see Sx FILES ) .
Extensive terminal-management capabilities. See Sx Terminal management (+) .
New builtin commands including builtins hup ls-F newgrp printenv which and where
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 Sx Variable substitution .
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.
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 Sx T in tcsh section
Shell builtin functions are not stoppable/restartable. Command sequences of the form
a ; b ; care 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 `()' Ns '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 goto s.
Report bugs at Lk https://bugs.astron.com/ preferably with fixes. If you want to help maintain and test tcsh, add yourself to the mailing list in Lk https://mailman.astron.com/mailman/listinfo/tcsh