+CSH(1) BSD Reference Manual CSH(1)
+
+N\bNA\bAM\bME\bE
+ c\bcs\bsh\bh - a shell (command interpreter) with C-like syntax
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+ c\bcs\bsh\bh [-\b-b\bbc\bce\bef\bfi\bin\bns\bst\btv\bvV\bVx\bxX\bX] [arg ...]
+ c\bcs\bsh\bh [-\b-l\bl]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ The c\bcs\bsh\bh is a command language interpreter incorporating a history mecha-
+ nism (see H\bHi\bis\bst\bto\bor\bry\by S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bns\bs), job control facilities (see J\bJo\bob\bbs\bs), in-
+ teractive file name and user name completion (see F\bFi\bil\ble\be N\bNa\bam\bme\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn),
+ and a C-like syntax. It is used both as an interactive login shell and a
+ shell script command processor.
+
+ A\bAr\brg\bgu\bum\bme\ben\bnt\bt l\bli\bis\bst\bt p\bpr\bro\boc\bce\bes\bss\bsi\bin\bng\bg
+ If the first argument (argument 0) to the shell is `-\b-', then this is a
+ login shell. A login shell also can be specified by invoking the shell
+ with the `-\b-l\bl' flag as the only argument.
+
+ The rest of the flag arguments are interpreted as follows:
+
+ -\b-b\bb This flag forces a ``break'' from option processing, causing any
+ further shell arguments to be treated as non-option arguments.
+ The remaining arguments will not be interpreted as shell options.
+ This may be used to pass options to a shell script without confu-
+ sion or possible subterfuge. The shell will not run a set-user ID
+ script without this option.
+
+ -\b-c\bc Commands are read from the (single) following argument which must
+ be present. Any remaining arguments are placed in _\ba_\br_\bg_\bv.
+
+ -\b-e\be The shell exits if any invoked command terminates abnormally or
+ yields a non-zero exit status.
+
+ -\b-f\bf The shell will start faster, because it will neither search for
+ nor execute commands from the file _\b._\bc_\bs_\bh_\br_\bc in the invoker's home
+ directory.
+
+ -\b-i\bi The shell is interactive and prompts for its top-level input, even
+ if it appears not to be a terminal. Shells are interactive with-
+ out this option if their inputs and outputs are terminals.
+
+ -\b-l\bl The shell is a login shell (only applicable if -\b-l\bl is the only flag
+ specified).
+
+ -\b-n\bn Commands are parsed, but not executed. This aids in syntactic
+ checking of shell scripts.
+
+ -\b-s\bs Command input is taken from the standard input.
+
+ -\b-t\bt A single line of input is read and executed. A `\' may be used to
+ escape the newline at the end of this line and continue onto an-
+ other line.
+
+ -\b-v\bv Causes the _\bv_\be_\br_\bb_\bo_\bs_\be variable to be set, with the effect that com-
+ mand input is echoed after history substitution.
+
+ -\b-x\bx Causes the _\be_\bc_\bh_\bo variable to be set, so that commands are echoed
+ immediately before execution.
+
+ -\b-V\bV Causes the _\bv_\be_\br_\bb_\bo_\bs_\be variable to be set even before _\b._\bc_\bs_\bh_\br_\bc is exe-
+
+
+ cuted.
+
+ -\b-X\bX Is to -\b-x\bx as -\b-V\bV is to -\b-v\bv.
+
+ After processing of flag arguments, if arguments remain but none of the
+ -\b-c\bc, -\b-i\bi, -\b-s\bs, or -\b-t\bt options were given, the first argument is taken as the
+ name of a file of commands to be executed. The shell opens this file,
+ and saves its name for possible resubstitution by `$0'. Since many sys-
+ tems use either the standard version 6 or version 7 shells whose shell
+ scripts are not compatible with this shell, the shell will execute such a
+ `standard' shell if the first character of a script is not a `#', i.e.,
+ if the script does not start with a comment. Remaining arguments ini-
+ tialize the variable _\ba_\br_\bg_\bv.
+
+ An instance of c\bcs\bsh\bh begins by executing commands from the file
+ _\b/_\be_\bt_\bc_\b/_\bc_\bs_\bh_\b._\bc_\bs_\bh_\br_\bc and, if this is a login shell, _\b/_\be_\bt_\bc_\b/_\bc_\bs_\bh_\b._\bl_\bo_\bg_\bi_\bn. It then ex-
+ ecutes commands from _\b._\bc_\bs_\bh_\br_\bc in the _\bh_\bo_\bm_\be directory of the invoker, and, if
+ this is a login shell, the file _\b._\bl_\bo_\bg_\bi_\bn in the same location. It is typi-
+ cal for users on crt's to put the command ``stty crt'' in their _\b._\bl_\bo_\bg_\bi_\bn
+ file, and to also invoke tset(1) there.
+
+ In the normal case, the shell will begin reading commands from the termi-
+ nal, prompting with `% '. Processing of arguments and the use of the
+ shell to process files containing command scripts will be described lat-
+ er.
+
+ The shell repeatedly performs the following actions: a line of command
+ input is read and broken into _\bw_\bo_\br_\bd_\bs. This sequence of words is placed on
+ the command history list and parsed. Finally each command in the current
+ line is executed.
+
+ When a login shell terminates it executes commands from the files _\b._\bl_\bo_\bg_\bo_\bu_\bt
+ in the user's _\bh_\bo_\bm_\be directory and _\b/_\be_\bt_\bc_\b/_\bc_\bs_\bh_\b._\bl_\bo_\bg_\bo_\bu_\bt.
+
+ L\bLe\bex\bxi\bic\bca\bal\bl s\bst\btr\bru\buc\bct\btu\bur\bre\be
+ The shell splits input lines into words at blanks and tabs with the fol-
+ lowing exceptions. The characters `&' `|' `;' `<' `>' `(' `)' form sepa-
+ rate words. If doubled in `&&', `||', `<<' or `>>' these pairs form sin-
+ gle words. These parser metacharacters may be made part of other words,
+ or prevented their special meaning, by preceding them with `\'. A new-
+ line preceded by a `\' is equivalent to a blank.
+
+ Strings enclosed in matched pairs of quotations, `'', ``' or `"', form
+ parts of a word; metacharacters in these strings, including blanks and
+ tabs, do not form separate words. These quotations have semantics to be
+ described later. Within pairs of `'' or `"' characters, a newline pre-
+ ceded by a `\' gives a true newline character.
+
+ When the shell's input is not a terminal, the character `#' introduces a
+ comment that continues to the end of the input line. It is prevented
+ this special meaning when preceded by `\' and in quotations using ``',
+ `'', and `"'.
+
+ C\bCo\bom\bmm\bma\ban\bnd\bds\bs
+ A simple command is a sequence of words, the first of which specifies the
+ command to be executed. A simple command or a sequence of simple com-
+ mands separated by `|' characters forms a pipeline. The output of each
+ command in a pipeline is connected to the input of the next. Sequences
+ of pipelines may be separated by `;', and are then executed sequentially.
+ A sequence of pipelines may be executed without immediately waiting for
+ it to terminate by following it with an `&'.
+
+ Any of the above may be placed in `(' `)' to form a simple command (that
+ may be a component of a pipeline, etc.). It is also possible to separate
+ pipelines with `||' or `&&' showing, as in the C language, that the sec-
+ ond is to be executed only if the first fails or succeeds respectively.
+ (See _\bE_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn_\bs.)
+
+ J\bJo\bob\bbs\bs
+ The shell associates a _\bj_\bo_\bb with each pipeline. It keeps a table of cur-
+ rent jobs, printed by the _\bj_\bo_\bb_\bs command, and assigns them small integer
+ numbers. When a job is started asynchronously with `&', the shell prints
+ a line that looks like:
+
+ [1] 1234
+
+ showing 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
+ key ^\b^Z\bZ (control-Z) which sends a STOP signal to the current job. The
+ shell will then normally show that the job has been `Stopped', and print
+ another prompt. You can then manipulate the state of this job, putting
+ it in the _\bb_\ba_\bc_\bk_\bg_\br_\bo_\bu_\bn_\bd with the _\bb_\bg command, or run some other commands and
+ eventually bring the job back into the foreground with the _\bf_\bo_\br_\be_\bg_\br_\bo_\bu_\bn_\bd
+ command _\bf_\bg. A ^\b^Z\bZ takes effect immediately and is like an interrupt in
+ that pending output and unread input are discarded when it is typed.
+ There is another special key ^\b^Y\bY that does not generate a STOP signal un-
+ til a program attempts to read(2) it. This request can usefully be typed
+ ahead when you have prepared some commands for a job that you wish to
+ stop after it has read them.
+
+ A job being run in the background will stop if it tries to read from the
+ terminal. Background jobs are normally allowed to produce output, but
+ this can be disabled by giving the command ``stty tostop''. If you set
+ this tty option, then background jobs will stop when they try to produce
+ output like they do when they try to read input.
+
+ There are several ways to refer to jobs in the shell. The character `%'
+ introduces a job name. If you wish to refer to job number 1, you can
+ name it as `%1'. Just naming a job brings it to the foreground; thus
+ `%1' is a synonym for `fg %1', bringing job number 1 back into the fore-
+ ground. Similarly saying `%1 &' resumes job number 1 in the background.
+ Jobs can also be named by prefixes of the string typed in to start them,
+ if these prefixes are unambiguous, thus `%ex' would normally restart a
+ suspended ex(1) job, if there were only one suspended job whose name be-
+ gan with the string `ex'. It is also possible to say `%?string' which
+ specifies a job whose text contains _\bs_\bt_\br_\bi_\bn_\bg, if there is only one such
+ job.
+
+ The shell maintains a notion of the current and previous jobs. In output
+ about jobs, the current job is marked with a `+' and the previous job
+ with a `-'. The abbreviation `%+' refers to the current job and `%-'
+ refers to the previous job. For close analogy with the syntax of the
+ _\bh_\bi_\bs_\bt_\bo_\br_\by mechanism (described below), `%%' is also a synonym for the cur-
+ rent job.
+
+ The job control mechanism requires that the stty(1) option n\bne\bew\bw be set. It
+ is an artifact from a _\bn_\be_\bw implementation of the tty driver that allows
+ generation of interrupt characters from the keyboard to tell jobs to
+ stop. See stty(1) for details on setting options in the new tty driver.
+
+ S\bSt\bta\bat\btu\bus\bs r\bre\bep\bpo\bor\brt\bti\bin\bng\bg
+ This shell learns immediately whenever a process changes state. It nor-
+ mally informs you whenever a job becomes blocked so that no further
+ progress is possible, but only just before it prints a prompt. This is
+ done so that it does not otherwise disturb your work. If, however, you
+ set the shell variable _\bn_\bo_\bt_\bi_\bf_\by, the shell will notify you immediately of
+ changes of status in background jobs. There is also a shell command
+ _\bn_\bo_\bt_\bi_\bf_\by that marks a single process so that its status changes will be im-
+ mediately reported. By default _\bn_\bo_\bt_\bi_\bf_\by marks the current process; simply
+ say `notify' after starting a background job to mark it.
+
+ When you try to leave the shell while jobs are stopped, you will be
+ warned that `You have stopped jobs.' You may use the _\bj_\bo_\bb_\bs 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.
+
+ F\bFi\bil\ble\be N\bNa\bam\bme\be C\bCo\bom\bmp\bpl\ble\bet\bti\bio\bon\bn
+ When the file name completion feature is enabled by setting the shell
+ variable _\bf_\bi_\bl_\be_\bc (see s\bse\bet\bt), c\bcs\bsh\bh will interactively complete file names and
+ user names from unique prefixes, when they are input from the terminal
+ followed by the escape character (the escape key, or control-[) For exam-
+ ple, if the current directory looks like
+
+ DSC.OLD bin cmd lib xmpl.c
+ DSC.NEW chaosnet cmtest mail xmpl.o
+ bench class dev mbox xmpl.out
+
+ and the input is
+
+ % vi ch<escape>
+
+ c\bcs\bsh\bh will complete the prefix ``ch'' to the only matching file name
+ ``chaosnet'', changing the input line to
+
+ % vi chaosnet
+
+ However, given
+
+ % vi D<escape>
+
+ c\bcs\bsh\bh will only expand the input to
+
+ % vi DSC.
+
+ and will sound the terminal bell to indicate that the expansion is incom-
+ plete, since there are two file names matching the prefix ``D''.
+
+ If a partial file name is followed by the end-of-file character (usually
+ control-D), then, instead of completing the name, c\bcs\bsh\bh will list all file
+ names matching the prefix. For example, the input
+
+ % vi D<control-D>
+
+ causes all files beginning with ``D'' to be listed:
+
+ DSC.NEW DSC.OLD
+
+ while the input line remains unchanged.
+
+ The same system of escape and end-of-file can also be used to expand par-
+ tial user names, if the word to be completed (or listed) begins with the
+ character ``~''. For example, typing
+
+ cd ~ro<escape>
+
+ may produce the expansion
+
+ cd ~root
+
+ The use of the terminal bell to signal errors or multiple matches can be
+ inhibited by setting the variable _\bn_\bo_\bb_\be_\be_\bp.
+
+ Normally, all files in the particular directory are candidates for name
+ completion. Files with certain suffixes can be excluded from considera-
+ tion by setting the variable _\bf_\bi_\bg_\bn_\bo_\br_\be to the list of suffixes to be ig-
+ nored. Thus, if _\bf_\bi_\bg_\bn_\bo_\br_\be is set by the command
+
+ % set fignore = (.o .out)
+
+ then typing
+
+ % vi x<escape>
+
+ would result in the completion to
+
+ % vi xmpl.c
+
+ ignoring the files "xmpl.o" and "xmpl.out". However, if the only comple-
+ tion possible requires not ignoring these suffixes, then they are not ig-
+ nored. In addition, _\bf_\bi_\bg_\bn_\bo_\br_\be does not affect the listing of file names by
+ control-D. All files are listed regardless of their suffixes.
+
+ S\bSu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bns\bs
+ We now describe the various transformations the shell performs on the in-
+ put in the order in which they occur.
+
+ H\bHi\bis\bst\bto\bor\bry\by s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bns\bs
+ History substitutions place words from previous command input as portions
+ of new commands, 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 `!' and may begin _\ba_\bn_\by_\bw_\bh_\be_\br_\be
+ in the input stream (with the proviso that they d\bdo\bo n\bno\bot\bt nest.) This `!'
+ may be preceded by a `\' to prevent its special meaning; for convenience,
+ an `!' is passed unchanged when it is followed by a blank, tab, newline,
+ `=' or `('. (History substitutions also occur when an input line begins
+ with `^'. This special abbreviation will be described later.) Any input
+ line that contains history substitution is echoed on the terminal before
+ it is executed as it could have been typed without history substitution.
+
+ Commands input from the terminal that consist of one or more words are
+ saved on the history list. The history substitutions reintroduce se-
+ quences of words from these saved commands into the input stream. The
+ size of the history list is controlled by the _\bh_\bi_\bs_\bt_\bo_\br_\by variable; the pre-
+ vious command is always retained, regardless of the value of the history
+ variable. Commands are numbered sequentially from 1.
+
+ For definiteness, consider the following output from the _\bh_\bi_\bs_\bt_\bo_\br_\by command:
+
+ 9 write michael
+ 10 ex write.c
+ 11 cat oldwrite.c
+ 12 diff *write.c
+
+ The commands are shown with their event numbers. It is not usually nec-
+ essary to use event numbers, but the current event number can be made
+ part of the _\bp_\br_\bo_\bm_\bp_\bt by placing an `!' in the prompt string.
+
+ With the current event 13 we can refer to previous events by event number
+ `!11', relatively as in `!-2' (referring to the same event), by a prefix
+ of a command word as in `!d' for event 12 or `!wri' for event 9, or by a
+ string contained in a word in the command as in `!?mic?' also referring
+ to event 9. These forms, without further change, simply reintroduce the
+ words of the specified events, each separated by a single blank. As a
+ special case, `!!' refers to the previous command; thus `!!' alone is a
+ _\br_\be_\bd_\bo.
+
+ To select words from an event we can follow the event specification by a
+ `:' and a designator for the desired words. The words of an input line
+ are numbered from 0, the first (usually command) word being 0, the second
+ word (first argument) being 1, etc. The basic word designators are:
+
+ 0 first (command) word
+ _\bn _\bn'th argument
+ ^ first argument, i.e., `1'
+ $ last argument
+ % word matched by (immediately preceding) ?_\bs? search
+ _\bx_\b-_\by range of words
+ _\b-_\by abbreviates _\b`_\b0_\b-_\by_\b'
+ * abbreviates `^-$', or nothing if only 1 word in event
+ _\bx_\b* abbreviates _\b`_\bx_\b-_\b$_\b'
+ _\bx_\b- like _\b`_\bx_\b*_\b' but omitting word `$'
+
+ The `:' separating the event specification from the word designator can
+ be omitted if the argument selector begins with a `^', `$', `*' `-' or
+ `%'. After the optional word designator can be placed a sequence of mod-
+ ifiers, each preceded by a `:'. The following modifiers are defined:
+
+ h Remove a trailing pathname component, leaving the head.
+ r Remove a trailing `.xxx' component, leaving the root name.
+ e Remove all but the extension `.xxx' part.
+ s_\b/_\bl_\b/_\br_\b/ Substitute _\bl for _\br
+ t Remove all leading pathname components, leaving the tail.
+ & Repeat the previous substitution.
+ g Apply the change once on each word, prefixing the above,
+ e.g., `g&'.
+ a Apply the change as many times as possible on a single
+ word, prefixing the above. It can be used together with `g'
+ to apply a substitution globally.
+ p Print the new command line but do not execute it.
+ q Quote the substituted words, preventing further substitu-
+ tions.
+ x Like q, but break into words at blanks, tabs and newlines.
+
+ Unless preceded by a `g' the change is applied only to the first modifi-
+ able word. With substitutions, it is an error for no word to be applica-
+ ble.
+
+ The left hand side of substitutions are not regular expressions in the
+ sense of the editors, but instead strings. Any character may be used as
+ the delimiter in place of `/'; a `\' quotes the delimiter into the _\bl and
+ _\br strings. The character `&' in the right hand side is replaced by the
+ text from the left. A `\' also quotes `&'. A null _\bl (`//') uses the
+ previous string either from an _\bl or from a contextual scan string _\bs in
+ `!?_\bs\?'. The trailing delimiter in the substitution may be omitted if a
+ newline follows immediately as may the trailing `?' in a contextual scan.
+
+ A history reference may be given without an event specification, e.g.,
+ `!$'. Here, the reference is to the previous command unless a previous
+ history reference occurred on the same line in which case this form re-
+ peats the previous reference. Thus `!?foo?^ !$' gives the first and last
+ arguments from the command matching `?foo?'.
+
+ A special abbreviation of a history reference occurs when the first non-
+ blank character of an input line is a `^'. This is equivalent to `!:s^'
+ providing a convenient shorthand for substitutions on the text of the
+ previous line. Thus `^lb^lib' fixes the spelling of `lib' in the previ-
+ ous command. Finally, a history substitution may be surrounded with `{'
+ and `}' if necessary to insulate it from the characters that follow.
+ Thus, after `ls -ld ~paul' we might do `!{l}a' to do `ls -ld ~paula',
+ while `!la' would look for a command starting with `la'.
+
+ Q\bQu\buo\bot\bta\bat\bti\bio\bon\bns\bs w\bwi\bit\bth\bh '\b' a\ban\bnd\bd "\b"
+ The quotation of strings by `'' and `"' can be used to prevent all or
+ some of the remaining substitutions. Strings enclosed in `'' are pre-
+ vented any further interpretation. Strings enclosed in `"' may be ex-
+ panded as described below.
+
+ In both cases the resulting text becomes (all or part of) a single word;
+ only in one special case (see _\bC_\bo_\bm_\bm_\ba_\bn_\bd _\bS_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn below) does a `"'
+ quoted string yield parts of more than one word; `'' quoted strings never
+ do.
+
+ A\bAl\bli\bia\bas\bs s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
+ The shell maintains a list of aliases that can be established, displayed
+ and modified by the _\ba_\bl_\bi_\ba_\bs and _\bu_\bn_\ba_\bl_\bi_\ba_\bs commands. After a command line is
+ scanned, it is parsed into distinct commands and the first word of each
+ command, left-to-right, is checked to see if it has an alias. If it
+ does, then the text that is the alias for that command is reread with the
+ history mechanism available as though that command were the previous in-
+ put line. The resulting words replace the command and argument list. If
+ no reference is made to the history list, then the argument list is left
+ unchanged.
+
+ Thus if the alias for `ls' is `ls -l' the command `ls /usr' would map to
+ `ls -l /usr', the argument list here being undisturbed. Similarly if the
+ alias for `lookup' was `grep !^ /etc/passwd' then `lookup bill' would map
+ to `grep bill /etc/passwd'.
+
+ If an alias is found, the word transformation of the input text is per-
+ formed and the aliasing process begins again on the reformed input line.
+ Looping is prevented if the first word of the new text is the same as the
+ old by flagging it to prevent further aliasing. Other loops are detected
+ and cause an error.
+
+ Note that the mechanism allows aliases to introduce parser metasyntax.
+ Thus, we can `alias print 'pr \!* | lpr'' to make a command that _\bp_\br's its
+ arguments to the line printer.
+
+ V\bVa\bar\bri\bia\bab\bbl\ble\be s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
+ The shell maintains a set of variables, each of which has as value a list
+ of zero or more words. Some of these variables are set by the shell or
+ referred to by it. For instance, the _\ba_\br_\bg_\bv variable is an image of the
+ shell's argument list, and words of this variable's value are referred to
+ in special ways.
+
+ The values of variables may be displayed and changed by using the _\bs_\be_\bt and
+ _\bu_\bn_\bs_\be_\bt commands. Of the variables referred to by the shell a number are
+ toggles; the shell does not care what their value is, only whether they
+ are set or not. For instance, the _\bv_\be_\br_\bb_\bo_\bs_\be variable is a toggle that
+ causes command input to be echoed. The setting of this variable results
+ from the -\b-v\bv command line option.
+
+ Other operations treat variables numerically. The `@' command permits
+ numeric calculations to be performed and the result assigned to a vari-
+ able. Variable values are, however, always represented as (zero or more)
+ strings. For the purposes of numeric operations, the null string is con-
+ sidered to be zero, and the second and additional words of multiword val-
+ ues 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 `"'s where it _\ba_\bl_\bw_\ba_\by_\bs occurs, and within `''s where it _\bn_\be_\bv_\be_\br oc-
+ curs. Strings quoted by ``' are interpreted later (see C\bCo\bom\bmm\bma\ban\bnd\bd
+ s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn below) so `$' substitution does not occur there until later,
+ if at all. A `$' is passed unchanged if followed by a blank, tab, or
+ end-of-line.
+
+ Input/output redirections are recognized before variable expansion, and
+ are variable expanded separately. Otherwise, the command name and entire
+ argument list are expanded together. It is thus possible for the first
+ (command) word (to this point) to generate more than one word, the first
+ of which becomes the command name, and the rest of which become argu-
+ ments.
+
+ 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 (por-
+ tion of) a single word, with the words of the variables value separated
+ by blanks. When the `:q' modifier is applied to a substitution the vari-
+ able will expand to multiple words with each word separated by a blank
+ and quoted to prevent later command or filename substitution.
+
+ The following metasequences are provided for introducing variable values
+ into the shell input. Except as noted, it is an error to reference a
+ variable that is not set.
+
+ $name
+ ${name}
+ Are replaced by the words of the value of variable _\bn_\ba_\bm_\be,
+ each separated by a blank. Braces insulate _\bn_\ba_\bm_\be from fol-
+ lowing characters that would otherwise be part of it.
+ Shell variables have names consisting of up to 20 letters
+ and digits starting with a letter. The underscore charac-
+ ter is considered a letter. If _\bn_\ba_\bm_\be is not a shell vari-
+ able, but is set in the environment, then that value is re-
+ turned (but : modifiers and the other forms given below are
+ not available here).
+ $name[selector]
+ ${name[selector] }
+ May be used to select only some of the words from the value
+ of _\bn_\ba_\bm_\be. The selector is subjected to `$' substitution and
+ may consist of a single number or two numbers separated by
+ a `-'. The first word of a variables value is numbered
+ `1'. If the first number of a range is omitted it defaults
+ to `1'. If the last number of a range is omitted it de-
+ faults to `$#name'. The selector `*' selects all words.
+ It is not an error for a range to be empty if the second
+ argument is omitted or in range.
+ $#name
+ ${#name}
+ Gives the number of words in the variable. This is useful
+ for later use in a `$argv[selector]'.
+ $0 Substitutes the name of the file from which command input
+ is being read. An error occurs if the name is not known.
+ $number
+ ${number}
+ Equivalent to `$argv[number]'.
+ $* Equivalent to `$argv[*]'. The modifiers `:e', `:h', `:t',
+ `:r', `:q' and `:x' may be applied to the substitutions
+ above as may `:gh', `:gt' and `:gr'. If braces `{' '}' ap-
+ pear in the command form then the modifiers must appear
+ within the braces. The current implementation allows only
+ one `:' modifier on each `$' expansion.
+
+ The following substitutions may not be modified with `:' modifiers.
+ $?name
+ ${?name}
+ Substitutes the string `1' if name is set, `0' if it is
+ not.
+ $?0 Substitutes `1' if the current input filename is known, `0'
+ if it is not.
+ $$ Substitute the (decimal) process number of the (parent)
+ shell.
+ $! Substitute the (decimal) process number of the last back-
+ ground process started by this shell.
+ $< Substitutes a line from the standard input, with no further
+ interpretation. It can be used to read from the keyboard
+ in a shell script.
+
+ C\bCo\bom\bmm\bma\ban\bnd\bd a\ban\bnd\bd f\bfi\bil\ble\ben\bna\bam\bme\be s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
+ The remaining substitutions, command and filename substitution, are ap-
+ plied selectively to the arguments of builtin commands. By selectively,
+ we mean that portions of expressions which are not evaluated are not sub-
+ jected to these expansions. For commands that are not internal to the
+ shell, the command name is substituted separately from the argument list.
+ This occurs very late, after input-output redirection is performed, and
+ in a child of the main shell.
+
+ C\bCo\bom\bmm\bma\ban\bnd\bd s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
+ Command substitution is shown by a command enclosed in ``'. The output
+ from such a command is normally broken into separate words at blanks,
+ tabs and newlines, with null words being discarded; this text then re-
+ places the original string. Within `"'s, only newlines force new words;
+ blanks and tabs are preserved.
+
+ In any case, the single final newline does not force a new word. Note
+ that it is thus possible for a command substitution to yield only part of
+ a word, even if the command outputs a complete line.
+
+ F\bFi\bil\ble\ben\bna\bam\bme\be s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn
+ If a word contains any of the characters `*', `?', `[' or `{' or begins
+ with the character `~', then that word is a candidate for filename sub-
+ stitution, also known as `globbing'. This word is then regarded as a
+ pattern, and replaced with an alphabetically sorted list of file names
+ that match the pattern. In a list of words specifying filename substitu-
+ tion it is an error for no pattern to match an existing file name, but it
+ is not required for each pattern to match. Only the metacharacters `*',
+ `?' and `[' imply pattern matching, the characters `~' and `{' being more
+ akin to abbreviations.
+
+ In matching filenames, the character `.' at the beginning of a filename
+ or immediately following a `/', as well as the character `/' must be
+ matched explicitly. The character `*' matches any string of characters,
+ including the null string. The character `?' matches any single charac-
+ ter. The sequence `[...]' matches any one of the characters enclosed.
+ Within `[...]', a pair of characters separated by `-' matches any charac-
+ ter lexically between the two (inclusive).
+
+ The character `~' at the beginning of a filename refers to home directo-
+ ries. Standing alone, i.e., `~' it expands to the invokers home directo-
+ ry as reflected in the value of the variable _\bh_\bo_\bm_\be. When followed by a
+ name consisting of letters, digits and `-' characters, the shell searches
+ for a user with that name and substitutes their home directory; thus
+ `~ken' might expand to `/usr/ken' and `~ken/chmach' to `/usr/ken/chmach'.
+ If the character `~' is followed by a character other than a letter or
+ `/' or does not appear at the beginning of a word, it is left undis-
+ turbed.
+
+ The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'. Left to
+ right order is preserved, with results of matches being sorted separately
+ at a low level to preserve this order. This construct may be nested.
+ Thus, `~source/s1/{oldls,ls}.c' expands to `/usr/source/s1/oldls.c
+ /usr/source/s1/ls.c' without chance of error if the home directory for
+ `source' is `/usr/source'. Similarly `../{memo,*box}' might expand to
+ `../memo ../box ../mbox'. (Note that `memo' was not sorted with the re-
+ sults of the match to `*box'.) As a special case `{', `}' and `{}' are
+ passed undisturbed.
+
+ I\bIn\bnp\bpu\but\bt/\b/o\bou\but\btp\bpu\but\bt
+ The standard input and the standard output of a command may be redirected
+ with the following syntax:
+
+
+
+ < name Open file _\bn_\ba_\bm_\be (which is first variable, command and file-
+ name expanded) as the standard input.
+ << word
+ Read the shell input up to a line that is identical to
+ _\bw_\bo_\br_\bd. _\bW_\bo_\br_\bd is not subjected to variable, filename or com-
+ mand substitution, and each input line is compared to _\bw_\bo_\br_\bd
+ before any substitutions are done on the input line. Un-
+ less a quoting `\', `"', `' or ``' appears in _\bw_\bo_\br_\bd, vari-
+ able and command substitution is performed on the interven-
+ ing lines, allowing `\' to quote `$', `\' and ``'. Com-
+ mands that are substituted have all blanks, tabs, and new-
+ lines preserved, except for the final newline which is
+ dropped. The resultant text is placed in an anonymous tem-
+ porary file that is given to the command as its standard
+ input.
+ > name
+ >! name
+ >& name
+ >&! name
+ The file _\bn_\ba_\bm_\be is used as the standard output. If the file
+ does not exist then it is created; if the file exists, it
+ is truncated; its previous contents are lost.
+
+ If the variable _\bn_\bo_\bc_\bl_\bo_\bb_\bb_\be_\br 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 acci-
+ dental destruction of files. Here, the `!' forms can be
+ used to suppress this check.
+
+ The forms involving `&' route the standard error output in-
+ to the specified file as well as the standard output. _\bN_\ba_\bm_\be
+ is expanded in the same way as `<' input filenames are.
+ >> name
+ >>& name
+ >>! name
+ >>&! name
+ Uses file _\bn_\ba_\bm_\be as the standard output; like `>' but places
+ output at the end of the file. If the variable _\bn_\bo_\bc_\bl_\bo_\bb_\bb_\be_\br
+ is set, then it is an error for the file not to exist un-
+ less one of the `!' forms is given. Otherwise similar to
+ `>'.
+
+ A command receives the environment in which the shell was invoked as mod-
+ ified 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; in-
+ stead they receive the original standard input of the shell. The `<<'
+ mechanism should be used to present inline data. This permits shell com-
+ mand scripts to function as components of pipelines and allows the shell
+ to block read its input. Note that the default standard input for a com-
+ mand run detached is _\bn_\bo_\bt modified to be the empty file _\b/_\bd_\be_\bv_\b/_\bn_\bu_\bl_\bl; instead
+ the standard input remains as the original standard input of the shell.
+ If this is a terminal and if the process attempts to read from the termi-
+ nal, then the process will block and the user will be notified (see _\bJ_\bo_\bb_\bs
+ above).
+
+ The standard error output may be directed through a pipe with the stan-
+ dard output. Simply use the form `|&' instead of just `|'.
+
+ E\bEx\bxp\bpr\bre\bes\bss\bsi\bio\bon\bns\bs
+ Several of the builtin commands (to be described later) take expressions,
+ in which the operators are similar to those of C, with the same prece-
+ dence. These expressions appear in the @\b@,\b, _\be_\bx_\bi_\bt, _\bi_\bf, and _\bw_\bh_\bi_\bl_\be commands.
+ The following operators are available:
+
+ || && | ^ & == != =~ !~ <= >= < > << >> + - * / %
+ ! ~ ( )
+
+ Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<='
+ `>=' `<' and `>', `<<' and `>>', `+' and `-', `*' `/' and `%' being, in
+ groups, at the same level. The `==' `!=' `=~' and `!~' operators compare
+ their arguments as strings; all others operate on numbers. The operators
+ `=~' and `!~' are like `!=' and `==' except that the right hand side is a
+ _\bp_\ba_\bt_\bt_\be_\br_\bn (containing, e.g., `*'s, `?'s and instances of `[...]') against
+ which the left hand operand is matched. This reduces the need for use of
+ the _\bs_\bw_\bi_\bt_\bc_\bh statement in shell scripts when all that is really needed is
+ pattern matching.
+
+ Strings that begin with `0' are considered octal numbers. Null or miss-
+ ing arguments are considered `0'. The result 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 that are syntactically signif-
+ icant to the parser (`&' `|' `<' `>' `(' `)'), they should be surrounded
+ by spaces.
+
+ Also available in expressions as primitive operands are command execu-
+ tions enclosed in `{' and `}' and file enquiries of the form -\b-l\bl _\bn_\ba_\bm_\be
+ where l\bl is one of:
+
+ r read access
+ w write access
+ x execute access
+ e existence
+ o ownership
+ z zero size
+ f plain file
+ d directory
+
+ The specified name is command and filename expanded and then tested to
+ see if it has the specified relationship to the real user. If the file
+ does not exist or is inaccessible then all enquiries return false, i.e.,
+ `0'. Command executions succeed, returning true, i.e., `1', if the com-
+ mand exits with status 0, otherwise they fail, returning false, i.e.,
+ `0'. If more detailed status information is required then the command
+ should be executed outside an expression and the variable _\bs_\bt_\ba_\bt_\bu_\bs exam-
+ ined.
+
+ C\bCo\bon\bnt\btr\bro\bol\bl f\bfl\blo\bow\bw
+ The shell contains several commands that can be used to regulate the flow
+ of control in command files (shell scripts) and (in limited but useful
+ ways) from terminal input. These commands all operate by forcing the
+ shell to reread or skip in its input and, because of the implementation,
+ restrict the placement of some of the commands.
+
+ The f\bfo\bor\bre\bea\bac\bch\bh, s\bsw\bwi\bit\btc\bch\bh, and w\bwh\bhi\bil\ble\be statements, as well as the i\bif\bf-\b-t\bth\bhe\ben\bn-\b-e\bel\bls\bse\be
+ form of the i\bif\bf statement require that the major keywords appear in a sin-
+ gle 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 accom-
+ plish the rereading implied by the loop. (To the extent that this al-
+ lows, backward goto's will succeed on non-seekable inputs.)
+
+ B\bBu\bui\bil\blt\bti\bin\bn c\bco\bom\bmm\bma\ban\bnd\bds\bs
+ Builtin commands are executed within the shell. If a builtin command oc-
+ curs as any component of a pipeline except the last then it is executed
+ in a subshell.
+
+ a\bal\bli\bia\bas\bs
+ a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be
+
+ a\bal\bli\bia\bas\bs _\bn_\ba_\bm_\be _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
+ The first form prints all aliases. The second form prints
+ the alias for name. The final form assigns the specified
+ _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt as the alias of _\bn_\ba_\bm_\be; _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt is command and
+ filename substituted. _\bN_\ba_\bm_\be is not allowed to be _\ba_\bl_\bi_\ba_\bs or
+ _\bu_\bn_\ba_\bl_\bi_\ba_\bs.
+
+ a\bal\bll\blo\boc\bc Shows the amount of dynamic memory acquired, broken down
+ into used and free memory. With an argument shows the num-
+ ber of free and used blocks in each size category. The
+ categories start at size 8 and double at each step. This
+ command's output may vary across system types, since sys-
+ tems other than the VAX may use a different memory alloca-
+ tor.
+
+ b\bbg\bg
+ b\bbg\bg %\b%_\bj_\bo_\bb _\b._\b._\b.
+ Puts the current or specified jobs into the background,
+ continuing them if they were stopped.
+
+ b\bbr\bre\bea\bak\bk Causes execution to resume after the e\ben\bnd\bd of the nearest en-
+ closing f\bfo\bor\bre\bea\bac\bch\bh or w\bwh\bhi\bil\ble\be. The remaining commands on the
+ current line are executed. Multi-level breaks are thus
+ possible by writing them all on one line.
+
+ b\bbr\bre\bea\bak\bks\bsw\bw
+ Causes a break from a s\bsw\bwi\bit\btc\bch\bh, resuming after the e\ben\bnd\bds\bsw\bw.
+
+ c\bca\bas\bse\be _\bl_\ba_\bb_\be_\bl:
+ A label in a s\bsw\bwi\bit\btc\bch\bh statement as discussed below.
+
+ c\bcd\bd
+ c\bcd\bd _\bn_\ba_\bm_\be
+ c\bch\bhd\bdi\bir\br
+ c\bch\bhd\bdi\bir\br _\bn_\ba_\bm_\be
+ Change the shell's working directory to directory _\bn_\ba_\bm_\be. If
+ no argument is given then change to the home directory of
+ the user. If _\bn_\ba_\bm_\be is not found as a subdirectory of the
+ current directory (and does not begin with `/', `./' or
+ `../'), then each component of the variable c\bcd\bdp\bpa\bat\bth\bh is
+ checked to see if it has a subdirectory _\bn_\ba_\bm_\be. Finally, if
+ all else fails but _\bn_\ba_\bm_\be is a shell variable whose value be-
+ gins with `/', then this is tried to see if it is a direc-
+ tory.
+
+ c\bco\bon\bnt\bti\bin\bnu\bue\be
+ Continue execution of the nearest enclosing w\bwh\bhi\bil\ble\be or
+ f\bfo\bor\bre\bea\bac\bch\bh. The rest of the commands on the current line are
+ executed.
+
+ d\bde\bef\bfa\bau\bul\blt\bt:
+ Labels the default case in a s\bsw\bwi\bit\btc\bch\bh statement. The default
+ should come after all c\bca\bas\bse\be labels.
+
+ d\bdi\bir\brs\bs Prints the directory stack; the top of the stack is at the
+ left, the first directory in the stack being the current
+ directory.
+
+ e\bec\bch\bho\bo _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
+ e\bec\bch\bho\bo -\b-n\bn _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
+ The specified words are written to the shell's standard
+ output, separated by spaces, and terminated with a newline
+ unless the -\b-n\bn option is specified.
+
+ e\bel\bls\bse\be
+
+
+ e\ben\bnd\bd
+ e\ben\bnd\bdi\bif\bf
+ e\ben\bnd\bds\bsw\bw See the description of the f\bfo\bor\bre\bea\bac\bch\bh, i\bif\bf, s\bsw\bwi\bit\btc\bch\bh, and w\bwh\bhi\bil\ble\be
+ statements below.
+
+ e\bev\bva\bal\bl _\ba_\br_\bg _\b._\b._\b.
+ (As in sh(1).) The arguments are read as input to the
+ shell and the resulting command(s) executed in the context
+ of the current shell. This is usually used to execute com-
+ mands generated as the result of command or variable sub-
+ stitution, since parsing occurs before these substitutions.
+ See tset(1) for an example of using e\bev\bva\bal\bl.
+
+ e\bex\bxe\bec\bc _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ The specified command is executed in place of the current
+ shell.
+
+ e\bex\bxi\bit\bt
+ e\bex\bxi\bit\bt _\b(_\be_\bx_\bp_\br)
+ The shell exits either with the value of the s\bst\bta\bat\btu\bus\bs vari-
+ able (first form) or with the value of the specified e\bex\bxp\bpr\br
+ (second form).
+
+ f\bfg\bg
+ f\bfg\bg %\b%_\bj_\bo_\bb _\b._\b._\b.
+ Brings the current or specified jobs into the foreground,
+ continuing them if they were stopped.
+
+ f\bfo\bor\bre\bea\bac\bch\bh _\bn_\ba_\bm_\be _\b(_\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt_\b)
+ ...
+ e\ben\bnd\bd The variable n\bna\bam\bme\be is successively set to each member of
+ w\bwo\bor\brd\bdl\bli\bis\bst\bt and the sequence of commands between this command
+ and the matching e\ben\bnd\bd are executed. (Both f\bfo\bor\bre\bea\bac\bch\bh and e\ben\bnd\bd
+ must appear alone on separate lines.) The builtin command
+ c\bco\bon\bnt\bti\bin\bnu\bue\be may be used to continue the loop prematurely and
+ the builtin command b\bbr\bre\bea\bak\bk to terminate it prematurely.
+ When this command is read from the terminal, the loop is
+ read once prompting with `?' 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.
+
+ g\bgl\blo\bob\bb _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt
+ Like e\bec\bch\bho\bo but no `\' escapes are recognized and words are
+ delimited by null characters in the output. Useful for
+ programs that wish to use the shell to filename expand a
+ list of words.
+
+ g\bgo\bot\bto\bo _\bw_\bo_\br_\bd
+ The specified w\bwo\bor\brd\bd is filename and command expanded to
+ yield a string of the form `label'. The shell rewinds its
+ input as much as possible and searches for a line of the
+ form `label:' possibly preceded by blanks or tabs. Execu-
+ tion continues after the specified line.
+
+ h\bha\bas\bsh\bhs\bst\bta\bat\bt
+ Print a statistics line showing how effective the internal
+ hash table has been at locating commands (and avoiding
+ e\bex\bxe\bec\bc's). An e\bex\bxe\bec\bc is attempted for each component of the
+ _\bp_\ba_\bt_\bh where the hash function indicates a possible hit, and
+ in each component that does not begin with a `/'.
+
+ h\bhi\bis\bst\bto\bor\bry\by
+ h\bhi\bis\bst\bto\bor\bry\by _\bn
+ h\bhi\bis\bst\bto\bor\bry\by -\b-r\br _\bn
+ h\bhi\bis\bst\bto\bor\bry\by -\b-h\bh _\bn
+ Displays the history event list; if _\bn is given only the _\bn
+ most recent events are printed. The -\b-r\br option reverses the
+ order of printout to be most recent first instead of oldest
+ first. The -\b-h\bh option causes the history list to be printed
+ without leading numbers. This format produces files suit-
+ able for sourcing using the -h option to s\bso\bou\bur\brc\bce\be.
+
+ i\bif\bf (_\be_\bx_\bp_\br) command
+ If the specified expression evaluates true, then the single
+ _\bc_\bo_\bm_\bm_\ba_\bn_\bd with arguments is executed. Variable substitution
+ on _\bc_\bo_\bm_\bm_\ba_\bn_\bd happens early, at the same time it does for the
+ rest of the i\bif\bf command. _\bC_\bo_\bm_\bm_\ba_\bn_\bd must be a simple command,
+ not a pipeline, a command list, or a parenthesized command
+ list. Input/output redirection occurs even if _\be_\bx_\bp_\br is
+ false, i.e., when command is n\bno\bot\bt executed (this is a bug).
+
+ i\bif\bf (_\be_\bx_\bp_\br) t\bth\bhe\ben\bn
+ ...
+ e\bel\bls\bse\be i\bif\bf (_\be_\bx_\bp_\br_\b2) t\bth\bhe\ben\bn
+ ...
+ e\bel\bls\bse\be
+ ...
+ e\ben\bnd\bdi\bif\bf If the specified _\be_\bx_\bp_\br is true then the commands up to the
+ first e\bel\bls\bse\be are executed; otherwise if _\be_\bx_\bp_\br_\b2 is true then
+ the commands up to the second e\bel\bls\bse\be are executed, etc. Any
+ number of e\bel\bls\bse\be-\b-i\bif\bf pairs are possible; only one e\ben\bnd\bdi\bif\bf is
+ needed. The e\bel\bls\bse\be part is likewise optional. (The words
+ e\bel\bls\bse\be and e\ben\bnd\bdi\bif\bf must appear at the beginning of input lines;
+ the i\bif\bf must appear alone on its input line or after an
+ e\bel\bls\bse\be.)
+
+ j\bjo\bob\bbs\bs
+ j\bjo\bob\bbs\bs -\b-l\bl
+ Lists the active jobs; the -\b-l\bl option lists process id's in
+ addition to the normal information.
+
+ k\bki\bil\bll\bl %\b%_\bj_\bo_\bb
+ k\bki\bil\bll\bl _\bp_\bi_\bd
+ k\bki\bil\bll\bl -\b-s\bsi\big\bg _\bp_\bi_\bd _\b._\b._\b.
+ k\bki\bil\bll\bl -\b-l\bl
+ Sends either the TERM (terminate) signal or the specified
+ signal to the specified jobs or processes. Signals are ei-
+ ther given by number or by names (as given in
+ _\b/_\bu_\bs_\br_\b/_\bi_\bn_\bc_\bl_\bu_\bd_\be_\b/_\bs_\bi_\bg_\bn_\ba_\bl_\b._\bh_\b, stripped of the prefix ``SIG'').
+ The signal names are listed by ``kill -l''. There is no
+ default, just saying `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 will be sent a
+ CONT (continue) signal as well.
+
+ l\bli\bim\bmi\bit\bt
+ l\bli\bim\bmi\bit\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be
+ l\bli\bim\bmi\bit\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be _\bm_\ba_\bx_\bi_\bm_\bu_\bm_\b-_\bu_\bs_\be
+ l\bli\bim\bmi\bit\bt -\b-h\bh
+ l\bli\bim\bmi\bit\bt -\b-h\bh _\br_\be_\bs_\bo_\bu_\br_\bc_\be
+ l\bli\bim\bmi\bit\bt -\b-h\bh _\br_\be_\bs_\bo_\bu_\br_\bc_\be _\bm_\ba_\bx_\bi_\bm_\bu_\bm_\b-_\bu_\bs_\be
+ Limits the consumption by the current process and each pro-
+ cess it creates to not individually exceed _\bm_\ba_\bx_\bi_\bm_\bu_\bm_\b-_\bu_\bs_\be on
+ the specified _\br_\be_\bs_\bo_\bu_\br_\bc_\be. If no _\bm_\ba_\bx_\bi_\bm_\bu_\bm_\b-_\bu_\bs_\be is given, then
+ the current limit is printed; if no _\br_\be_\bs_\bo_\bu_\br_\bc_\be is given, then
+ all limitations are given. If the -\b-h\bh 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 le-
+ gal range.
+
+ Resources controllable currently include _\bc_\bp_\bu_\bt_\bi_\bm_\be (the maxi-
+ mum number of cpu-seconds to be used by each process),
+ _\bf_\bi_\bl_\be_\bs_\bi_\bz_\be (the largest single file that can be created),
+ _\bd_\ba_\bt_\ba_\bs_\bi_\bz_\be (the maximum growth of the data+stack region via
+ sbrk(2) beyond the end of the program text), _\bs_\bt_\ba_\bc_\bk_\bs_\bi_\bz_\be (the
+ maximum size of the automatically-extended stack region),
+ and _\bc_\bo_\br_\be_\bd_\bu_\bm_\bp_\bs_\bi_\bz_\be (the size of the largest core dump that
+ will be created). (.ne 1i
+
+ The _\bm_\ba_\bx_\bi_\bm_\bu_\bm_\b-_\bu_\bs_\be may be given as a (floating point or inte-
+ ger) number followed by a scale factor. For all limits
+ other than _\bc_\bp_\bu_\bt_\bi_\bm_\be the default scale is `k' or `kilobytes'
+ (1024 bytes); a scale factor of `m' or `megabytes' may also
+ be used. For _\bc_\bp_\bu_\bt_\bi_\bm_\be the default scale is `seconds'; a
+ scale factor of `m' for minutes or `h' for hours, or a time
+ of the form `mm:ss' giving minutes and seconds also may be
+ used.
+
+ For both _\br_\be_\bs_\bo_\bu_\br_\bc_\be names and scale factors, unambiguous pre-
+ fixes of the names suffice.
+
+ l\blo\bog\bgi\bin\bn Terminate a login shell, replacing it with an instance of
+ _\b/_\bb_\bi_\bn_\b/_\bl_\bo_\bg_\bi_\bn_\b. This is one way to log off, included for com-
+ patibility with sh(1).
+
+ l\blo\bog\bgo\bou\but\bt Terminate a login shell. Especially useful if i\big\bgn\bno\bor\bre\bee\beo\bof\bf is
+ set.
+
+ n\bni\bic\bce\be
+ n\bni\bic\bce\be _\b+_\bn_\bu_\bm_\bb_\be_\br
+ n\bni\bic\bce\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ n\bni\bic\bce\be _\b+_\bn_\bu_\bm_\bb_\be_\br _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ The first form sets the scheduling priority for this shell
+ to 4. The second form sets the priority to the given
+ _\bn_\bu_\bm_\bb_\be_\br. The final two forms run command at priority 4 and
+ _\bn_\bu_\bm_\bb_\be_\br respectively. The greater the number, the less cpu
+ the process will get. The super-user may specify negative
+ priority by using `nice -number ...'. _\bC_\bo_\bm_\bm_\ba_\bn_\bd is always
+ executed in a sub-shell, and the restrictions placed on
+ commands in simple i\bif\bf statements apply.
+
+ n\bno\boh\bhu\bup\bp
+ n\bno\boh\bhu\bup\bp _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ The first form can be used in shell scripts to cause
+ hangups to be ignored for the remainder of the script. The
+ second form causes the specified command to be run with
+ hangups ignored. All processes detached with `&' are ef-
+ fectively n\bno\boh\bhu\bup\bp'ed.
+
+ n\bno\bot\bti\bif\bfy\by
+ n\bno\bot\bti\bif\bfy\by %\b%_\bj_\bo_\bb _\b._\b._\b.
+ Causes the shell to notify the user asynchronously when the
+ status of the current or specified jobs change; normally
+ notification is presented before a prompt. This is auto-
+ matic if the shell variable n\bno\bot\bti\bif\bfy\by is set.
+
+ o\bon\bni\bin\bnt\btr\br
+ o\bon\bni\bin\bnt\btr\br -\b-
+ o\bon\bni\bin\bnt\btr\br _\bl_\ba_\bb_\be_\bl
+ Control the action of the shell on interrupts. The first
+ form restores the default action of the shell on interrupts
+ which is to terminate shell scripts or to return to the
+ terminal command input level. The second form `onintr -'
+ causes all interrupts to be ignored. The final form causes
+ the shell to execute a `goto label' when an interrupt is
+ received or a child process terminates because it was in-
+ terrupted.
+
+
+ In any case, if the shell is running detached and inter-
+ rupts are being ignored, all forms of o\bon\bni\bin\bnt\btr\br have no mean-
+ ing and interrupts continue to be ignored by the shell and
+ all invoked commands. Finally o\bon\bni\bin\bnt\btr\br statements are ig-
+ nored in the system startup files where interrupts are dis-
+ abled (/etc/csh.cshrc, /etc/csh.login).
+
+ p\bpo\bop\bpd\bd
+ p\bpo\bop\bpd\bd _\b+_\bn
+ Pops the directory stack, returning to the new top directo-
+ ry. With an argument `+ _\bn' discards the _\bn'th entry in the
+ stack. The members of the directory stack are numbered
+ from the top starting at 0.
+
+ p\bpu\bus\bsh\bhd\bd
+ p\bpu\bus\bsh\bhd\bd _\bn_\ba_\bm_\be
+ p\bpu\bus\bsh\bhd\bd _\bn
+ With no arguments, p\bpu\bus\bsh\bhd\bd exchanges the top two elements of
+ the directory stack. Given a _\bn_\ba_\bm_\be argument, p\bpu\bus\bsh\bhd\bd changes
+ to the new directory (ala c\bcd\bd) and pushes the old current
+ working directory (as in c\bcs\bsw\bw) onto the directory stack.
+ With a numeric argument, p\bpu\bus\bsh\bhd\bd rotates the _\bn'th argument of
+ the directory stack around to be the top element and
+ changes to it. The members of the directory stack are num-
+ bered from the top starting at 0.
+
+ r\bre\beh\bha\bas\bsh\bh Causes the internal hash table of the contents of the di-
+ rectories in the p\bpa\bat\bth\bh variable to be recomputed. This is
+ needed if new commands are added to directories in the p\bpa\bat\bth\bh
+ while you are logged in. This should only be necessary if
+ you add commands to one of your own directories, or if a
+ systems programmer changes the contents of a system direc-
+ tory.
+
+ r\bre\bep\bpe\bea\bat\bt _\bc_\bo_\bu_\bn_\bt _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ The specified _\bc_\bo_\bm_\bm_\ba_\bn_\bd which is subject to the same restric-
+ tions as the _\bc_\bo_\bm_\bm_\ba_\bn_\bd in the one line i\bif\bf statement above, is
+ executed _\bc_\bo_\bu_\bn_\bt times. I/O redirections occur exactly once,
+ even if _\bc_\bo_\bu_\bn_\bt is 0.
+
+ s\bse\bet\bt
+ s\bse\bet\bt _\bn_\ba_\bm_\be
+ s\bse\bet\bt _\bn_\ba_\bm_\be=word
+ s\bse\bet\bt _\bn_\ba_\bm_\be_\b[_\bi_\bn_\bd_\be_\bx_\b]=word
+ s\bse\bet\bt _\bn_\ba_\bm_\be=(wordlist)
+ The first form of the command shows the value of all shell
+ variables. Variables that have other than a single word as
+ their value print as a parenthesized word list. The second
+ form sets _\bn_\ba_\bm_\be to the null string. The third form sets
+ _\bn_\ba_\bm_\be to the single _\bw_\bo_\br_\bd. The fourth form sets the _\bi_\bn_\bd_\be_\bx'th
+ component of _\bn_\ba_\bm_\be to _\bw_\bo_\br_\bd; this component must already ex-
+ ist. The final form sets _\bn_\ba_\bm_\be to the list of words in
+ _\bw_\bo_\br_\bd_\bl_\bi_\bs_\bt. The value is always command and filename expand-
+ ed.
+
+ These arguments may be repeated to set multiple values in a
+ single set command. Note however, that variable expansion
+ happens for all arguments before any setting occurs.
+
+ s\bse\bet\bte\ben\bnv\bv
+ s\bse\bet\bte\ben\bnv\bv _\bn_\ba_\bm_\be
+ s\bse\bet\bte\ben\bnv\bv _\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be
+ The first form lists all current environment variables. It
+ is equivalent to printenv(1). The last form sets the value
+ of environment variable _\bn_\ba_\bm_\be to be _\bv_\ba_\bl_\bu_\be, a single string.
+ The second form sets _\bn_\ba_\bm_\be to an empty string. The most
+ commonly used environment variables USER, TERM, and PATH
+ are automatically imported to and exported from the c\bcs\bsh\bh
+ variables _\bu_\bs_\be_\br, _\bt_\be_\br_\bm, and _\bp_\ba_\bt_\bh; there is no need to use
+ s\bse\bet\bte\ben\bnv\bv for these.
+
+ s\bsh\bhi\bif\bft\bt
+ s\bsh\bhi\bif\bft\bt _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
+ The members of a\bar\brg\bgv\bv are shifted to the left, discarding
+ a\bar\brg\bgv\bv[1]. It is an error for a\bar\brg\bgv\bv not to be set or to have
+ less than one word as value. The second form performs the
+ same function on the specified variable.
+
+ s\bso\bou\bur\brc\bce\be _\bn_\ba_\bm_\be
+ s\bso\bou\bur\brc\bce\be -\b-h\bh _\bn_\ba_\bm_\be
+ The shell reads commands from _\bn_\ba_\bm_\be. S\bSo\bou\bur\brc\bce\be commands may be
+ nested; if they are nested too deeply the shell may run out
+ of file descriptors. An error in a s\bso\bou\bur\brc\bce\be at any level
+ terminates all nested s\bso\bou\bur\brc\bce\be commands. Normally input dur-
+ ing s\bso\bou\bur\brc\bce\be commands is not placed on the history list; the
+ -h option causes the commands to be placed on the history
+ list without being executed.
+
+ s\bst\bto\bop\bp
+ s\bst\bto\bop\bp %\b%_\bj_\bo_\bb _\b._\b._\b.
+ Stops the current or specified jobs that are executing in
+ the background.
+
+ s\bsu\bus\bsp\bpe\ben\bnd\bd
+ Causes the shell to stop in its tracks, much as if it had
+ been sent a stop signal with ^\b^Z\bZ. This is most often used to
+ stop shells started by su(1).
+
+ s\bsw\bwi\bit\btc\bch\bh _\b(_\bs_\bt_\br_\bi_\bn_\bg_\b)
+ c\bca\bas\bse\be _\bs_\bt_\br_\b1:
+ ...
+ b\bbr\bre\bea\bak\bks\bsw\bw
+ ...
+ d\bde\bef\bfa\bau\bul\blt\bt:
+ ...
+ b\bbr\bre\bea\bak\bks\bsw\bw
+ e\ben\bnd\bds\bsw\bw Each case label is successively matched against the speci-
+ fied _\bs_\bt_\br_\bi_\bn_\bg which is first command and filename expanded.
+ The file metacharacters `*', `?' and `[...]' may be used
+ in the case labels, which are variable expanded. If none
+ of the labels match before the `default' label is found,
+ then the execution begins after the default label. Each
+ case label and the default label must appear at the begin-
+ ning of a line. The command b\bbr\bre\bea\bak\bks\bsw\bw causes execution to
+ continue after the e\ben\bnd\bds\bsw\bw. Otherwise control may fall
+ through case labels and the default label as in C. If no
+ label matches and there is no default, execution continues
+ after the e\ben\bnd\bds\bsw\bw.
+
+ t\bti\bim\bme\be
+ t\bti\bim\bme\be _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ With no argument, a summary of time used by this shell and
+ its children is printed. If arguments are given the speci-
+ fied simple command is timed and a time summary as de-
+ scribed under the t\bti\bim\bme\be variable is printed. If necessary,
+ an extra shell is created to print the time statistic when
+ the command completes.
+
+ u\bum\bma\bas\bsk\bk
+ u\bum\bma\bas\bsk\bk _\bv_\ba_\bl_\bu_\be
+ The file creation mask is displayed (first form) or set to
+ the specified value (second form). The mask is given in
+ octal. Common values for the mask are 002 giving all ac-
+ cess to the group and read and execute access to others or
+ 022 giving all access except write access for users in the
+ group or others.
+
+ u\bun\bna\bal\bli\bia\bas\bs _\bp_\ba_\bt_\bt_\be_\br_\bn
+ All aliases whose names match the specified pattern are
+ discarded. Thus all aliases are removed by `unalias *'.
+ It is not an error for nothing to be u\bun\bna\bal\bli\bia\bas\bse\bed\bd.
+
+ u\bun\bnh\bha\bas\bsh\bh Use of the internal hash table to speed location of execut-
+ ed programs is disabled.
+
+ u\bun\bnl\bli\bim\bmi\bit\bt
+ u\bun\bnl\bli\bim\bmi\bit\bt _\br_\be_\bs_\bo_\bu_\br_\bc_\be
+ u\bun\bnl\bli\bim\bmi\bit\bt -\b-h\bh
+ u\bun\bnl\bli\bim\bmi\bit\bt -\b-h\bh _\br_\be_\bs_\bo_\bu_\br_\bc_\be
+ Removes the limitation on _\br_\be_\bs_\bo_\bu_\br_\bc_\be. If no _\br_\be_\bs_\bo_\bu_\br_\bc_\be is spec-
+ ified, then all _\br_\be_\bs_\bo_\bu_\br_\bc_\be limitations are removed. If -\b-h\bh is
+ given, the corresponding hard limits are removed. Only the
+ super-user may do this.
+
+ u\bun\bns\bse\bet\bt _\bp_\ba_\bt_\bt_\be_\br_\bn
+ All variables whose names match the specified pattern are
+ removed. Thus all variables are removed by `unset *'; this
+ has noticeably distasteful side-effects. It is not an er-
+ ror for nothing to be u\bun\bns\bse\bet\bt.
+
+ u\bun\bns\bse\bet\bte\ben\bnv\bv _\bp_\ba_\bt_\bt_\be_\br_\bn
+ Removes all variables whose name match the specified pat-
+ tern from the environment. See also the s\bse\bet\bte\ben\bnv\bv command
+ above and printenv(1).
+
+ w\bwa\bai\bit\bt Wait for all background jobs. If the shell is interactive,
+ then an interrupt can disrupt the wait. After the inter-
+ rupt, the shell prints names and job numbers of all jobs
+ known to be outstanding.
+ w\bwh\bhi\bic\bch\bh _\bc_\bo_\bm_\bm_\ba_\bn_\bd
+ Displays the resolved command that will be executed by the
+ shell.
+
+ w\bwh\bhi\bil\ble\be _\b(_\be_\bx_\bp_\br_\b)
+ ...
+ e\ben\bnd\bd While the specified expression evaluates non-zero, the com-
+ mands between the w\bwh\bhi\bil\ble\be and the matching e\ben\bnd\bd are evaluated.
+ B\bBr\bre\bea\bak\bk and c\bco\bon\bnt\bti\bin\bnu\bue\be may be used to terminate or continue the
+ loop prematurely. (The w\bwh\bhi\bil\ble\be and e\ben\bnd\bd must appear alone on
+ their input lines.) Prompting occurs here the first time
+ through the loop as for the f\bfo\bor\bre\bea\bac\bch\bh statement if the input
+ is a terminal.
+
+ %\b%_\bj_\bo_\bb Brings the specified job into the foreground.
+
+ %\b%_\bj_\bo_\bb &\b& Continues the specified job in the background.
+
+ @\b@
+ @\b@_\bn_\ba_\bm_\be= expr
+ @\b@_\bn_\ba_\bm_\be_\b[_\bi_\bn_\bd_\be_\bx_\b]= expr
+ The first form prints the values of all the shell vari-
+ ables. The second form sets the specified _\bn_\ba_\bm_\be to the val-
+ ue of _\be_\bx_\bp_\br. If the expression contains `<', `>', `&' or `|'
+ then at least this part of the expression must be placed
+ within `(' `)'. The third form assigns the value of _\be_\bx_\bp_\br
+ to the _\bi_\bn_\bd_\be_\bx'th argument of _\bn_\ba_\bm_\be. Both _\bn_\ba_\bm_\be and its
+ _\bi_\bn_\bd_\be_\bx'th component must already exist.
+
+
+ The operators `*=', `+=', etc are available as in C. The space separat-
+ ing the name from the assignment operator is optional. Spaces are, how-
+ ever, mandatory in separating components of _\be_\bx_\bp_\br which would otherwise be
+ single words.
+
+ Special postfix `++' and `--' operators increment and decrement _\bn_\ba_\bm_\be re-
+ spectively, i.e., `@ i++'.
+
+ P\bPr\bre\be-\b-d\bde\bef\bfi\bin\bne\bed\bd a\ban\bnd\bd e\ben\bnv\bvi\bir\bro\bon\bnm\bme\ben\bnt\bt v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
+ The following variables have special meaning to the shell. Of these,
+ _\ba_\br_\bg_\bv, _\bc_\bw_\bd_\b, _\bh_\bo_\bm_\be, _\bp_\ba_\bt_\bh_\b, _\bp_\br_\bo_\bm_\bp_\bt, _\bs_\bh_\be_\bl_\bl and _\bs_\bt_\ba_\bt_\bu_\bs are always set by the
+ shell. Except for _\bc_\bw_\bd and _\bs_\bt_\ba_\bt_\bu_\bs, this setting occurs only at initial-
+ ization; these variables will not then be modified unless done explicitly
+ by the user.
+
+ The shell copies the environment variable USER into the variable _\bu_\bs_\be_\br,
+ TERM into _\bt_\be_\br_\bm, and HOME into _\bh_\bo_\bm_\be, and copies these back into the envi-
+ ronment whenever the normal shell variables are reset. The environment
+ variable PATH is likewise handled; it is not necessary to worry about its
+ setting other than in the file _\b._\bc_\bs_\bh_\br_\bc as inferior c\bcs\bsh\bh processes will im-
+ port the definition of _\bp_\ba_\bt_\bh from the environment, and re-export it if you
+ then change it.
+
+ a\bar\brg\bgv\bv Set to the arguments to the shell, it is from this variable
+ that positional parameters are substituted, i.e., `$1' is re-
+ placed by `$argv[1]', etc.
+
+ c\bcd\bdp\bpa\bat\bth\bh Gives a list of alternate directories searched to find subdi-
+ rectories in _\bc_\bh_\bd_\bi_\br commands.
+
+ c\bcw\bwd\bd The full pathname of the current directory.
+
+ e\bec\bch\bho\bo Set when the -\b-x\bx command line option is given. Causes each
+ command and its arguments to be echoed just before it is exe-
+ cuted. For non-builtin commands all expansions occur before
+ echoing. Builtin commands are echoed before command and file-
+ name substitution, since these substitutions are then done se-
+ lectively.
+
+ f\bfi\bil\ble\bec\bc Enable file name completion.
+
+ h\bhi\bis\bst\btc\bch\bha\bar\brs\bs Can be given a string value to change the characters used in
+ history substitution. The first character of its value is
+ used as the history substitution character, replacing the de-
+ fault character `!'. The second character of its value re-
+ places the character `|\b^' in quick substitutions.
+
+ h\bhi\bis\bst\btf\bfi\bil\ble\be Can be set to the pathname where history is going to be
+ saved/restored.
+
+ h\bhi\bis\bst\bto\bor\bry\by Can be given a numeric value to control the size of the histo-
+ ry list. Any command that has been referenced in this many
+ events will not be discarded. Too large values of _\bh_\bi_\bs_\bt_\bo_\br_\by may
+ run the shell out of memory. The last executed command is al-
+ ways saved on the history list.
+
+ h\bho\bom\bme\be The home directory of the invoker, initialized from the envi-
+ ronment. The filename expansion of `_\b~' refers to this vari-
+ able.
+
+ i\big\bgn\bno\bor\bre\bee\beo\bof\bf If set the shell ignores end-of-file from input devices which
+ are terminals. This prevents shells from accidentally being
+ killed by control-D's.
+
+ m\bma\bai\bil\bl The files where the shell checks for mail. This checking is
+ done after each command completion that will result in a
+ prompt, if a specified interval has elapsed. The shell says
+ `You have new mail.' if the file exists with an access time
+ not greater than its modify time.
+
+ If the first word of the value of _\bm_\ba_\bi_\bl is numeric it specifies
+ a different mail checking interval, in seconds, than the de-
+ fault, which is 10 minutes.
+
+ If multiple mail files are specified, then the shell says `New
+ mail in _\bn_\ba_\bm_\be' when there is mail in the file _\bn_\ba_\bm_\be.
+
+ n\bno\boc\bcl\blo\bob\bbb\bbe\ber\br As described in the section on _\bi_\bn_\bp_\bu_\bt_\b/_\bo_\bu_\bt_\bp_\bu_\bt, restrictions are
+ placed on output redirection to insure that files are not ac-
+ cidentally destroyed, and that `>>' redirections refer to ex-
+ isting files.
+
+ n\bno\bog\bgl\blo\bob\bb If set, filename expansion is inhibited. This inhibition is
+ most useful in shell scripts that
+ are not dealing with filenames, or after a list of filenames
+ has been obtained and further expansions are not desirable.
+
+ n\bno\bon\bno\bom\bma\bat\btc\bch\bh If set, it is not an error for a filename expansion to not
+ match any existing files; instead the primitive pattern is re-
+ turned. It is still an error for the primitive pattern to be
+ malformed, i.e., `echo [' still gives an error.
+
+ n\bno\bot\bti\bif\bfy\by If set, the shell notifies asynchronously of job completions;
+ the default is to present job completions just before printing
+ a prompt.
+
+ p\bpa\bat\bth\bh Each word of the path variable specifies a directory in which
+ commands are to be sought for execution. A null word speci-
+ fies the current directory. If there is no _\bp_\ba_\bt_\bh variable then
+ only full path names will execute. The usual search path is
+ `.', `/bin' and `/usr/bin', but this may vary from system to
+ system. For the super-user the default search path is `/etc',
+ `/bin' and `/usr/bin'. A shell that is given neither the -\b-c\bc
+ nor the -\b-t\bt option will normally hash the contents of the di-
+ rectories in the _\bp_\ba_\bt_\bh variable after reading _\b._\bc_\bs_\bh_\br_\bc, and each
+ time the _\bp_\ba_\bt_\bh variable is reset. If new commands are added to
+ these directories while the shell is active, it may be neces-
+ sary to do a r\bre\beh\bha\bas\bsh\bh or the commands may not be found.
+
+ p\bpr\bro\bom\bmp\bpt\bt The string that is printed before each command is read from an
+ interactive terminal input. If a `!' appears in the string it
+ will be replaced by the current event number unless a preced-
+ ing `\' is given. Default is `% ', or `# ' for the super-
+ user.
+
+ s\bsa\bav\bve\beh\bhi\bis\bst\bt Is given a numeric value to control the number of entries of
+ the history list that are saved in ~/.history when the user
+ logs out. Any command that has been referenced in this many
+ events will be saved. During start up the shell sources
+ ~/.history into the history list enabling history to be saved
+ across logins. Too large values of _\bs_\ba_\bv_\be_\bh_\bi_\bs_\bt will slow down
+ the shell during start up. If _\bs_\ba_\bv_\be_\bh_\bi_\bs_\bt is just set, the shell
+ will use the value of _\bh_\bi_\bs_\bt_\bo_\br_\by_\b.
+
+ s\bsh\bhe\bel\bll\bl The file in which the shell resides. This variable is used in
+ forking shells to interpret files that have execute bits set,
+ but which are not executable by the system. (See the descrip-
+ tion of _\bN_\bo_\bn_\b-_\bb_\bu_\bi_\bl_\bt_\bi_\bn _\bC_\bo_\bm_\bm_\ba_\bn_\bd _\bE_\bx_\be_\bc_\bu_\bt_\bi_\bo_\bn below.) Initialized to
+ the (system-dependent) home of the shell.
+
+ s\bst\bta\bat\btu\bus\bs The status returned by the last command. If it terminated ab-
+ normally, then 0200 is added to the status. Builtin commands
+ that fail return exit status `1', all other builtin commands
+ set status to `0'.
+
+ t\bti\bim\bme\be Controls automatic timing of commands. If set, then any com-
+ mand that takes more than this many cpu seconds will cause a
+ line giving user, system, and real times and a utilization
+ percentage which is the ratio of user plus system times to re-
+ al time to be printed when it terminates.
+
+ v\bve\ber\brb\bbo\bos\bse\be Set by the -\b-v\bv command line option, causes the words of each
+ command to be printed after history substitution.
+
+ N\bNo\bon\bn-\b-b\bbu\bui\bil\blt\bti\bin\bn c\bco\bom\bmm\bma\ban\bnd\bd e\bex\bxe\bec\bcu\but\bti\bio\bon\bn
+ When a command to be executed is found to not be a builtin command the
+ shell attempts to execute the command via execve(2). Each word in the
+ variable _\bp_\ba_\bt_\bh names a directory from which the shell will attempt to exe-
+ cute the command. If it is given neither a -\b-c\bc nor a -\b-t\bt option, the shell
+ will hash the names in these directories into an internal table so that
+ it will only try an e\bex\bxe\bec\bc in a directory if there is a possibility that
+ the command resides there. This shortcut greatly speeds command location
+ when many directories are present in the search path. If this mechanism
+ has been turned off (via u\bun\bnh\bha\bas\bsh\bh), or if the shell was given a -\b-c\bc or -\b-t\bt
+ argument, and in any case for each directory component of _\bp_\ba_\bt_\bh that does
+ not begin with a `/', the shell concatenates with the given command name
+ to form a path name of a file which it then attempts to execute.
+
+ Parenthesized commands are always executed in a subshell. Thus
+
+ (cd; pwd); pwd
+
+ prints the _\bh_\bo_\bm_\be directory; leaving you where you were (printing this af-
+ ter the home directory), while
+
+ cd; pwd
+
+ leaves you in the _\bh_\bo_\bm_\be directory. Parenthesized commands are most often
+ used to prevent c\bch\bhd\bdi\bir\br from affecting the current shell.
+
+ If the file has execute permissions but is not an executable binary to
+ the system, then it is assumed to be a file containing shell commands and
+ a new shell is spawned to read it.
+
+ If there is an a\bal\bli\bia\bas\bs for s\bsh\bhe\bel\bll\bl then the words of the alias will be
+ prepended to the argument list to form the shell command. The first word
+ of the a\bal\bli\bia\bas\bs should be the full path name of the shell (e.g., `$shell').
+ Note that this is a special, late occurring, case of a\bal\bli\bia\bas\bs substitution,
+ and only allows words to be prepended to the argument list without
+ change.
+
+ S\bSi\big\bgn\bna\bal\bl h\bha\ban\bnd\bdl\bli\bin\bng\bg
+ The shell normally ignores _\bq_\bu_\bi_\bt signals. Jobs running detached (either
+ by &\b& or the b\bbg\bg or %\b%.\b..\b..\b. &\b& commands) are immune to signals generated from
+ the keyboard, including hangups. Other signals have the values which the
+ shell inherited from its parent. The shell's handling of interrupts and
+ terminate signals in shell scripts can be controlled by o\bon\bni\bin\bnt\btr\br. Login
+ shells catch the _\bt_\be_\br_\bm_\bi_\bn_\ba_\bt_\be signal; otherwise this signal is passed on to
+ children from the state in the shell's parent. Interrupts are not al-
+ lowed when a login shell is reading the file _\b._\bl_\bo_\bg_\bo_\bu_\bt.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+ William Joy. Job control and directory stack features first implemented
+ by J.E. Kulp of IIASA, Laxenburg, Austria, with different syntax than
+ that used now. File name completion code written by Ken Greer, HP Labs.
+ Eight-bit implementation Christos S. Zoulas, Cornell University.
+
+F\bFI\bIL\bLE\bES\bS
+
+
+ ~/.cshrc Read at beginning of execution by each shell.
+ ~/.login Read by login shell, after `.cshrc' at login.
+ ~/.logout Read by login shell, at logout.
+ /bin/sh Standard shell, for shell scripts not starting with a `#'.
+ /tmp/sh* Temporary file for `<<'.
+ /etc/passwd Source of home directories for `~name'.
+
+L\bLI\bIM\bMI\bIT\bTA\bAT\bTI\bIO\bON\bNS\bS
+ Word lengths - Words can be no longer than 1024 characters. The system
+ limits argument lists to 10240 characters. The number of arguments to a
+ command that involves filename expansion is limited to 1/6'th 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 a\bal\bli\bia\bas\bs substitutions on
+ a single line to 20.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+ sh(1), access(2), execve(2), fork(2), killpg(2), pipe(2),
+ sigvec(2), umask(2), setrlimit(2), wait(2), tty(4), a.out(5),
+ environ(7),
+ introduction to the C shell
+
+H\bHI\bIS\bST\bTO\bOR\bRY\bY
+ C\bCs\bsh\bh appeared in 3BSD. It was a first implementation of a command language
+ interpreter incorporating a history mechanism (see _\bH_\bi_\bs_\bt_\bo_\br_\by
+ _\bS_\bu_\bb_\bs_\bt_\bi_\bt_\bu_\bt_\bi_\bo_\bn_\bs), job control facilities (see _\bJ_\bo_\bb_\bs), interactive file name
+ and user name completion (see _\bF_\bi_\bl_\be _\bN_\ba_\bm_\be _\bC_\bo_\bm_\bp_\bl_\be_\bt_\bi_\bo_\bn), and a C-like syntax.
+ There are now many shells that also have these mechanisms, plus a few
+ more (and maybe some bugs too), which are available through the usenet.
+
+B\bBU\bUG\bGS\bS
+ When a command is restarted from a stop, the shell prints the directory
+ it started in if this is different from the current directory; this can
+ be misleading (i.e., wrong) as the job may have changed directories in-
+ ternally.
+
+ Shell builtin functions are not stoppable/restartable. Command sequences
+ of the form `a ; b ; c' are also not handled gracefully when stopping is
+ attempted. If you suspend `b', the shell will immediately execute `c'.
+ This is especially noticeable if this expansion results from an _\ba_\bl_\bi_\ba_\bs. It
+ suffices to place the sequence of commands in ()'s to force it to a sub-
+ shell, 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 proce-
+ dures; shell procedures should be provided instead of aliases.
+
+ Commands within loops, prompted for by `?', are not placed on the h\bhi\bis\bst\bto\bor\bry\by
+ list. Control structure should be parsed instead of being recognized as
+ built-in commands. This would allow control commands to be placed any-
+ where, to be combined with `|', and to be used with `&' and `;' metasyn-
+ tax.
+
+ It should be possible to use the `:' modifiers on the output of command
+ substitutions.
+
+ The way the f\bfi\bil\ble\bec\bc facility is implemented is ugly and expensive.
+
+4th Berkeley Distribution June 1, 1994 22