10.12. Built-In Commands

Rather than residing on disk like Linux executable commands, built-in commands are part of the TC shell's internal code and are executed from within the shell. If a built-in command occurs as any component of a pipeline except the last, it is executed in a subshell. The tcsh command aptly called, builtins, lists all the built-in commands:

Example 10.86.
					1  > builtins
					:          @          alias      alloc     bg         bindkey    break
					breaksw    builtins   case       cd        chdir      complete   continue
					default    dirs       echo       echotc    else       end        endif
					endsw      eval       exec       exit      fg         filetest   foreach
					glob       goto       hashstat   history   hup        if         jobs
					kill       limit      log        login     logout     ls-F       nice
					nohup      notify     onintr     popd      printenv   pushd      rehash
					repeat     sched      set        setenv    settc      setty      shift
					source     stop       suspend    switch    telltc     time       umask
					unalias    uncomplete unhash     unlimit   unset      unsetenv   wait
					where      which      while
				

See Table 10.24 for a list of built-in commands.

Table 10.24. Built-In Commands and Their Meanings
Built-In Command Meaning
: Interprets null command, but performs no action.
alias [name [wordlist]] A nickname for a command. Without arguments, prints all aliases; with a name, prints the name for the alias, and with a name and wordlist sets the alias.
alloc Displays amount of dynamic memory acquired, broken down into used and free memory. Varies across systems.
bg [%job] %job & Runs the current or specified jobs in the background. A synonym for the bg built-in command.
bindkey [-l|-d|-e|-v|-u] (+)

bindkey [-a] [-b] [-k] [-r] [--] key

bindkey [-a] [-b] [-k] [-c|-s] [--] key command
Without options, the first form lists all bound keys and the editor command to which each is bound, the second form lists the editor command to which key is bound, and the third form binds the editor command command to key. Options include:

-l Lists all editor commands and a short description of each.

-d Binds all keys to the standard bindings for the default editor.

-e Binds all keys to the standard Gnu emacs -like bindings.

-v Binds all keys to the standard vi (1)-like bindings.

-a Lists or changes key-bindings in the alternative key map. This is the key map used in vi command mode. (tcsh only)

-b This key is interpreted as a control character written as ^character (e.g., ^A) or C-character (e.g., C-A), a meta- character written M-character (e.g., M-A), a function key written F-string (e.g., F-string), or an extended prefix key written X-character (e.g., X-A). (tcsh only)

-k This key is interpreted as a symbolic arrow key name, which may be one of "down," "up," "left," or "right." (tcsh only)

-r Removes key's binding. Be careful: bindkey-r does not bind key to self-insert-command (q.v.), it unbinds key completely. (tcsh only)

-c This command is interpreted as a built-in or external command, instead of an editor command. (tcsh only)

-s This command is taken as a literal string and treated as terminal input when key is typed. Bound keys in commands are themselves reinterpreted, and this continues for 10 levels of interpretation. (tcsh only)

-- Forces a break from option processing, so the next word is taken as a key even if it begins with a hyphen (-). (tcsh only)

-u(or any invalid option) Pr ints a usage message.This 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:

a Bell

 Backspace

e Escape

f Form feed

Newline

Carriage return

Horizontal tab

v Vertical tab

nn The ASCII character corresponding to the octal number nnn

ullifies the special meaning of the following character, if it has any, notably backslash () and caret (^).

break Breaks out of the innermost foreach or while loop.
breaksw Breaks from a switch, resuming after the endsw.
builtins Prints the names of all built-in commands. (tcsh only)
bye A synonym for the logout built-in command. Available only if the shell was so compiled; see the version shell variable. (tcsh only)
case label: A label in a switch statement.
cd [ dir ] Changes the shell's working directory to dir. If no argument is given, changes to the home directory of the user.
cd [-p] [-l] [-n|-v] [name] If a directory name is given, changes the shell's working directory to name. If not, changes to home. If name is "-" it is interpreted as the previous working directory.

-p, prints the final directory stack, just like dirs.

-l, -n, and -v flags have the same effect on cd as on dirs, andthey imply -p. (tcsh only)

chdir A synonym for the cd built-in command.
complete [command [word/pattern/list[:select]/[[suffix]/] …]] Without arguments, lists all completions. With command, lists completions for command. With command and word etc., defines completions. (See Programming Completions.) (tcsh only)
continue Continues execution of the nearest enclosing while or foreach.
default: Labels the default case in a switch statement. The default should come after all case labels.
dirs [-l] [-n|-v]

dirs -S|-L [filename]

dirs -c
The first form prints the directory stack. The top of the stack is at the left and the first directory in the stack is the current directory. -l, ~ or ~name in the output is expanded explicitly to home or the pathname of the home directory for user name.

(+) -n, entries are wrapped before they reach the edge of the screen.

(+) -v, entries are printed one per line preceded by their stack postions.

-S, the second form saves the directory stack to filename as a series of cd and pushd commands. (tcsh only)

-L, the shell source's filename, which is presumably a directory stack file saved. (tcsh only)

In either case dirsfile is used if filename is not given and ~/.cshdirs is used if dirsfile is unset.

With -c, form clears the directory stack. (tcsh only)

echo [ -n ] list Writes the words in list to the shell's standard output, separated by SPACE characters. The output is terminated with a NEWLINE unless the -n option is used.
echo [-n] word … Writes each word to the shell's standard output, separated by spaces and terminated with a newline. The echo_style shell variable may be set to emulate (or not) the flags and escape sequences of the BSD and/or System V versions of echo.
echotc [-sv] arg … Exercises the terminal capabilities (see term-cap(5)) in args. For example, 'echotc home' sends the cursor to the home position. If arg is 'baud', 'cols', 'lines', 'meta', or 'tabs', prints the value of that capability. With -s, nonexistent capabilities return the empty string rather than causing an error. With -v, messages are verbose. (tcsh only)
else if (expr2) then See "Flow Control and Conditional Constructs" .
else

end

endif

endsw
See the description of the foreach, if, switch, and while statements below.
end Executes the commands between the while and the matching end while expr evaluates nonzero. while and end must appear alone on their input lines. break and continue may be used to terminate or continue the loop prematurely. If the input is a terminal, the user is prompted the first time through the loop as with foreach.
eval arg … Treats the arguments as input to the shell and executes the resulting command(s) in the context of the current shell. This is usually used to execute commands generated as the result of command or variable substitution, since parsing occurs before these substitutions.
eval command Runs command as standard input to the shell and executes the resulting commands. This is usually used to execute commands generated as the result of command or variable substitution, since parsing occurs before these substitutions (e.g., eval `tset -s options`).
exec command Executes command in place of the current shell, which terminates.
exit [ (expr) ] Exits the shell, either with the value of the status variable or with the value specified by expr.
fg [% job ] %job Brings the current or specified job into the foreground. A synonym for the fg built-in command.
filetest -op file … Applies op (which is a file inquiry operator) to each file and returns the results as a space-separated list. (tcsh only)
foreach name (wordlist)…end (See "Looping Commands" .)
foreach var (wordlist) See "The foreach Loop" .
getspath Prints the system execution path. (TCF only) (tcsh only)
getxvers Prints the experimental version prefix. (TCF only) (tcsh only)
glob wordlist Performs filename expansion on wordlist. Like echo, but no escapes () are recognized. Words are delimited by null characters in the output.
goto label See "The goto" .
goto word word is filename and command-substituted to yield a string of the form "label." The shell rewinds its input as much as possible, searches for a line of the form "label:", possibly preceded by blanks or tabs, and continues execution after that line.
hashstat Prints a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding execs). An exec is attempted for each component of the path where the hash function indicates a possible hit, and in each component that does not begin with a backslash.
history [-hTr] [n]

history -S | -L | -M [filename]

history -c
The first form prints the history event list. If n is given, only the n most recent events are printed or saved. With -h, the history list is printed without leading numbers. If -T is specified, timestamps are printed also in comment form. (This can be used to produce files suitable for loading with 'history -L' or 'source -h'. (tcsh only)) With -r, the order of printing is most recent first rather than oldest first. (See "History" .) With -c, clears the history list (tcsh only).
hup [command] With command, runs command such that it will exit on a hangup signal and arranges for the shell to send it a hangup signal when the shell exits. Note that commands may set their own response to hangups, overriding hup. Without an argument (allowed only in a shell script), causes the shell to exit on a hangup for the remainder of the script. (tcsh only)
if (expr) command If expr evaluates true, then command is executed. Variable substitution on command happens early, at the same time it does for the rest of the if command. Command must be a simple command, not an alias, a pipeline, a command list or a parenthesized command list, but it may have arguments. Input/output redirection occurs even if expr is false and command is thus not executed; this is a bug.
if (expr) then…else if (expr2) then…else…endif If the specified expr is true then the commands to the first else are executed; otherwise if expr2 is true then the commands to the second else are executed, etc. Any number of else-if pairs are possible; only one endif is needed. The else part is likewise optional. (The words else and endif must appear at the beginning of input lines; the if must appear alone on its input line or after an else.)
inlib shared-library … Adds each shared-library to the current environment. There is no way to remove a shared library. (Domain/OS only) (tcsh only)
jobs [ -l ] Lists the active jobs under job control.With -l, lists IDs in addition to the normal information.
kill [ -sig ] [ pid ] [ %job ] … kill -l Sends the TERM (terminate) signal, by default or by the signal specified, to the specified ID, the job indicated, or the current job. Signals are given either by number or name. There is no default. Typing kill does not send a signal to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process is sent a CONT (continue) signal as well. With -l lists the signal names that can be sent.
limit [ -h ] [ resource [ max-use ] ] Limits the consumption by the current process or any process it spawns, each not to exceed max-use on the specified resource. If max-use is omitted, print the current limit ; if resource is omitted, display all limit s. With -h, uses hard limits instead of the current limits. Hard limits impose a ceiling on the values of the current limits. Only the superuser may raise the hard limits. Resource is one of: cputime, maximum CPU seconds per process; filesize, largest single file allowed; datasize, maximum data size (including stack) for the process; stacksize, maximum stack size for the process; coredump, maximum size of a core dump; and descriptors, maximum value for a file descriptor.
log Prints the watch shell variable and reports on each user indicated in watch who is logged in, regardless of when they last logged in. See also watchlog. (tcsh only)
login Terminates a login shell, replacing it with an instance of /bin/login.
login [ username|-p ] Terminates a login shell and invokes login(1). The .logout file is not processed. If username is omitted, login prompts for the name of a user. With -p, preserves the current environment (variables).
logout Terminates a login shell.
ls-F [-switch …] [file …] Lists files like ls -F, but much faster (tcsh only). It identifies each type of special file in the listing with a special character:

/ Directory

* Executable

# Block device

% Character device

| Named pipe (systems with named pipes only)

= Socket (systems with sockets only)

@ Symbolic link (systems with symbolic links only)

+ Hidden directory (AIX only) or context-dependent (HP/UX only)

: Network special (HP/UX only)

If the listlinks shell variable is set, symbolic links are identified in more detail (only, of course, on systems which have them):

@ Symbolic link to a nondirectory

> Symbolic link to a directory

& Symbolic link to nowhere

The ls-F built-in can list files using different colors depending on the filetype or extension.
migrate [-site] pid | %jobid … migrate -site The first form migrates the process or job to the site specified or the default site determined by the system path (tcsh only). The second form is equivalent to migrate -site $$ (tcsh only). It migrates the current process to the specified site. Migrating the shell itself can cause unexpected behavior, since the shell does not like to lose its tty. (TCF only)
@

@ name = expr

@ name[index] = expr

@ name++|--

@ name[index]++|--
The first form prints the values of all shell variables. The second form assigns the value of expr to name. The third form assigns the value of expr to the index'th component of name; both name and its index'th component must already exist. The fourth and fifth forms increment (++) or decrement (--) name or its index'th component.
newgrp [-] group Equivalent to exec newgrp ; see newgrp(1). Available only if the shell was so compiled; see the version shell variable. (tcsh only)
nice [+number] [command] Sets the scheduling priority for the shell to number, or, without number, to 4. With command, runs command at the appropriate priority. The greater the number, the less CPU the process gets. The superuser may specify negative priority by using nice -number …. Command is always executed in a subshell, and the restrictions placed on commands in simple if statements apply.
nohup [ command ] Runs command with HUP s (hangups) ignored. With no arguments, ignores HUP s throughout the remainder of a script.
notify [ %job ] Notifies the user asynchronously when the status of the current or of a specified job changes.
onintr [ - | label] Controls the action of the shell on interrupts. With no arguments, onintr restores the default action of the shell on interrupts. (The shell terminates shell scripts and returns to the terminal command input level.) With the minus sign argument, the shell ignores all interrupts. With a label argument, the shell executes a goto label when an interrupt is received or a child process terminates because it was interrupted.
popd [+n] Pops the directory stack and cd to the new top directory. The elements of the directory stack are numbered from zero, starting at the top. With +n, discard the n th entry in the stack.
printenv [name] Prints the names and values of all environment variables or, with name, the value of the environment variable name. (tcsh only)
pushd [+n | dir] Pushes a directory onto the directory stack. With no arguments, exchanges the top two elements. With +n, rotates the n th entry to the top of the stack and cd to it. With dir, pushes the current working directory onto the stack and changes to dir.
rehash Recomputes the internal hash table of the contents of directories listed in the path variable to account for new commands added.
repeat count command Repeats command count times.
rootnode //nodename Changes the rootnode to //nodename, so that / will be interpreted as //nodename. (Domain/OS only) (tcsh only)
sched

sched [+]hh:mm command

sched -n
The first form prints the scheduled-event list (tcsh only). The sched shell variable may be set to define the format in which the scheduled-event list is printed. The second form adds command to the scheduled-event list. (tcsh only)
setset name …set name=word …set [-r] [-f|-l] name=(wordlist) … (+)set name[index]=word …set -r set -r name … set -r name=word … The first form of the command prints the value of all shell variables. Variables which contain more than a single word print as a parenthesized word list. The second form sets name to the null string. The third form sets name to the single word. The fourth form sets name to the list of words in wordlist. In all cases the value is command and filename expanded. If -r is specified, the value is set read-only. If -f or -l are specified, set only unique words keeping their order. -f prefers the first occurrence of a word, and -l the last occurrence of the word. The fifth form sets the index'th component of name to word; this component must already exist. The sixth form lists the names (only) of all shell variables which are read-only (tcsh only). The seventh form makes name read-only, whether or not it has a value (tcsh only). The eighth form is the same as the third form, but makes name read-only at the same time (tcsh only).
set [var [ = value ] ] See "Variables" .
setenv [ VAR [ word ] ] See "Variables" . The most commonly used environment variables, USER, TERM, and PATH, are automatically imported to and exported from the csh variables, user, term, and path ; there is no need to use setenv for these. In addition, the shell sets the PWD environment variable from the csh variable cwd whenever the latter changes.
setenv [name [value]] Without arguments, prints the names and values of all environment variables. Given name, sets the environment variable name to value or, without value, to the null string.
setpath path Equivalent to setpath(1). (Mach only) (tcsh only)
setspath LOCAL|site|cpu … Sets the system execution path. (TCF only) (tcsh only)
settc cap value Tells the shell to believe that the terminal capability cap (as defined in termcap(5)) has the value value. No sanity checking is done. Concept terminal users may have to settc xn no to get proper wrapping at the rightmost column. (tcsh only)
setty [-d|-q|-x] [-a] [[+|-]mode] Controls which tty modes the shell does not allow to change. -d, -q, or -x tells setty to act on the edit, quote, or execute set of tty modes, respectively; without -d, -q, or -x, execute is used.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 echoe fixes echok mode on and allows commands to turn echoe mode on or off, both when the shell is executing commands. (tcsh only)
setxvers [string] Sets the experimental version prefix to string, or removes it if string is omitted. (TCF only) (tcsh only)
shift [ variable ] The components of argv, or variable, if supplied, are shifted to the left, discarding the first component. It is an error for variable not to be set, or to have a null value.
source [ -h ] name Reads commands from name. Source commands may be nested, but if they are nested too deeply, the shell may run out of file descriptors. An error in a sourced file at any level terminates all nested source commands. Used commonly to reexecute the .login or .cshrc files to ensure variable settings are handled within the current shell, i.e., shell does not create a child shell (fork). With -h, places commands from the filename on the history list without executing them.
stop [%job] … Stops the current or specified background job.
suspend Stops the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su.
switch (string) See "The switch Command" .
telltc Lists the values of all terminal capabilities (see termcap(5)). (tcsh only)
time [ command ] With no argument, prints a summary of time used by this shell and its children. With an optional command, executes command and print a summary of the time it uses.
umask [ value ] Displays the file creation mask. With value, sets the file creation mask. Value, given in octal, is XORed with the permissions of 666 for files and 777 for directories to arrive at the permissions for new files. Permissions cannot be added via umask.
unalias pattern Removes all aliases whose names match pattern. unalias * thus removes all aliases. It is not an error for nothing to be unaliased.
uncomplete pattern Removes all completions whose names match pattern.uncomplete * thus removes all completions. (tcsh only)
unhash Disables the internal hash table.
universe universe Sets the universe to universe. (Masscomp/RTU only) (tcsh only)
unlimit [-h] [resource] Removes the limitation on resource or, if no resource is specified, all resource limitations. With -h, the corresponding hard limits are removed. Only the superuser may do this.
unsetenv pattern Removes all environment variables whose names match pattern. unsetenv * thus removes all environment variables; this is a bad idea. If there is no pattern to be unsetenv ed, no error will result from this built-in.
unsetenv variable Removes variable from the environment. Pattern matching, as with unset, is not performed.
@ [ var =expr ] @ [ var[n] =expr ] With no arguments, displays the values for all shell variables. With arguments, the variable var, or the n th word in the value of var, is set to the value that expr evaluates to.
ver [systype [command]] Without arguments, prints SYSTYPE. With systype, sets SYSTYPE to systype. With systype and command, executes command under systype. systype may be bsd4.3 or sys5.3. (Domain/OS only) (tcsh only)
wait Waits for background jobs to finish (or for an interrupt) before prompting.
warp universe Sets the universe to universe. (Convex/OS only) (tcsh only)
watchlog An alternate name for the log built-in command (q.v.). Available only if the shell was so compiled; see the version shell variable.(tcsh only)
where command Reports all known instances of command, including aliases, built-ins, and executables in path. (tcsh only)
which command Displays the command that will be executed by the shell after substitutions, path searching, etc. The built-in command is just like which(1), but it correctly reports tcsh aliases and built-ins and is 10 to 100 times faster. (tcsh only)
while (expr) See "Looping Commands" .

10.12.1. Special Aliases (tcsh Only)

If set, each of the TC shell aliases executes automatically at the indicated time. They are all initially undefined.

beepcmd Runs when the shell wants to ring the terminal bell
cwdcmd Runs after every change of working directory
periodic Runs every tperiod minutes; e.g., set tperiod = 30 > alias periodic date
precmd Runs just before each prompt is printed; e.g., alias precmd date

10.12.2. Special Built-In Shell Variables

The built-in shell variables have special meaning to the shell and are used to modify and control the way many of the shell commmands behave. They are local variables and therefore most of them are set in the .tcshrc file if they are to be passed on to and affect child TC shells.

When the shell starts up, it automatically sets the following variables: addsuffix, argv, autologout, command, echo_style, edit, gid, group, home, loginsh, oid, path, prompt, prompt2, prompt3, shell, shlvl, tcsh, term, tty, uid, user, and version. Unless the user decides to change them, these variables will remain fixed. The shell also keeps track of and changes special variables that may need period updates, such as, cwd, dirstack, owd, and status, and when the user logs out, the shell sets the logout variable.

Some of the local variables have a corresponding environment variable of the same name. If one of the environment or local variables are affected by a change in the user's environment, the shell will synchronize the local and environment variables [10] so that their values always match. Examples of cross-matched variables are: afuser, group, home, path, shlvl, term, and user. (Although cwd and PWD have the same meaning, they are not cross-matched. Even though the syntax is different for the path and PATH variables, they are automatically crossed-matched if either one is changed.)

[10] This is true unless the variable is a read-only variable, and then there will be no synchronization.

Table 10.25. Special Shell Variables (Descriptions taken from tcsh manual pages.)
addsufix For filename completion, adds slashes at the end of directories and space to the end of normal files if they are matched. (tcsh) Set by default.
afsuser If set, autologout's autolock feature uses its value instead of the local username for kerberos authentication. (tcsh)
ampm If set, all times are shown in 12-hour AM/PM format. (tcsh)
argv An array of command line arguments to the shell; also represented as $1, $2, etc.
autocorrect Invokes the spell checker before each attempt at filename, command, or variable completion. (tcsh)
autoexpand If set, the expand-history editor command is invoked automatically before each completion attempt. (tcsh)
autolist If set, possibilities are listed after an ambiguous completion. If set to ambiguous, possibilities are listed only when no new characters are added by completion.
autologout Its argument is the number of minutes of inactivity before automatic logout; the second optional argument is the number of minutes before automatic locking causes the screen to lock. (tcsh)
backslash_quote If set, a backslash will always quote itself, a single quote, or a double quote. (tcsh)
cdpath A list of directories in which cd should search for subdirectories if they aren't found in the current directory.
color Enables color display for the built-in command, ls-F and passes --color=auto to ls. (tcsh)
complete If set to enhance, completion ignores case, considers periods, hyphens and underscores to be word separators, and hyphens and underscores to be equivalent. (tcsh)
correct If set to cmd, commands are automatically spelling-corrected. If set to complete, commands are automatically completed. If set to all, the entire command line is corrected. (tcsh)
cwd The full path name of the current working directory.
dextract If set, pushd +n extracts the n th directory from the directory stack rather than rotating it to the top. (tcsh)
dirsfile The default location in which dirs -S and dirs -L look for a history file. If unset, ~/.cshdirs is used.
dirstack A list of all directories on the directory stack. (tcsh)
dunique Will not allow pushd to keep duplicate directory entries on the stack. (tcsh)
echo If set, each command with its arguments is echoed just before it is executed. Set by the -x command line option.
echo-style Sets the style for echo. If set to bsd will not echo a newline if the first argument is -n ; if set to sysv, recognizes backslashed escape sequences in echo strings; if set to both, recognizes both the -n flag and backslashed escape sequences; the default, and if set to none, recognizes neither. (tcsh)
edit Sets the command-line editor for interactive shells; set by default.
ellipsis If set, the `%c'/`%.' and `%C' prompt sequences (see the "The Shell Prompts" ) indicate skipped directories with an ellipsis (…) instead of /<skipped. (tcsh)
fignore Lists filename suffixes to be ignored by completion.
filec In tcsh, completion is always used and this variable is ignored. If set in csh, filename completion is used.
gid The user's read group id number. (tcsh)
group The user's group name. (tcsh)
histchars A string value determining the characters used in history substitution. The first character of its value is used as the history substitution character to replace the default character, !. The second character of its value replaces the character ^ in quick substitutions.
histdup Controls handling of duplicate entries in the history list. Can be set to all ( removes all duplicates ),prev( removes the current command if it duplicates the previous command ), or erase (inserts the current event for an older duplicate event). (tcsh)
histfile The default location in which history -S and history -L look for a history file. If unset, ~/.history is used.
histlit Enters events on the history list literally; i.e., unexpanded by history substitution. (tcsh)
history The first word indicates the number of history events to save. The optional second word (+) indicates the format in which history is printed.
home The home directory of the user; same as ~.
ignoreeof If logging out by pressing Control-D, prints Use "exit" to leave tcsh. Prevents inadvertently logging out.
implicitcd If set, the shell treats a directory name typed as a command as though it were a request to change to that directory and changes to it. (tcsh)
inputmode If set to insert or overwrite, puts the editor into that input mode at the beginning of each line. (tcsh)
listflags If set to x, a, or A, or any combination (e.g., xA), values are used as flags to ls-F, making it act like ls -xF, ls -Fa, ls -FA, or any combination of those flags. (tcsh)
listjobs If set, all jobs are listed when a job is suspended. If set to long, the listing is in long format. (tcsh)
listlinks If set, the ls-F built-in command shows the type of file to which each symbolic link points. (tcsh)
listmax The maximum number of items which the list-choices editor command will list without asking first. (tcsh)
listmaxrows The maximum number of rows of items which the list-choices editor command will list without asking first. (tcsh)
loginsh Set by the shell if it is a login shell. Setting or unsetting it within a shell has no effect. See also shlvl later in this table. (tcsh)
logout Set by the shell to normal before a normal logout, automatic before an automatic logout, and hangup if the shell was killed by a hangup signal. (tcsh)
mail The names of the files or directories to check for incoming mail. After 10 minutes if new mail has come in, will print "You have new mail".
matchbeep If set to never, completion never beeps; if set to nomatch, completion beeps only when there is no match, and when set to ambiguous, beeps when there are multiple matches.
nobeep Disables all beeping.
noclobber Safeguards against the accidental removal of existing files when redirection is used; e.g., ls file.
noglob If set, inhibits filename and directory stack substitutions when using wildcards.
nokanji If set and the shell supports Kanji (see the version shell variable), it is disabled so that the meta key can be used. (tcsh)
nonomatch If set, a filename substitution or directory stack substitution which does not match any existing files is left untouched rather than causing an error. (tcsh)
nostat A list of directories (or glob-patterns which match directories); that should not be stat(2)ed during a completion operation. This is usually used to exclude directories which take too much time to stat(2). (tcsh)
notify If set, the shell announces job completions asynchronously instead of waiting until just before the prompt appears.
oid The user's real organization ID. (Domain/OS only) (tcsh)
owd The old or previous working directory. (tcsh)
path A list of directories in which to look for executable commands. path is set by the shell at startup from the PATH environment variable or, if PATH does not exist, to a system-dependent default something like (/usr/local/bin /usr/bsd /bin /usr/bin).
printexitvalue If set and an interactive program exits with a nonzero status, the shell prints Exit status.
prompt The string which is printed before reading each command from the terminal which may include special formatting sequences (See "The Shell Prompts" ).
prompt2 The string with which to prompt in while and foreach loops and after lines ending in . The same format sequences may be used as in prompt ; note the variable meaning of %R. Set by default to %R? in interactive shells. (tcsh)
prompt3 The string with which to prompt when confirming automatic spelling correction. The same format sequences may be used as in prompt ; note the variable meaning of %R. Set by default to CORRECT%R (y|n|e|a)? in interactive shells. (tcsh)
promptchars If set (to a two-character string), the %# formatting sequence in the prompt shell variable is replaced with the first character for normal users and the second character for the superuser. (tcsh)
pushtohome If set, pushd without arguments does pushd ~, like cd. (tcsh)
pushdsilent If set, pushd and popd to not print the directory stack. (tcsh)
recexact If set, completion completes on an exact match even if a longer match is possible. (tcsh)
recognize_only_executables If set, command listing displays only files in the path that are executable. (tcsh)
rmstar If set, the user is prompted before rm * is executed. (tcsh)
rprompt The string to print on the right-hand side of the screen (after the command input) when the prompt is being displayed on the left. It recognises the same formatting characters as prompt. It will automatically disappear and reappear as necessary, to ensure that command input isn't obscured, and will only appear if the prompt, command input, and itself will fit together on the first line. If edit isn't set, then rprompt will be printed after the prompt and before the command input. (tcsh)
savedirs If set, the shell does dirs -S before exiting. (tcsh)
savehist If set, the shell does history -S before exiting. If the first word is set to a number, at most that many lines are saved. (The number must be less than or equal to history.) If the second word is set to merge, the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by timestamp and the most recent events are retained. (tcsh)
sched The format in which the sched built-in command prints scheduled events; if not given, %h %T %R is used. The format sequences are described above under prompt; note the variable meaning of %R. (tcsh)
shell The file in which the shell resides. This is used in forking shells to interpret files which have execute bits set, but which are not executable by the system. (See the description of built-in and nonbuilt-in command execution.) Initialized to the (system-dependent) home of the shell.
shlvl The number of nested shells. Reset to 1 in login shells. See also loginsh. (tcsh)
status The status returned by the last command. If it terminated abnormally, then 0200 is added to the status. Built-in commands that fail return exit status 1, all other built-in commands return status 0.
symlinks Can be set to several different values to control symbolic link (symlink) resolution. (See tcsh man page for examples.) (tcsh)
tcsh The version number of the shell in the format R.VV.PP, where R is the major release number, VV the current version, and PP the patch level. (tcsh)
term The terminal type. Usually set in ~/.login as described under "Startup" .
time If set to a number, then the time built-in executes automatically after each command which takes more than that many CPU seconds. If there is a second word, it is used as a format string for the output of the time built-in. (u) The following sequences may be used in the format string:
 
%U The time the process spent in user mode in CPU seconds.
%S The time the process spent in kernel mode in CPU seconds.
%E The elapsed (wall clock) time in seconds.
%P The CPU percentage computed as (%U + %S)/ %E.
%W Number of times the process was swapped.
%X The average amount in (shared) text space used in KB.
%D The average amount in (unshared) data/stack space used in KB.
%K The total space used (%X + %D) in KB.
%M The maximum memory the process had in use at any time in KB.
%F The number of major page faults (page needed to be brought from disk).
%R The number of minor page faults.
%I The number of input operations.
%O The number of output operations.
%r The number of socket messages received.
%s The number of socket messages sent.
%k The number of signals received.
%w The number of voluntary context switches (waits).
%c The number of involuntary context switches.

  Only the first four sequences are supported on systems without BSD resource limit functions. The default time format is %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww for systems that support resource usage reporting and %Uu %Ss %E %P for systems that do not. Under Sequent's DYNIX/ptx, %X, %D, %K, %r, and %s are not available, but the following additional sequences are:
 
%Y The number of system calls performed.
%Z The number of pages which are zero-filled on demand.
%i The number of times a process's resident set size was increased by the kernel.
%d The number of times a process's resident set size was decreased by the kernel.
%l The number of read system calls performed.
%m The number of write system calls performed.
%p The number of reads from raw disk devices.
%q The number of writes to raw disk devices.

  The default time format is %Uu %Ss $E %P %I+%Oio %Fpf+%Ww. Note that the CPU percentage can be higher than 100 percent on multiprocessors.
tperiod The period, in minutes, between executions of the periodic special alias. (tcsh)
tty The name of the tty, or empty if not attached to one. (tcsh)
uid The user's real user ID. (tcsh)
user The user's login name.
verbose If set, causes the words of each command to be printed, after history substitution (if any). Set by the -v command line option.
version The version ID stamp. It contains the shell's version number (see tcsh), origin, release date, vendor, operating system, etc.

Shell Command Line Switches

The TC shell can take a number of command line switches (also called flag arguments) to control or modify its behavior. The command line switches are listed in Table 10.26.

Table 10.26. Shell Command Line Switches
- Specifies the shell is a login shell.
-b Forces a "break" from option processing. Any shell arguments thereafter, will not be treated as options. The remaining arguments will not be interpreted as shell options. Must include this option if shell is set-user id.
-c If a single argument follows the -c, commands are read from the argument (a filename). Remaining arguments are placed in the argv shell variable.
-d The shell loads the directory stack from ~/.cshdirs.
-Dname[=value] Sets the environment variable name to value.
-e The shell exits if any invoked command terminates abnormally or yields a nonzero exit status.
-f Called the fast startup because the shell ignores ~/.tcshrc, when starting a new TC shell.
-F The shell uses fork(2) instead of vfork(2) to spawn processes. (Convex/OS only)
-i The shell is interactive and prompts input, even if it appears to not be a terminal. This option isn't necessary if input and output are connected to a terminal.
-l The shell is a login shell if -l is the only flag specified.
-m The shell loads ~/.tcshrc even if it does not belong to the effective user.
-n Used for debugging scripts. The shell parses commands but does not execute them.
-q The shell accepts the SIGQUIT signal and behaves when it is used under a debugger. Job control is disabled. (u)
-s Command input is taken from the standard input.
-t The shell reads and executes a single line of input. A backslash () may be used to escape the newline at the end of this line and continue on to another line.
-v Sets the verbose shell variable, so that command input is echoed after history substitution. Used to debug shell scripts.
-x Sets the echo shell variable, so that command are echoed before execution and after history and variable substitution. Used to debug shell scripts.
-V Sets the verbose shell variable before executing the ~/.tcshrc file.
-X Sets the echo shell variable before executing the ~/.tcshrc file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.183.138