Annotation of researchv10dc/man/manb/ksh.1, revision 1.1.1.1

1.1       root        1: .ds OK [\|
                      2: .ds CK \|]
                      3: .ds ' \s+4\[email protected]@\'\[email protected]@\s-4
                      4: .ds ` \s+4\[email protected]@\`\[email protected]@\s-4
                      5: .de P
                      6: .br
                      7: ..
                      8: .TH KSH 1
                      9: .SH NAME
                     10: ksh \- Korn shell, the not standard command programming language
                     11: .SH SYNOPSIS
                     12: .B ksh
                     13: [
                     14: .B \-acefhikmnorstuvx
                     15: ] [
                     16: .B \-o
                     17: option ] .\|.\|.
                     18: [ arg  .\|.\|. ]
                     19: .br
                     20: .SH DESCRIPTION
                     21: .I Ksh\^
                     22: is a command programming language
                     23: that executes commands read from a terminal
                     24: or a file.
                     25: .I Rsh\^
                     26: is a restricted version of the standard command interpreter
                     27: .IR sh ;
                     28: it is used to set up login names and execution environments whose
                     29: capabilities are more controlled than those of the standard shell.
                     30: See
                     31: .I Invocation\^
                     32: below
                     33: for the meaning of arguments to the shell.
                     34: .SS Definitions.
                     35: A
                     36: .I metacharacter\^
                     37: is one of the following characters:
                     38: .RS
                     39: .PP
                     40: \f3;   &   (   )   \(bv   <   >   new-line   space   tab\fP
                     41: .RE
                     42: .PP
                     43: A
                     44: .I blank\^
                     45: is a
                     46: .B tab
                     47: or a
                     48: .BR space .
                     49: An
                     50: .I identifier\^
                     51: is a sequence of letters, digits, or underscores
                     52: starting with a letter or underscore.
                     53: Identifiers are used as names for
                     54: .IR aliases ,
                     55: .IR functions ,
                     56: and
                     57: .IR "named parameters" .
                     58: A
                     59: .I word\^
                     60: is a sequence of
                     61: .I characters\^
                     62: separated by one or more non-quoted
                     63: .IR metacharacters .
                     64: .SS Commands.
                     65: A
                     66: .I simple-command\^
                     67: is a sequence of
                     68: .I blank\^
                     69: separated words
                     70: which may be preceded by a parameter assignment list.
                     71: (See
                     72: .I Environment\^
                     73: below).
                     74: The first word specifies the name of the command to
                     75: be executed.
                     76: Except as specified below,
                     77: the remaining words are passed as arguments
                     78: to the invoked command.
                     79: The command name is passed as argument 0
                     80: (see
                     81: .IR exec (2)).
                     82: The
                     83: .I value\^
                     84: of a simple-command is its exit status
                     85: if it terminates normally, or (octal) 200+\f2status\^\fP if
                     86: it terminates abnormally (see
                     87: .IR signal (2)
                     88: for a list of
                     89: status values).
                     90: .PP
                     91: A
                     92: .I pipeline\^
                     93: is a sequence of one or more
                     94: .I commands\^
                     95: separated by
                     96: .BR \(bv .
                     97: The standard output of each command but the last
                     98: is connected by a
                     99: .IR pipe (2)
                    100: to the standard input of the next command.
                    101: Each command is run as a separate process;
                    102: the shell waits for the last command to terminate.
                    103: The exit status of a pipeline is the exit
                    104: status of the last command.
                    105: .PP
                    106: A
                    107: .I list\^
                    108: is a sequence of one or more
                    109: pipelines
                    110: separated by
                    111: .BR ; ,
                    112: .BR & ,
                    113: .BR && ,
                    114: or
                    115: .BR \(bv\|\(bv ,
                    116: and optionally terminated by
                    117: .BR ; ,
                    118: .BR & ,
                    119: or
                    120: .BR \(bv& .
                    121: Of these five symbols,
                    122: .BR ; ,
                    123: .BR & ,
                    124: and
                    125: .BR \(bv&
                    126: have equal precedence,
                    127: which is lower than that of
                    128: .B &&
                    129: and
                    130: .BR \(bv\|\(bv .
                    131: The symbols
                    132: .B &&
                    133: and
                    134: .B \(bv\|\(bv
                    135: also have equal precedence.
                    136: A semicolon
                    137: .RB ( ; )
                    138: causes sequential execution of the preceding pipeline; an ampersand
                    139: .RB ( & )
                    140: causes asynchronous execution of the preceding pipeline (i.e., the shell does
                    141: .I not\^
                    142: wait for that pipeline to finish).
                    143: The symbol
                    144: .B \(bv&
                    145: causes asynchronous execution of the preceding command or pipeline
                    146: with a two-way pipe established to the parent shell.
                    147: The standard input and output of the spawned command
                    148: can be written to and read from by the parent Shell
                    149: using the
                    150: .B \-p
                    151: option of
                    152: the special commands
                    153: .B read
                    154: and
                    155: .B print\^
                    156: described later.
                    157: Only one such command can be active
                    158: at any given time.
                    159: The symbol
                    160: .B &&
                    161: .RB (\| \(bv\|\(bv \^)
                    162: causes the
                    163: .I list\^
                    164: following it to be executed only if the preceding
                    165: pipeline
                    166: returns a zero (non-zero) value.
                    167: An arbitrary number of new-lines may appear in a
                    168: .I list,\^
                    169: instead of semicolons,
                    170: to delimit commands.
                    171: .PP
                    172: A
                    173: .I command\^
                    174: is either a simple-command
                    175: or one of the following.
                    176: Unless otherwise stated,
                    177: the value returned by a command is that of the
                    178: last simple-command executed in the command.
                    179: .TP
                    180: \f3for\fP \f2identifier\^\fP \*(OK \f3in\fP \f2word\^\fP .\|.\|. \*(CK \f3do\fP \f2list\^\fP \f3done\fP
                    181: Each time a
                    182: .B for
                    183: command is executed,
                    184: .I identifier\^
                    185: is set to the next
                    186: .I word\^
                    187: taken from the
                    188: .B in
                    189: .I word\^
                    190: list.
                    191: If
                    192: .BI in " word\^"
                    193: \&.\|.\|.
                    194: is omitted, then
                    195: the
                    196: .B for
                    197: command executes the \f3do\fP \f2list\^\fP once for each positional parameter
                    198: that is set
                    199: (see
                    200: .I "Parameter Substitution\^"
                    201: below).
                    202: Execution ends when there are no more words in the list.
                    203: .TP
                    204: \f3select\fP \f2identifier\^\fP \*(OK \f3in\fP \f2word\^\fP .\|.\|. \*(CK \f3do\fP \f2list\^\fP \f3done\fP
                    205: A
                    206: .B select
                    207: command prints on standard error (file descriptor 2), the set of
                    208: .IR word s,
                    209: each preceded by a number.
                    210: If
                    211: .BI in " word\^"
                    212: \&.\|.\|.
                    213: is omitted, then
                    214: the
                    215: positional parameters
                    216: are used instead
                    217: (see
                    218: .I "Parameter Substitution\^"
                    219: below).
                    220: The
                    221: .SM
                    222: .B PS3
                    223: prompt is printed
                    224: and a line is read from the standard input.
                    225: If this line consists of the number
                    226: of one of the listed
                    227: .BR word s,
                    228: then the value of the parameter
                    229: .I identifier\^
                    230: is set to the
                    231: .I word\^
                    232: corresponding to this number.
                    233: If this line is empty the selection list is
                    234: printed again.
                    235: Otherwise the value of the parameter
                    236: .I identifier\^
                    237: is set to
                    238: .BR null .
                    239: The contents of the line read from standard input is
                    240: saved in
                    241: the parameter
                    242: .SM
                    243: .BR REPLY.
                    244: The
                    245: .I list\^
                    246: is executed for each selection until a
                    247: .B break\^
                    248: or
                    249: .I end-of-file\^
                    250: is encountered.
                    251: .TP
                    252: \f3case\fP \f2word\^\fP \f3in\fP \*(OK \f2pattern\^\fP \*(OK \(bv \
                    253: \f2pattern\^\fP \*(CK .\|.\|. \f3)\fP \f2list\^\fP \f3;;\fP \*(CK .\|.\|. \f3esac\fP
                    254: A
                    255: .B case
                    256: command executes the
                    257: .I list\^
                    258: associated with the first
                    259: .I pattern\^
                    260: that matches
                    261: .IR word .
                    262: The form of the patterns is
                    263: the same as that used for
                    264: file-name generation (see 
                    265: .I "File Name Generation\^"
                    266: below).
                    267: .TP
                    268: \f3if\fP \f2list\^\fP \f3then\fP \f2list\^\fP \*(OK \
                    269: \f3elif\fP \f2list\^\fP \f3then\fP \f2list\^\fP \*(CK .\|.\|. \
                    270: \*(OK \f3else\fP \f2list\^\fP \*(CK \f3f\&i\fP
                    271: The
                    272: .I list\^
                    273: following \f3if\fP is executed and,
                    274: if it
                    275: returns a zero exit status, the
                    276: .I list\^
                    277: following
                    278: the first
                    279: .B then
                    280: is executed.
                    281: Otherwise, the
                    282: .I list\^
                    283: following \f3elif\fP
                    284: is executed and, if its value is zero,
                    285: the
                    286: .I list\^
                    287: following
                    288: the next
                    289: .B then
                    290: is executed.
                    291: Failing that, the
                    292: .B else
                    293: .I list\^
                    294: is executed.
                    295: If no
                    296: .B else
                    297: .I list\^
                    298: or
                    299: .B then
                    300: .I list\^
                    301: is executed, then the
                    302: .B if
                    303: command returns a zero exit status.
                    304: .TP
                    305: .PD 0
                    306: \f3while\fP \f2list\^\fP \f3do\fP \f2list\^\fP \f3done\fP
                    307: .TP
                    308: \f3until\fP \f2list\^\fP \f3do\fP \f2list\^\fP \f3done\fP
                    309: .PD
                    310: A
                    311: .B while
                    312: command repeatedly executes the
                    313: .B while
                    314: .I list\^
                    315: and, if the exit status of the last command in the list is zero, executes
                    316: the
                    317: .B do
                    318: .IR list ;
                    319: otherwise the loop terminates.
                    320: If no commands in the
                    321: .B do
                    322: .I list\^
                    323: are executed, then the
                    324: .B while
                    325: command returns a zero exit status;
                    326: .B until
                    327: may be used in place of
                    328: .B while
                    329: to negate
                    330: the loop termination test.
                    331: .TP
                    332: \f3(\fP\f2list\^\fP\f3)\fP
                    333: .br
                    334: Execute
                    335: .I list\^
                    336: in a separate environment.
                    337: Note, that if two adjacent open parentheses are
                    338: needed for nesting, a space must be inserted to avoid
                    339: arithmetic evaluation as described below.
                    340: .TP
                    341: \f3{ \fP\f2list\^\fP\f3;}\fP
                    342: .br
                    343: .I list\^
                    344: is simply executed.
                    345: Note that
                    346: .B {
                    347: is a
                    348: .I keyword\^
                    349: and requires a blank
                    350: in order to be recognized.
                    351: .TP
                    352: .PD 0
                    353: \f3function\fP \f2identifier\^\fP  \f3{\fP \f2list\^\fP \f3;}\fP
                    354: .TP
                    355: \f2identifier\^\fP  \f3() {\fP \f2list\^\fP \f3;}\fP
                    356: .PD
                    357: Define a function which is referenced by
                    358: .IR identifier .
                    359: The body of the function is the
                    360: .I list\^
                    361: of commands between
                    362: .B {
                    363: and
                    364: .BR } .
                    365: (See
                    366: .I Functions\^
                    367: below).
                    368: .TP
                    369: \f3time \fP\f2pipeline\^\fP
                    370: .br
                    371: The
                    372: .I pipeline\^
                    373: is executed and the elapsed time as well as
                    374: the user and system time are printed on standard error.
                    375: .PP
                    376: The following keywords
                    377: are only recognized as the first word of a command
                    378: and when not quoted:
                    379: .if t .RS
                    380: .PP
                    381: .B
                    382: .if n if then else elif fi case esac for while until do done { } function select time
                    383: .if t if   then   else   elif   fi   case   esac   for   while   until   do   done   {   }   function   select   time
                    384: .if t .RE
                    385: .SS Comments.
                    386: A word beginning with
                    387: .B #
                    388: causes that word and all the following characters up to a new-line
                    389: to be ignored.
                    390: .SS Aliasing.
                    391: The first word of each command is replaced by the text of an
                    392: .B alias
                    393: if an
                    394: .B alias
                    395: for this word has been defined.
                    396: The
                    397: first character of an
                    398: .B alias
                    399: name can be any printable character,
                    400: but the rest of the characters
                    401: must be the same as for a valid
                    402: .IR identifier .
                    403: The replacement string can contain any
                    404: valid Shell script
                    405: including the metacharacters listed above.
                    406: The first word of each command of the
                    407: replaced text will not be tested for additional aliases.
                    408: If the last character of the alias value is a
                    409: .I blank\^
                    410: then the word following the alias will also be checked for alias
                    411: substitution.
                    412: Aliases can be used to redefine special
                    413: builtin commands but cannot be used to redefine
                    414: the keywords listed above.
                    415: Aliases can be created, listed, and exported with the
                    416: .B alias
                    417: command and can be removed with the
                    418: .B unalias
                    419: command.
                    420: Exported aliases remain in effect for sub-shells
                    421: but must be reinitialized for separate invocations
                    422: of the Shell (See
                    423: .I Invocation\^
                    424: below).
                    425: .PP
                    426: .I Aliasing\^
                    427: is performed when
                    428: scripts are read,
                    429: not while they are executed.
                    430: Therefore,
                    431: for an alias to take effect
                    432: the
                    433: .B
                    434: alias
                    435: command has to be executed before
                    436: the command which references the alias is read.
                    437: .PP
                    438: Aliases are frequently used as a short hand for full path
                    439: names.
                    440: An option to the aliasing facility allows the value of the alias
                    441: to be automatically set to the full pathname of
                    442: the corresponding command.
                    443: These aliases are called
                    444: .I tracked
                    445: aliases.
                    446: The value of a
                    447: .I tracked
                    448: alias is defined the first time the identifier
                    449: is read and becomes undefined each time
                    450: the
                    451: .SM
                    452: .B PATH
                    453: variable is reset.
                    454: These aliases remain
                    455: .I tracked
                    456: so that the next
                    457: subsequent reference will redefine the value.
                    458: Several tracked aliases are compiled into the shell.
                    459: The
                    460: .B \-h
                    461: option of the
                    462: .B set
                    463: command makes each command name which is an
                    464: .I identifier\^
                    465: into a tracked alias.
                    466: .PP
                    467: The following
                    468: .I exported aliases
                    469: are compiled into the shell
                    470: but can be unset or redefined:
                    471: .RS 20
                    472: .PD 0
                    473: .TP
                    474: .B "echo=\(fmprint \-\(fm"
                    475: .TP
                    476: .B "false=\(fmlet 0\(fm"
                    477: .TP
                    478: .B "functions=\(fmtypeset \-f\(fm"
                    479: .TP
                    480: .B "history=\(fmfc \-l\(fm"
                    481: .TP
                    482: .B "integer=\(fmtypeset \-i\(fm"
                    483: .TP
                    484: .B "nohup=\(fmnohup \(fm"
                    485: .TP
                    486: .B "pwd=\(fmprint \- $\s-1PWD\s+1\(fm"
                    487: .TP
                    488: .B "r=\(fmfc \-e \-\(fm"
                    489: .TP
                    490: .B "true=\(fm:\(fm"
                    491: .TP
                    492: .B "type=\(fmwhence \-v\(fm"
                    493: .TP
                    494: .B "hash=\(fmalias \-t\(fm"
                    495: .PD
                    496: .RE 
                    497: .SS Tilde Substitution.
                    498: After alias substitution is performed, each word
                    499: is checked to see if it begins with an unquoted
                    500: .BR \(ap .
                    501: If it does, then the word up to a
                    502: .B /
                    503: is checked to see if it matches a user name in the
                    504: .B /etc/passwd
                    505: file.
                    506: If a match is found, the
                    507: .B \(ap
                    508: and the matched login name is replaced by the
                    509: login directory of the matched user.
                    510: This is called a
                    511: .I tilde
                    512: substitution.
                    513: If no match is found, the original text is left unchanged.
                    514: A
                    515: .B \(ap
                    516: by itself, or in front of a
                    517: .BR / ,
                    518: is replaced by the value of the
                    519: .B
                    520: .SM HOME
                    521: parameter.
                    522: A
                    523: .B \(ap
                    524: followed by a
                    525: .B +
                    526: or
                    527: .B \-
                    528: is replaced by the value of
                    529: the parameter
                    530: .B
                    531: .SM PWD
                    532: and
                    533: .B
                    534: .SM OLDPWD
                    535: respectively.
                    536: .PP
                    537: In addition, the value of each
                    538: .I "keyword parameter"
                    539: is checked to see if it begins with a
                    540: .B \(ap
                    541: or if a
                    542: .B \(ap
                    543: appears after a
                    544: .BR : .
                    545: In either of these cases a
                    546: .I tilde
                    547: substitution is attempted.
                    548: .SS Command Substitution.
                    549: The standard output from a command enclosed in
                    550: a pair of grave accents (\^\f3\*`\^\*`\fP\^) may be used as part or all
                    551: of a word;
                    552: trailing new-lines are removed.
                    553: The command substitution
                    554: \^\f3\*`\^cat file\^\*`\fP\^
                    555: can be replaced by the equivalent but faster
                    556: \^\f3\*`\^<file\^\*`\fP\^.
                    557: Command substitution of most special commands
                    558: that do not perform input/output redirection are
                    559: carried out without creating a separate process.
                    560: .SS Parameter Substitution.
                    561: A
                    562: .I parameter\^
                    563: is an
                    564: .IR identifier ,
                    565: a digit,
                    566: or any of the characters
                    567: .BR \(** ,
                    568: .BR @ ,
                    569: .BR # ,
                    570: .BR ? ,
                    571: .BR \- ,
                    572: .BR $ ,
                    573: and
                    574: .BR !\\^ .
                    575: A
                    576: .I named parameter\^
                    577: (a parameter denoted by an identifier)
                    578: has a
                    579: .I value\^
                    580: and zero or more
                    581: .IR attributes .
                    582: .I Named parameters \^
                    583: can be assigned
                    584: .I values\^
                    585: and
                    586: .I attributes
                    587: by using the
                    588: .B typeset\^
                    589: special command.
                    590: The attributes supported by the Shell are described
                    591: later with the
                    592: .B typeset\^
                    593: special command.
                    594: Exported parameters pass values and attributes to
                    595: sub-shells but only values to the environment.
                    596: .PP
                    597: The shell supports a limited one-dimensional array facility.
                    598: An element of an array parameter is referenced by a
                    599: .IR subscript .
                    600: A
                    601: .I subscript\^
                    602: is denoted by a
                    603: .BR [ ,
                    604: followed by an
                    605: .I arithmetic expression\^
                    606: (see Arithmetic evaluation below)
                    607: followed by a
                    608: .BR ] .
                    609: The value of all
                    610: subscripts must be in the
                    611: range of
                    612: 0 through 511.
                    613: Arrays need not be declared.
                    614: Any reference to a named parameter
                    615: with a valid subscript is
                    616: legal and an array will be created if necessary.
                    617: Referencing an array without a subscript
                    618: is equivalent to referencing the first element.
                    619: .PP
                    620: The
                    621: .I value\^
                    622: of a 
                    623: .I named parameter\^
                    624: may also be assigned by writing:
                    625: .RS
                    626: .PP
                    627: .IB name = value\^\|
                    628: \*(OK
                    629: .IB name = value\^
                    630: \*(CK .\|.\|.
                    631: .RE
                    632: .PP
                    633: .PD 0
                    634: If the integer attribute,
                    635: .BR \-i ,
                    636: is set for
                    637: .I name\^
                    638: the
                    639: .I value\^
                    640: is subject to arithmetic evaluation as described below.
                    641: .PP
                    642: Positional parameters,
                    643: parameters denoted by a number,
                    644: may be assigned values with the
                    645: .B set\^
                    646: special command.
                    647: Parameter
                    648: .B $0
                    649: is set from argument zero when the shell
                    650: is invoked.
                    651: .PP
                    652: The character
                    653: .B $
                    654: is used to introduce substitutable
                    655: .IR parameters .
                    656: .TP
                    657: \f3${\fP\f2parameter\^\fP\f3}\fP
                    658: The value, if any, of the parameter is substituted.
                    659: The braces are required when
                    660: .I parameter\^
                    661: is followed by a letter, digit, or underscore
                    662: that is not to be interpreted as part of its name
                    663: or when a named parameter is subscripted.
                    664: If
                    665: .I parameter\^
                    666: is a digit then it is a positional parameter.
                    667: If
                    668: .I parameter\^
                    669: is
                    670: .BR \(**
                    671: or
                    672: .BR @ ,
                    673: then all the positional
                    674: parameters, starting with
                    675: .BR $1 ,
                    676: are substituted
                    677: (separated by spaces).
                    678: If an array
                    679: .I identifier\^
                    680: with subscript
                    681: .B \(**
                    682: or
                    683: .B @
                    684: is used,
                    685: then the value
                    686: for each of the
                    687: elements
                    688: is substituted
                    689: (separated by spaces).
                    690: .TP
                    691: \f3${#\fP\f2parameter\^\fP\f3}\fP
                    692: If
                    693: .I parameter\^
                    694: is not
                    695: .BR \(** ,
                    696: the length of the value of the
                    697: .I parameter\^
                    698: is substituted.
                    699: Otherwise, the number of positional parameters is substituted.
                    700: .TP
                    701: \f3${#\fP\f2identifier\fP\f3[*]}\fP
                    702: The number of elements in the array
                    703: .I identifier\^
                    704: is substituted.
                    705: .TP
                    706: \f3${\fP\f2parameter\^\fP\f3:\-\fP\f2word\^\fP\f3}\fP
                    707: If
                    708: .I parameter\^
                    709: is set and is non-null then substitute its value;
                    710: otherwise substitute
                    711: .IR word .
                    712: .TP
                    713: \f3${\fP\f2parameter\^\fP\f3:=\fP\f2word\^\fP\f3}\fP
                    714: If
                    715: .I parameter\^
                    716: is not set or is null then set it to
                    717: .IR word ;
                    718: the value of the parameter is then substituted.
                    719: Positional parameters may not be assigned to
                    720: in this way.
                    721: .TP
                    722: \f3${\fP\f2parameter\^\fP\f3:?\fP\f2word\^\fP\f3}\fP
                    723: If
                    724: .I parameter\^
                    725: is set and is non-null then substitute its value;
                    726: otherwise, print
                    727: .I word\^
                    728: and exit from the shell.
                    729: If
                    730: .I word\^
                    731: is omitted then a standard message is printed.
                    732: .TP
                    733: \f3${\fP\f2parameter\^\fP\f3:+\fP\f2word\^\fP\f3}\fP
                    734: If
                    735: .I parameter\^
                    736: is set and is non-null then substitute
                    737: .IR word ;
                    738: otherwise substitute nothing.
                    739: .TP
                    740: .PD 0
                    741: \f3${\fP\f2parameter\^\fP\f3#\fP\f2pattern\^\fP\f3}\fP
                    742: .TP
                    743: \f3${\fP\f2parameter\^\fP\f3##\fP\f2pattern\^\fP\f3}\fP
                    744: .PD
                    745: If
                    746: the Shell
                    747: .I pattern\^
                    748: matches the beginning of the value of
                    749: .IR parameter ,
                    750: then the value of
                    751: this substitution is the value of the
                    752: .I parameter\^
                    753: with the matched portion deleted;
                    754: otherwise the value of this
                    755: .I parameter\^
                    756: is substituted.
                    757: In the first form the smallest matching pattern is deleted and in the
                    758: latter form the largest matching pattern is deleted.
                    759: .TP
                    760: .PD 0
                    761: \f3${\fP\f2parameter\^\fP\f3%\fP\f2pattern\^\fP\f3}\fP
                    762: .TP
                    763: \f3${\fP\f2parameter\^\fP\f3%%\fP\f2pattern\^\fP\f3}\fP
                    764: .PD
                    765: If
                    766: the Shell
                    767: .I pattern\^
                    768: matches the end of the value of
                    769: .IR parameter ,
                    770: then the value of
                    771: .I parameter\^
                    772: with the matched part deleted;
                    773: otherwise substitute the value of
                    774: .IR parameter .
                    775: In the first form the smallest matching pattern is deleted and in the
                    776: latter form the largest matching pattern is deleted.
                    777: .PD
                    778: .PP
                    779: In the above,
                    780: .I word\^
                    781: is not evaluated unless it is
                    782: to be used as the substituted string,
                    783: so that, in the following example,
                    784: .B pwd\^
                    785: is executed only if
                    786: .B d\^
                    787: is not set or is null:
                    788: .RS
                    789: .PP
                    790: echo \|${d:\-\^\*`\^pwd\^\*`\^}
                    791: .RE
                    792: .PP
                    793: If the colon (
                    794: .B : )
                    795: is omitted from the above expressions,
                    796: then the shell only checks whether
                    797: .I parameter\^
                    798: is set or not.
                    799: .PP
                    800: The following
                    801: parameters
                    802: are automatically set by the shell:
                    803: .RS
                    804: .PD 0
                    805: .TP
                    806: .B #
                    807: The number of positional parameters in decimal.
                    808: .TP
                    809: .B \-
                    810: Flags supplied to the shell on invocation or by
                    811: the
                    812: .B set
                    813: command.
                    814: .TP
                    815: .B ?
                    816: The decimal value returned by the last executed command.
                    817: .TP
                    818: .B $
                    819: The process number of this shell.
                    820: .TP
                    821: .B _
                    822: The last argument of the previous command.
                    823: This parameter is not set for commands which are asynchronous.
                    824: .TP
                    825: .B !
                    826: The process number of the last background command invoked.
                    827: .TP
                    828: .B
                    829: .SM PPID
                    830: The process number of the parent of the shell.
                    831: .TP
                    832: .B
                    833: .SM PWD
                    834: The present working directory set by the
                    835: .B cd
                    836: command.
                    837: .TP
                    838: .B
                    839: .SM OLDPWD
                    840: The previous working directory set by the
                    841: .B cd
                    842: command.
                    843: .TP
                    844: .B
                    845: .SM RANDOM
                    846: Each time this parameter is referenced, a random integer is generated.
                    847: The sequence of random numbers can be initialized by assigning
                    848: a numeric value to
                    849: .SM
                    850: .BR RANDOM .
                    851: .TP
                    852: .B
                    853: .SM REPLY
                    854: This parameter is set by the
                    855: .B select
                    856: statement and by
                    857: the
                    858: .B read
                    859: special command when no arguments are supplied.
                    860: .PD
                    861: .RE
                    862: .PP
                    863: The following
                    864: parameters
                    865: are used by the shell:
                    866: .RS
                    867: .PD 0
                    868: .TP
                    869: .B
                    870: .SM CDPATH
                    871: The search path for the
                    872: .I cd
                    873: command.
                    874: .TP
                    875: .B
                    876: .SM COLUMNS
                    877: If this variable is set,
                    878: the value is used to define the width of the edit window
                    879: for the shell edit modes and for printing
                    880: .B select
                    881: lists.
                    882: .TP
                    883: .B
                    884: .SM EDITOR
                    885: If the value of this variable ends in
                    886: .IR emacs ,
                    887: .IR gmacs ,
                    888: or
                    889: .I vi
                    890: and the
                    891: .B
                    892: .SM VISUAL
                    893: variable is not set,
                    894: then the corresponding option
                    895: (see Special Command
                    896: .B set
                    897: below)
                    898: will be turned on.
                    899: .TP
                    900: .SM
                    901: .B ENV
                    902: If this parameter is set, then
                    903: parameter substitution is performed on
                    904: the value to generate
                    905: the  pathname of the script that will be
                    906: executed when the
                    907: .I shell\^
                    908: is invoked.
                    909: (See
                    910: .I Invocation\^
                    911: below.)
                    912: This file is typically used for
                    913: .I alias
                    914: and
                    915: .I function
                    916: definitions.
                    917: .TP
                    918: .B
                    919: .SM FCEDIT
                    920: The default editor name for the
                    921: .B fc
                    922: command.
                    923: .TP
                    924: .SM
                    925: .B IFS
                    926: Internal field separators,
                    927: normally
                    928: .BR space ,
                    929: .BR tab ,
                    930: and
                    931: .B new-line
                    932: that is used to separate command words which result from
                    933: command or parameter substitution
                    934: and for separating words with  the special command
                    935: .BR read .
                    936: .TP
                    937: .SM
                    938: .B HISTFILE
                    939: If this parameter is set when the shell is invoked, then
                    940: the value is the  pathname of the file that will be
                    941: used to store the command history.
                    942: (See
                    943: .I "Command re-entry\^"
                    944: below.)
                    945: .TP
                    946: .SM
                    947: .B HISTSIZE
                    948: If this parameter is set when the shell is invoked, then
                    949: the number of previously entered commands that
                    950: are accessible by this shell
                    951: will be greater than or equal to this number.
                    952: The default is 128.
                    953: .TP
                    954: .B
                    955: .SM HOME
                    956: The default argument (home directory) for the
                    957: .B cd
                    958: command.
                    959: .TP
                    960: .B
                    961: .SM MAIL
                    962: If this parameter is set to the name of a mail file
                    963: .I and\^
                    964: the
                    965: .B
                    966: .SM MAILPATH
                    967: parameter is not set,
                    968: then the shell informs the user of arrival of mail
                    969: in the specified file.
                    970: .TP
                    971: .B
                    972: .SM MAILCHECK
                    973: This variable specifies how often (in seconds) the
                    974: shell will check for changes in the modification time
                    975: of any of the files specified by the
                    976: .B
                    977: .SM MAILPATH
                    978: or
                    979: .B
                    980: .SM MAIL
                    981: parameters.
                    982: The default value is 600 seconds.
                    983: If set to 0,
                    984: the shell will check before each prompt.
                    985: .TP
                    986: .B
                    987: .SM MAILPATH
                    988: A colon (
                    989: .B :
                    990: )
                    991: separated list of file names.
                    992: If this parameter is set
                    993: then the shell informs the user of
                    994: any modifications to the specified files
                    995: that have occurred within the last
                    996: .B
                    997: .SM MAILCHECK
                    998: seconds.
                    999: Each file name can be followed by a
                   1000: .B ?
                   1001: and a message that will be printed.
                   1002: The message will undergo parameter and command substitution
                   1003: with the parameter,
                   1004: .B $_
                   1005: defined as the name of the file that has changed.
                   1006: The default message is
                   1007: .I you have mail in $_\^.
                   1008: .TP
                   1009: .B
                   1010: .SM PATH
                   1011: The search path for commands (see
                   1012: .I Execution\^
                   1013: below).
                   1014: The user may not change
                   1015: .B \s-1PATH\s+1
                   1016: if executing under
                   1017: .I rsh
                   1018: (except in
                   1019: .I .profile\^
                   1020: ).
                   1021: .TP
                   1022: .SM
                   1023: .B PS1
                   1024: The value of this parameter is expanded for paramter
                   1025: substitution to define the
                   1026: primary prompt string which by default is
                   1027: .RB `` "$ \|" ''.
                   1028: The character
                   1029: .B !
                   1030: in the primary prompt string is replaced by the
                   1031: .I command\^ 
                   1032: number (see
                   1033: .I Command Re-entry
                   1034: below).
                   1035: .TP
                   1036: .SM
                   1037: .B PS2
                   1038: Secondary prompt string, by default
                   1039: .RB `` "> \|" ''.
                   1040: .TP
                   1041: .SM
                   1042: .B PS3
                   1043: Selection prompt string
                   1044: used within a
                   1045: .B select
                   1046: loop, by default
                   1047: .RB `` "#? \|" ''.
                   1048: .TP
                   1049: .SM
                   1050: .B SHELL
                   1051: The pathname of the
                   1052: .I shell\^
                   1053: is kept in the environment.
                   1054: At invocation, if the value of this variable contains an
                   1055: .B r
                   1056: in the basename,
                   1057: then the shell becomes restricted.
                   1058: .TP
                   1059: .B
                   1060: .SM TMOUT
                   1061: If set to a value greater than zero,
                   1062: the shell will terminate if a command is not entered within
                   1063: the prescribed number of seconds.
                   1064: (Note that the shell can be compiled with a maximum bound
                   1065: for this value which cannot be exceeded.)
                   1066: .TP
                   1067: .B
                   1068: .SM VISUAL
                   1069: If the value of this variable ends in
                   1070: .IR emacs ,
                   1071: .IR gmacs ,
                   1072: or
                   1073: .I vi
                   1074: then the corresponding option
                   1075: (see Special Command
                   1076: .B set
                   1077: below)
                   1078: will be turned on.
                   1079: .PD
                   1080: .RE
                   1081: .PP
                   1082: The shell gives default values to
                   1083: \f3\s-1PATH\s+1\fP, \f3\s-1PS1\s+1\fP, \f3\s-1PS2\s+1\fP, \f3\s-1MAILCHECK\s+1\fP,
                   1084: \f3\s-1TMOUT\s+1\fP  and \f3\s-1IFS\s+1\fP,
                   1085: while
                   1086: .SM
                   1087: .BR HOME ,
                   1088: .SM
                   1089: .B SHELL
                   1090: .SM
                   1091: .B ENV
                   1092: and
                   1093: .SM
                   1094: .B MAIL
                   1095: are
                   1096: not set at all by the shell (although
                   1097: .SM
                   1098: .B HOME
                   1099: .I is\^
                   1100: set by
                   1101: .IR login (1)).
                   1102: On some systems
                   1103: .SM
                   1104: .B MAIL
                   1105: and
                   1106: .SM
                   1107: .B SHELL
                   1108: are also
                   1109: set by
                   1110: .IR login (1)).
                   1111: .SS Blank Interpretation.
                   1112: After parameter and command substitution,
                   1113: the results of substitutions are scanned for the field separator
                   1114: characters (
                   1115: those found in
                   1116: .SM
                   1117: .B IFS
                   1118: )
                   1119: and split into distinct arguments where such characters are found.
                   1120: Explicit null arguments (\^\f3"\^"\fP or \f3\*\(fm\^\*\(fm\fP\^) are retained.
                   1121: Implicit null arguments
                   1122: (those resulting from
                   1123: .I parameters\^
                   1124: that have no values) are removed.
                   1125: .SS File Name Generation.
                   1126: Following substitution, each command
                   1127: .I word\^
                   1128: is scanned for
                   1129: the characters
                   1130: .BR \(** ,
                   1131: .BR ? ,
                   1132: and
                   1133: .B \*(OK\^ 
                   1134: unless the
                   1135: .B \-f
                   1136: option has been
                   1137: .BR set .
                   1138: If one of these characters appears
                   1139: then the word is regarded as a
                   1140: .IR pattern .
                   1141: The word is replaced with alphabetically sorted file names that match the pattern.
                   1142: If no file name is found that matches the pattern, then
                   1143: the word is left unchanged.
                   1144: When a
                   1145: .I pattern\^
                   1146: is used for file name generation,
                   1147: the character
                   1148: .B .
                   1149: at the start of a file name
                   1150: or immediately following a
                   1151: .BR / ,
                   1152: as well as the character
                   1153: .B /
                   1154: itself,
                   1155: must be matched explicitly.
                   1156: In other instances of pattern matching the
                   1157: .B /
                   1158: and
                   1159: .B .
                   1160: are not treated specially.
                   1161: .PP
                   1162: .PD 0
                   1163: .RS
                   1164: .TP
                   1165: .B \(**
                   1166: Matches any string, including the null string.
                   1167: .TP
                   1168: .B ?
                   1169: Matches any single character.
                   1170: .TP
                   1171: .BR \*(OK \^.\|.\|.\^ \*(CK
                   1172: Matches any one of the enclosed characters.
                   1173: A pair of characters separated by
                   1174: .B \-
                   1175: matches any
                   1176: character lexically between the pair, inclusive.
                   1177: If the first character following the opening "[ \|"
                   1178: is a "! \|" then any character not enclosed is matched.
                   1179: A
                   1180: .B \-
                   1181: can be included in the character set by putting it as the
                   1182: first or last character.
                   1183: .PD
                   1184: .RE
                   1185: .SS Quoting.
                   1186: Each of the
                   1187: .I metacharacters\^
                   1188: listed above (See
                   1189: .I Definitions
                   1190: above).
                   1191: has a special meaning to the shell
                   1192: and cause termination of a word unless quoted.
                   1193: A character may be
                   1194: .I quoted\^
                   1195: (i.e., made to stand for itself)
                   1196: by preceding
                   1197: it with a
                   1198: .BR \e .
                   1199: The pair
                   1200: .B \enew-line
                   1201: is ignored.
                   1202: All characters enclosed between a pair of single quote marks (\^\f3\(fm\^\(fm\fP\^),
                   1203: except a single quote,
                   1204: are quoted.
                   1205: Inside double quote marks
                   1206: (\f3"\^"\fP),
                   1207: parameter and command substitution occurs and
                   1208: .B \e
                   1209: quotes the characters
                   1210: .BR \e ,
                   1211: .BR \(fm ,
                   1212: \f3"\fP,
                   1213: and
                   1214: .BR $ .
                   1215: .B
                   1216: "$\(**"
                   1217: is equivalent to
                   1218: \f3"$1 \|$2\fP \|.\|.\|.\f3"\fP,
                   1219: whereas
                   1220: .B
                   1221: "$@"
                   1222: is equivalent to
                   1223: .B
                   1224: "$1"\|
                   1225: .B
                   1226: "$2"\|
                   1227: \&.\|.\|.\^.
                   1228: .PP
                   1229: The special meaning of keywords can be removed by quoting any
                   1230: character of the keyword.
                   1231: The recognition of special command names listed below cannot be altered
                   1232: by quoting them.
                   1233: .SS Arithmetic Evaluation.
                   1234: An ability to perform integer arithmetic
                   1235: is provided with the special command
                   1236: .BR let .
                   1237: Evaluations are performed using
                   1238: .I long\^
                   1239: arithmetic.
                   1240: Constants are of the form
                   1241: \*(OK\f2base\f3#\^\f1\*(CK\f2n\^\fP
                   1242: where
                   1243: .I base\^
                   1244: is a decimal number between two and thirty-six
                   1245: representing the arithmetic base
                   1246: and
                   1247: .I n\^
                   1248: is a number in that base.
                   1249: If
                   1250: .I base\^
                   1251: is omitted 
                   1252: then base 10 is used.
                   1253: .PP
                   1254: An internal integer representation of a
                   1255: .I named parameter\^
                   1256: can be specified with the
                   1257: .B \-i
                   1258: option of the
                   1259: .B typeset
                   1260: special command.
                   1261: When this attribute is selected
                   1262: the first assignment to the
                   1263: parameter determines the arithmetic base
                   1264: to be used when 
                   1265: parameter substitution occurs.
                   1266: .PP
                   1267: Since many of the arithmetic operators require
                   1268: quoting, an alternative form of the
                   1269: .B let
                   1270: command is provided.
                   1271: For any command which begins with a
                   1272: .BR (( ,
                   1273: all the characters until a matching
                   1274: .B ))
                   1275: are treated as a quoted expression.
                   1276: More precisely,
                   1277: .B ((
                   1278: \&.\|.\|.
                   1279: .B ))
                   1280: is equivalent to
                   1281: .B let\^
                   1282: \f3"\fP \|.\|.\|.\f3"\fP.
                   1283: .SS Prompting.
                   1284: When used interactively,
                   1285: the shell prompts with the value of
                   1286: .SM
                   1287: .B PS1
                   1288: before reading a command.
                   1289: If at any time a new-line is typed and further input is needed
                   1290: to complete a command, then the secondary prompt
                   1291: (i.e., the value of
                   1292: .BR \s-1PS2\s+1 )
                   1293: is issued.
                   1294: .SS Input/Output.
                   1295: Before a command is executed, its input and output
                   1296: may be redirected using a special notation interpreted by the shell.
                   1297: The following may appear anywhere in a simple-command
                   1298: or may precede or follow a
                   1299: .I command\^
                   1300: and are
                   1301: .I not\^
                   1302: passed on to the invoked command.
                   1303: Command and parameter substitution occurs before
                   1304: .I word\^
                   1305: or
                   1306: .I digit\^
                   1307: is used except as noted below.
                   1308: File name generation
                   1309: occurs only if the pattern matches a single file
                   1310: and blank interpretation is not performed.
                   1311: .TP 14
                   1312: .BI < word
                   1313: Use file
                   1314: .I word\^
                   1315: as standard input (file descriptor 0).
                   1316: .TP
                   1317: .BI > word
                   1318: Use file
                   1319: .I word\^
                   1320: as standard output (file descriptor 1).
                   1321: If the file does not exist then it is created;
                   1322: otherwise, it is truncated to zero length.
                   1323: .TP
                   1324: .BI >\[email protected]@> word
                   1325: Use file
                   1326: .I word\^
                   1327: as standard output.
                   1328: If the file exists then output is appended to it (by first seeking to the end-of-file);
                   1329: otherwise, the file is created.
                   1330: .TP
                   1331: \f3<\[email protected]@<\fP\*(OK\f3\-\fP\*(CK\f2word\fP
                   1332: The shell input is read up to a line that is the same as
                   1333: .IR word ,
                   1334: or to an end-of-file.
                   1335: No parameter substitution, command substitution or
                   1336: file name generation is performed on
                   1337: .IR word .
                   1338: The resulting document,
                   1339: called a
                   1340: .IR here-document ,
                   1341: becomes
                   1342: the standard input.
                   1343: If any character of
                   1344: .I word\^
                   1345: is quoted, then no interpretation
                   1346: is placed upon the characters of the document;
                   1347: otherwise, parameter and command substitution occurs,
                   1348: .B \enew-line
                   1349: is ignored,
                   1350: and
                   1351: .B \e
                   1352: must be used to quote the characters
                   1353: .BR \e ,
                   1354: .BR $ ,
                   1355: .BR \*` ,
                   1356: and the first character of
                   1357: .IR word .
                   1358: If
                   1359: .B \-
                   1360: is appended to
                   1361: .BR <\[email protected]@< ,
                   1362: then all leading tabs are stripped from
                   1363: .I word\^
                   1364: and from the document.
                   1365: .TP
                   1366: .BI <& digit
                   1367: The standard input is duplicated from file descriptor
                   1368: .I digit
                   1369: (see
                   1370: .IR dup (2)).
                   1371: Similarly for the standard output using
                   1372: .BR >& 
                   1373: .IR digit .
                   1374: .TP
                   1375: .B <&\-
                   1376: The standard input is closed.
                   1377: Similarly for the standard output using
                   1378: .BR >&\- .
                   1379: .PP
                   1380: If one of the above is preceded by a digit,
                   1381: then the
                   1382: file descriptor number referred to is that specified
                   1383: by the digit
                   1384: (instead of the default 0 or 1).
                   1385: For example:
                   1386: .RS
                   1387: .PP
                   1388: \&.\|.\|. \|2>&1
                   1389: .RE
                   1390: .PP
                   1391: means file descriptor 2 is to be opened
                   1392: for writing as a duplicate
                   1393: of file descriptor 1.
                   1394: .PP
                   1395: The order in which redirections are specified is significant.
                   1396: The shell evaluates each redirection in terms of the 
                   1397: .RI ( "file descriptor" ", " file ) 
                   1398: association at the time of evaluation.
                   1399: For example:
                   1400: .RS
                   1401: .PP
                   1402: \&.\|.\|. \|1>\f2fname\^\fP 2>&1
                   1403: .RE
                   1404: .PP
                   1405: first associates file descriptor 1 with file 
                   1406: .IR fname\^ .
                   1407: It then associates file descriptor 2 with the file associated with file
                   1408: descriptor 1 (i.e. 
                   1409: .IR fname\^ ).
                   1410: If the order of redirections were reversed, file descriptor 2 would be associated 
                   1411: with the terminal (assuming file descriptor 1 had been) and then file descriptor 
                   1412: 1 would be associated with file 
                   1413: .IR fname\^ .
                   1414: .PP
                   1415: If a command is followed by
                   1416: .B &
                   1417: and job control is not active,
                   1418: then the default standard input
                   1419: for the command
                   1420: is the empty file
                   1421: .BR /dev/null .
                   1422: Otherwise, the environment for the execution of a command contains the
                   1423: file descriptors of the invoking shell as modified by
                   1424: input/output specifications.
                   1425: .SS Environment.
                   1426: The
                   1427: .I environment\^
                   1428: (see
                   1429: .IR environ (7))
                   1430: is a list of name-value pairs that is passed to
                   1431: an executed program in the same way as a normal argument list.
                   1432: The names must be
                   1433: .I identifiers\^
                   1434: and the values are character strings.
                   1435: The shell interacts with the environment in several ways.
                   1436: On invocation, the shell scans the environment
                   1437: and creates a
                   1438: parameter
                   1439: for each name found,
                   1440: giving it the corresponding value and marking it
                   1441: .I export .
                   1442: Executed commands inherit the environment.
                   1443: If the user modifies the values of these
                   1444: parameters
                   1445: or creates new ones,
                   1446: using the
                   1447: .B export
                   1448: or
                   1449: .B typeset \-x
                   1450: commands they become part of the
                   1451: environment.
                   1452: The environment seen by any executed command is thus composed
                   1453: of any name-value pairs originally inherited by the shell,
                   1454: whose values may be modified by the current shell,
                   1455: plus any additions
                   1456: which must be noted in
                   1457: .B export
                   1458: or
                   1459: .B typeset \-x
                   1460: commands.
                   1461: .PP
                   1462: The environment for any
                   1463: .I simple-command\^
                   1464: or function
                   1465: may be augmented by prefixing it with one or more parameter assignments.
                   1466: A parameter assignment argument is a word of the form
                   1467: .IR identifier=value .
                   1468: Thus:
                   1469: .RS
                   1470: .PP
                   1471: \s-1TERM\s+1=450 \|cmd \|args                          and
                   1472: .br
                   1473: (export \|\s-1TERM\s+1; \|\s-1TERM\s+1=450; \|cmd \|args)
                   1474: .RE
                   1475: .PP
                   1476: are equivalent (as far as the above execution of
                   1477: .I cmd\^
                   1478: is concerned).
                   1479: .PP
                   1480: If the
                   1481: .B \-k
                   1482: flag is set,
                   1483: .I all\^
                   1484: parameter assignment arguments are placed in the environment,
                   1485: even if they occur after the command name.
                   1486: The following
                   1487: first prints
                   1488: .B "a=b c"
                   1489: and then
                   1490: .BR c:
                   1491: .PP
                   1492: .RS
                   1493: .nf
                   1494: echo \|a=b \|c
                   1495: set \|\-k
                   1496: echo \|a=b \|c
                   1497: .fi
                   1498: .RE
                   1499: .SS Functions.
                   1500: .PP
                   1501: The
                   1502: .B function\^
                   1503: keyword, described in the
                   1504: .I Commands
                   1505: section above,
                   1506: is used to define shell functions.
                   1507: Shell functions are read in and stored internally.
                   1508: Alias names are resolved when the function is read.
                   1509: Functions are executed like commands with the arguments
                   1510: passed as positional parameters.
                   1511: (See
                   1512: .I Execution
                   1513: below).
                   1514: .PP
                   1515: Functions execute in the same process as the caller and
                   1516: share all files, traps ( other than
                   1517: .SM
                   1518: .B EXIT
                   1519: and
                   1520: .SM
                   1521: .BR ERR )
                   1522: and present working directory with the
                   1523: caller.
                   1524: A trap set on
                   1525: .SM
                   1526: .B EXIT
                   1527: inside a function
                   1528: is executed after the function completes.
                   1529: Ordinarily,
                   1530: variables are shared between the calling program
                   1531: and the function.
                   1532: However,
                   1533: the
                   1534: .B typeset
                   1535: special command used within a function
                   1536: defines local variables whose scope includes
                   1537: the current function and
                   1538: all functions it calls.
                   1539: .PP
                   1540: The special command
                   1541: .B return
                   1542: is used to return
                   1543: from function calls.
                   1544: Errors within functions return control to the caller.
                   1545: .PP
                   1546: Function identifiers
                   1547: can be listed with the
                   1548: .B \-f
                   1549: option of the
                   1550: .B typeset
                   1551: special command.
                   1552: The text of functions will also
                   1553: be listed.
                   1554: Function can be undefined with the
                   1555: .B \-f
                   1556: option of the
                   1557: .B unset
                   1558: special command.
                   1559: .PP
                   1560: Ordinarily,
                   1561: functions are unset when the shell executes a shell script.
                   1562: The
                   1563: .B \-xf
                   1564: option of the
                   1565: .B typeset
                   1566: command allows a function to be exported
                   1567: to scripts that are executed without a separate
                   1568: invocation of the shell.
                   1569: Functions that need to be defined across separate
                   1570: invocations of the shell should be placed in the
                   1571: .B
                   1572: .SM
                   1573: ENV
                   1574: file.
                   1575: .SS Jobs.
                   1576: .PP
                   1577: If the
                   1578: .B monitor
                   1579: option of the
                   1580: .B set
                   1581: command is turned on,
                   1582: an interactive shell associates a \fIjob\fR with each pipeline.  It keeps
                   1583: a table of current jobs, printed by the
                   1584: .B jobs
                   1585: command, and assigns them small integer numbers.  When
                   1586: a job is started asynchronously with
                   1587: .BR & ,
                   1588: the shell prints a line which looks
                   1589: like:
                   1590: .PP
                   1591: .DT
                   1592:        [1] 1234
                   1593: .PP
                   1594: indicating that the job which was started asynchronously was job number
                   1595: 1 and had one (top-level) process, whose process id was 1234.
                   1596: .PP
                   1597: This paragraph and the next require features that are
                   1598: not in all versions of UNIX and may not apply.
                   1599: If you are running a job and wish to do something else you may hit the key
                   1600: \fB^Z\fR (control-Z) which sends a STOP signal to the current job.
                   1601: The shell will then normally indicate that the job has been `Stopped',
                   1602: and print another prompt.  You can then manipulate the state of this job,
                   1603: putting it in the background with the
                   1604: .B bg
                   1605: command, or run some other
                   1606: commands and then eventually bring the job back into the foreground with
                   1607: the foreground command
                   1608: .BR fg .
                   1609: A \fB^Z\fR takes effect immediately and
                   1610: is like an interrupt in that pending output and unread input are discarded
                   1611: when it is typed.
                   1612: .PP
                   1613: A job being run in the background will stop if it tries to read
                   1614: from the terminal.  Background jobs are normally allowed to produce output,
                   1615: but this can be disabled by giving the command ``stty tostop''.
                   1616: If you set this
                   1617: tty option, then background jobs will stop when they try to produce
                   1618: output like they do when they try to read input.
                   1619: .PP
                   1620: There are several ways to refer to jobs in the shell.  The character
                   1621: .B %
                   1622: introduces a job name.  If you wish to refer to job number 1, you can
                   1623: name it as
                   1624: .B %1 . 
                   1625: Jobs can also be named by prefixes of the string typed in to
                   1626: .B kill
                   1627: or restart them.
                   1628: Thus, on systems that support job control,
                   1629: .RB ` fg
                   1630: .BR %ed '
                   1631: would normally restart
                   1632: a suspended
                   1633: .IR ed (1)
                   1634: job, if there were a suspended job whose name began with
                   1635: the string `ed'. 
                   1636: .PP
                   1637: The shell maintains a notion of the current and previous jobs.
                   1638: In output pertaining to jobs, the current job is marked with a
                   1639: .B +
                   1640: and the previous job with a
                   1641: .BR \- .
                   1642: The abbreviation
                   1643: .B %+
                   1644: refers
                   1645: to the current job and
                   1646: .B %\-
                   1647: refers to the previous job.
                   1648: .B %%
                   1649: is also a synonym for the current job.
                   1650: .PP
                   1651: This shell learns immediately whenever a process changes state.
                   1652: It normally informs you whenever a job becomes blocked so that
                   1653: no further progress is possible, but only just before it prints
                   1654: a prompt.  This is done so that it does not otherwise disturb your work.
                   1655: .PP
                   1656: When you try to leave the shell while jobs are running or stopped, you will
                   1657: be warned that `You have stopped(running) jobs.'  You may use the
                   1658: .B jobs
                   1659: command to see what they are.  If you do this or immediately try to
                   1660: exit again, the shell will not warn you a second time, and the stopped
                   1661: jobs will be terminated.
                   1662: .SS Signals.
                   1663: The \s-1INT\s+1 and \s-1QUIT\s+1 signals for an invoked
                   1664: command are ignored if the command is followed by
                   1665: .B & 
                   1666: and job
                   1667: .B monitor
                   1668: option is not active.
                   1669: Otherwise, signals have the values
                   1670: inherited by the shell from its parent,
                   1671: with the exception of signal 11
                   1672: (but see also
                   1673: the
                   1674: .B trap
                   1675: command below).
                   1676: .SS Execution.
                   1677: Each time a command is executed, the above substitutions
                   1678: are carried out.
                   1679: If the command name matches one
                   1680: of the
                   1681: .I "Special Commands\^"
                   1682: listed below,
                   1683: it is executed within the
                   1684: current shell process.
                   1685: Next, the command name is checked to see if
                   1686: it matches one of the user defined functions.
                   1687: If it does,
                   1688: the positional parameters are saved
                   1689: and then reset to the arguments of the
                   1690: .I function\^
                   1691: call.
                   1692: When the
                   1693: .I function\^
                   1694: completes or issues a
                   1695: .BR return ,
                   1696: the positional parameter list is restored
                   1697: and any trap set on
                   1698: .SM
                   1699: .B EXIT
                   1700: within the function is executed.
                   1701: The value of a
                   1702: .I function\^
                   1703: is the value of the last command executed.
                   1704: A function is also executed in the
                   1705: current shell process.
                   1706: If a command name is not a
                   1707: .I "special command\^"
                   1708: or a user defined
                   1709: .IR function ,
                   1710: a process is created and
                   1711: an attempt is made to execute the command via
                   1712: .IR exec (2).
                   1713: .PP
                   1714: The shell parameter
                   1715: .B
                   1716: .SM PATH
                   1717: defines the search path for
                   1718: the directory containing the command.
                   1719: Alternative directory names are separated by
                   1720: a colon
                   1721: .RB ( : ).
                   1722: The default path is
                   1723: .B :/bin:/usr/bin
                   1724: (specifying the current directory,
                   1725: .BR /bin ,
                   1726: and
                   1727: .BR /usr/bin ,
                   1728: in that order).
                   1729: Note that the current directory
                   1730: is specified by a null path name,
                   1731: which can appear immediately after the
                   1732: equal sign, between colon delimiters,
                   1733: or at the end of the path list.
                   1734: If the command name contains a \f3/\fP then the search path
                   1735: is not used.
                   1736: Otherwise, each directory in the path is
                   1737: searched for an executable file.
                   1738: If the file has execute permission but is not a
                   1739: directory or an
                   1740: .B a.out
                   1741: file,
                   1742: it is assumed to be a file containing shell commands.
                   1743: A sub-shell is spawned to read it.
                   1744: All non-exported aliases,
                   1745: functions,
                   1746: and named parameters are removed in this case.
                   1747: A parenthesized command is also executed in
                   1748: a sub-shell.
                   1749: .SS Command Re-entry.
                   1750: The text of the last
                   1751: .B
                   1752: .SM
                   1753: HISTSIZE
                   1754: (default 128)
                   1755: commands entered from a terminal device
                   1756: is saved in a
                   1757: .I history
                   1758: file.
                   1759: The file
                   1760: .B \s-1$HOME\s+1/.history
                   1761: is used if the
                   1762: .B
                   1763: .SM
                   1764: HISTFILE
                   1765: variable is not set
                   1766: or is not writable.
                   1767: A shell can access the commands of
                   1768: all
                   1769: .I interactive
                   1770: shells which use the same named
                   1771: .SM
                   1772: .BR HISTFILE .
                   1773: The special command
                   1774: .B fc\^
                   1775: is used to list or
                   1776: edit a portion this file.
                   1777: The portion of the file to be edited or listed can be selected by
                   1778: number or by giving the first character or
                   1779: characters of the command.
                   1780: A single command or range of commands can be specified.
                   1781: If you do not specify an editor program as
                   1782: an argument to
                   1783: .B fc\^
                   1784: then the value of the parameter
                   1785: .SM
                   1786: .B FCEDIT
                   1787: is used.
                   1788: If
                   1789: .SM
                   1790: .B FCEDIT
                   1791: is not defined then
                   1792: .I /bin/ed
                   1793: is used.
                   1794: The edited command(s) is printed and re-executed upon
                   1795: leaving the editor.
                   1796: The editor name
                   1797: .B \-
                   1798: is used to skip the editing phase and
                   1799: to re-execute the command.
                   1800: In this case a substitution parameter of the form
                   1801: \f2old\fP\f3=\fP\f2new\fP
                   1802: can be used to modify the command before execution.
                   1803: For example, if
                   1804: .B r
                   1805: is aliased to
                   1806: .B \(fmfc \-e \-\(fm
                   1807: then typing
                   1808: `\f3r bad=good c\fP'
                   1809: will re-execute the most recent command which starts with the letter
                   1810: .BR c ,
                   1811: replacing the string
                   1812: .B bad
                   1813: with the string
                   1814: .BR good .
                   1815: .SS In-line Editing Options
                   1816: Normally, each command line entered from a terminal device is simply
                   1817: typed followed by a new-line (`RETURN' or `LINE\ FEED').
                   1818: If either the
                   1819: .IR emacs ,
                   1820: .IR gmacs ,
                   1821: or
                   1822: .I vi
                   1823: option is active, the user can edit the command line.
                   1824: To be in either of these edit modes
                   1825: .B set
                   1826: the corresponding
                   1827: option.
                   1828: An editing option is automatically selected each time the
                   1829: .SM
                   1830: .B VISUAL
                   1831: or
                   1832: .SM
                   1833: .B EDITOR
                   1834: variable is assigned a value ending in either of these
                   1835: option names.
                   1836: .PP
                   1837: The editing features require that the user's terminal
                   1838: accept `RETURN' as carriage return without line feed
                   1839: and that a space (`\ ' must overwrite the current character on
                   1840: the screen.
                   1841: ADM terminal users should set the "space\ -\ advance"
                   1842: switch to `space'.
                   1843: Hewlett-Packard series 2621 terminal users should set the straps to
                   1844: `bcGHxZ\ etX'.
                   1845: .PP
                   1846: The editing modes implement a concept where the user is looking through a
                   1847: window at the current line.
                   1848: The window width is the value of
                   1849: .SM
                   1850: .B COLUMNS
                   1851: if it is defined, otherwise 80.
                   1852: If the line is longer than the window width minus two, a mark is
                   1853: displayed at the end of the window to notify the user.
                   1854: As the cursor moves and reaches the window boundaries the window will be
                   1855: centered about the cursor.
                   1856: The mark is a
                   1857: .BR > " ("
                   1858: .BR < ", "
                   1859: .BR * )
                   1860: if the line extends on the 
                   1861: right (left, both) side(s) of the window.
                   1862: .SS Emacs Editing Mode
                   1863: This mode is entered by enabling either the
                   1864: .I emacs
                   1865: or
                   1866: .I gmacs
                   1867: option.
                   1868: The only difference between these two modes is the way
                   1869: they handle
                   1870: .BR ^T .
                   1871: To edit, the user
                   1872: moves the cursor to the point needing correction and
                   1873: then inserts or deletes characters or words as needed.
                   1874: All the editing commands are control characters or escape
                   1875: sequences.
                   1876: The notation for control characters is caret (
                   1877: .B ^
                   1878: ) followed
                   1879: by the character.
                   1880: For example,
                   1881: .B ^F
                   1882: is the notation for control
                   1883: .BR F .
                   1884: This is entered by depressing `f' while holding down the
                   1885: `CTRL' (control) key.
                   1886: The `SHIFT' key is
                   1887: .I not 
                   1888: depressed.
                   1889: (The notation
                   1890: .B ^?
                   1891: indicates the DEL (delete) key.)
                   1892: .PP
                   1893: The notation for escape sequences is
                   1894: .B M-
                   1895: followed by a
                   1896: character.
                   1897: For example,
                   1898: .B M-f
                   1899: (pronounced Meta f)
                   1900: is entered by depressing ESC
                   1901: (ascii
                   1902: .B 033
                   1903: )
                   1904: followed by `f'.
                   1905: (
                   1906: .B M-F
                   1907: would be the notation for ESC followed by `SHIFT' (capital) `F'.)
                   1908: .PP
                   1909: All edit commands
                   1910: operate from any place on the line
                   1911: (not just at the beginning).
                   1912: Neither the "RETURN" nor the "LINE FEED" key is
                   1913: entered after edit commands except when noted.
                   1914: .PP
                   1915: .PD 0
                   1916: .TP 10
                   1917: .BI ^F
                   1918: Move cursor forward (right) one character. 
                   1919: .PP
                   1920: .TP 10
                   1921: .BI M-f
                   1922: Move cursor forward one word.
                   1923: (The editor's idea of a word is a string of characters
                   1924: consisting of only letters, digits and underscores.)
                   1925: .PP
                   1926: .TP 10
                   1927: .BI ^B 
                   1928: Move cursor backward (left) one character.
                   1929: .PP
                   1930: .TP 10
                   1931: .BI M-b
                   1932: Move cursor backward one word.
                   1933: .PP
                   1934: .TP 10
                   1935: .BI ^A 
                   1936: Move cursor to start of line.
                   1937: .PP
                   1938: .TP 10
                   1939: .BI ^E 
                   1940: Move cursor to end of line.
                   1941: .PP
                   1942: .TP 10
                   1943: .BI ^] char 
                   1944: Move cursor to character
                   1945: .I char
                   1946: on current line.
                   1947: .PP
                   1948: .TP 10
                   1949: .BI ^X^X
                   1950: Interchange the cursor and mark.
                   1951: .PP
                   1952: .TP 10
                   1953: .I erase
                   1954: (User defined erase character as defined
                   1955: by the stty command, usually
                   1956: .B ^H
                   1957: or
                   1958: .BR # .)
                   1959: Delete previous character.
                   1960: .PP
                   1961: .TP 10
                   1962: .BI ^D 
                   1963: Delete current character.
                   1964: .PP
                   1965: .TP 10
                   1966: .BI M-d
                   1967: Delete current word.
                   1968: .PP
                   1969: .TP 10
                   1970: .BI M-^H
                   1971: (Meta-backspace) Delete previous word.
                   1972: .PP
                   1973: .TP 10
                   1974: .BI M-h
                   1975: Delete previous word.
                   1976: .PP
                   1977: .TP 10
                   1978: .BI M-^?
                   1979: (Meta-DEL) Delete previous word (if your interrupt character is
                   1980: .B ^?
                   1981: (DEL, the default) then this command will not work).
                   1982: .PP
                   1983: .TP 10
                   1984: .BI ^T
                   1985: Transpose current character with next character in
                   1986: .I emacs
                   1987: mode.
                   1988: Transpose two previous characters in
                   1989: .I gmacs
                   1990: mode.
                   1991: .PP
                   1992: .TP 10
                   1993: .BI ^C
                   1994: Capitalize current character.
                   1995: .PP
                   1996: .TP 10
                   1997: .BI M-C
                   1998: Capitalize current word.
                   1999: .PP
                   2000: .TP 10
                   2001: .BI ^K 
                   2002: Kill from the cursor to the end of the line.
                   2003: If given a parameter of zero then kill from
                   2004: the start of line to the cursor.
                   2005: .PP
                   2006: .TP 10
                   2007: .BI ^W
                   2008: Kill from the cursor to the mark.
                   2009: .PP
                   2010: .TP 10
                   2011: .BI M-p
                   2012: Push the region from the cursor to the mark on the stack.
                   2013: .PP
                   2014: .TP 10
                   2015: .I kill
                   2016: (User defined kill character as defined
                   2017: by the stty command, usually
                   2018: .B ^G
                   2019: or
                   2020: .BR @ .)
                   2021: Kill the entire current line.
                   2022: If two
                   2023: .I kill
                   2024: characters are entered in succession, all
                   2025: kill characters from then on cause a line feed
                   2026: (useful when using paper terminals).
                   2027: .PP
                   2028: .TP 10
                   2029: .BI ^Y
                   2030: Restore last item removed from line. (Yank item back to the line.)
                   2031: .PP
                   2032: .TP 10
                   2033: .BI ^L 
                   2034: Line feed and print current line.
                   2035: .PP
                   2036: .TP 10
                   2037: .BI ^@
                   2038: (Null character) Set mark.
                   2039: .PP
                   2040: .TP 10
                   2041: .BI M-
                   2042: (Meta space) Set mark.
                   2043: .PP
                   2044: .TP 10
                   2045: .BI ^J 
                   2046: (New\ line)  Execute the current line.
                   2047: .PP
                   2048: .TP 10
                   2049: .BI ^M 
                   2050: (Return)  Execute the current line.
                   2051: .PP
                   2052: .TP 10
                   2053: .I eof
                   2054: End-of-file character,
                   2055: normally
                   2056: .BR ^D ,
                   2057: will terminate the shell
                   2058: if the current line is null.
                   2059: .PP
                   2060: .TP 10
                   2061: .BI ^P
                   2062: Fetch previous command. 
                   2063: Each time 
                   2064: .B ^P 
                   2065: is entered
                   2066: the previous command back in time is accessed.
                   2067: .PP
                   2068: .TP 10
                   2069: .BI M-<
                   2070: Fetch the least recent (oldest) history line.
                   2071: .PP
                   2072: .TP 10
                   2073: .BI M->
                   2074: Fetch the most recent (youngest) history line.
                   2075: .PP
                   2076: .TP 10
                   2077: .BI ^N
                   2078: Fetch next command. 
                   2079: Each time 
                   2080: .B ^N 
                   2081: is entered
                   2082: the next command forward in time is accessed.
                   2083: .PP
                   2084: .TP 10
                   2085: .BI ^R string
                   2086: Reverse search history for a previous command line containing
                   2087: .IR string .
                   2088: If a parameter of zero is given the search is forward.
                   2089: .I String
                   2090: is terminated by a "RETURN" or "NEW\ LINE".
                   2091: .PP
                   2092: .TP 10
                   2093: .B  ^O
                   2094: Operate \- Execute the current line and fetch
                   2095: the next line relative to current line from the
                   2096: history file.
                   2097: .PP
                   2098: .TP 10
                   2099: .BI M- digits
                   2100: (Escape) Define numeric parameter, the digits
                   2101: are taken as a parameter to the next command.
                   2102: The commands that accept a parameter are 
                   2103: .BR ^F ,
                   2104: .BR ^B ,
                   2105: .IR erase ,
                   2106: .BR ^D ,
                   2107: .BR ^K ,
                   2108: .BR ^R ,
                   2109: .B ^P
                   2110: and
                   2111: .BR ^N .
                   2112: .PP
                   2113: .TP 10
                   2114: .BI M- letter
                   2115: Soft-key \- Your alias list is searched for an
                   2116: alias by the name
                   2117: .BI _ letter
                   2118: and if an alias of this name is defined, its
                   2119: value will be inserted on the line.
                   2120: The
                   2121: .I letter
                   2122: must not be one of the above meta-functions.
                   2123: .PP
                   2124: .TP 10
                   2125: .B  M-_
                   2126: The last parameter of the previous command is inserted
                   2127: on the line.
                   2128: .PP
                   2129: .TP 10
                   2130: .B  M-.
                   2131: The last parameter of the previous command is inserted
                   2132: on the line.
                   2133: .PP
                   2134: .TP 10
                   2135: .B  M-*
                   2136: Attempt file name generation on the current word.
                   2137: .PP
                   2138: .TP 10
                   2139: .BI ^U
                   2140: Multiply parameter of next command by 4.
                   2141: .PP
                   2142: .TP 10
                   2143: .BI \e
                   2144: Escape next character.  
                   2145: Editing characters, the user's erase, kill and 
                   2146: interrupt (normally
                   2147: .B ^?
                   2148: )
                   2149: characters 
                   2150: may be entered
                   2151: in a command line or in a search string if preceded by a
                   2152: .BR \e .
                   2153: The
                   2154: .B \e
                   2155: removes the next character's
                   2156: editing features (if any).
                   2157: .PP
                   2158: .TP 10
                   2159: .BI ^V
                   2160: Display version of the shell.
                   2161: .PD
                   2162: .SS Vi Editing Mode
                   2163: There are two typing modes.
                   2164: Initially, when you enter a command you are in the
                   2165: .I input\^
                   2166: mode.
                   2167: To edit, the user enters
                   2168: .I control\^
                   2169: mode by typing ESC (
                   2170: .B 033
                   2171: ) and
                   2172: moves the cursor to the point needing correction and
                   2173: then inserts or deletes characters or words as needed.
                   2174: Most control commands accept an optional repeat
                   2175: .I count
                   2176: prior to the command.
                   2177: .P
                   2178: When in vi mode on most systems,
                   2179: canonical processing is initially enabled and the
                   2180: command will be echoed again if the speed is 1200 baud or greater and it
                   2181: contains any control characters or less than one second has elapsed
                   2182: since the prompt was printed.
                   2183: The ESC character terminates canonical processing for the remainder of the command
                   2184: and the user can than modify the command line.
                   2185: This scheme has the advantages of canonical processing with the type-ahead
                   2186: echoing of raw mode.
                   2187: .P
                   2188: If the option
                   2189: .B viraw\^
                   2190: is also set, the terminal will always have canonical processing
                   2191: disabled.  This mode is implicit for systems that do not support two
                   2192: alternate end of line delimiters,
                   2193: and may be helpful for certain terminals.
                   2194: .SS "\ \ \ \ \ Input Edit Commands"
                   2195: .PP
                   2196: .RS
                   2197: By default the editor is in input mode.
                   2198: .PD 0
                   2199: .TP 10
                   2200: .I erase
                   2201: (User defined erase character as defined
                   2202: by the stty command, usually
                   2203: .B ^H
                   2204: or
                   2205: .BR # .)
                   2206: Delete previous character.
                   2207: .TP 10
                   2208: .BI ^W
                   2209: Delete the previous blank separated word.
                   2210: .TP 10
                   2211: .BI ^D
                   2212: Terminate the shell.
                   2213: .TP 10
                   2214: .BI ^V
                   2215: Escape next character.  
                   2216: Editing characters, the user's erase or kill
                   2217: characters may be entered
                   2218: in a command line or in a search string if preceded by a
                   2219: .BR ^V .
                   2220: The
                   2221: .B ^V 
                   2222: removes the next character's
                   2223: editing features (if any).
                   2224: .TP 10
                   2225: .BI \e
                   2226: Escape the next
                   2227: .I erase
                   2228: or
                   2229: .I kill
                   2230: character.
                   2231: .P
                   2232: .RE
                   2233: .SS "\ \ \ \ \ Motion Edit Commands"
                   2234: .RS
                   2235: These commands will move the cursor.
                   2236: .TP 10
                   2237: [\f2count\fP]\f3l\fP
                   2238: Cursor forward (right) one character. 
                   2239: .TP 10
                   2240: [\f2count\fP]\f3w\fP
                   2241: Cursor forward one alpha-numeric word.
                   2242: .TP 10
                   2243: [\f2count\fP]\f3W\fP
                   2244: Cursor to the beginning of the next word that follows a blank.
                   2245: .TP 10
                   2246: [\f2count\fP]\f3e\fP
                   2247: Cursor to end of word.
                   2248: .TP 10
                   2249: [\f2count\fP]\f3E\fP
                   2250: Cursor to end of the current blank delimited word.
                   2251: .TP 10
                   2252: [\f2count\fP]\f3h\fP
                   2253: Cursor backward (left) one character.
                   2254: .TP 10
                   2255: [\f2count\fP]\f3b\fP
                   2256: Cursor backward one word.
                   2257: .TP 10
                   2258: [\f2count\fP]\f3B\fP
                   2259: Cursor to preceding blank separated word.
                   2260: .TP 10
                   2261: [\f2count\fP]\f3f\fP\f2c\fP
                   2262: Find the next character \fIc\fP in the current line.
                   2263: .TP 10
                   2264: [\f2count\fP]\f3F\fP\f2c\fP
                   2265: Find the previous character \fIc\fP in the current line.
                   2266: .TP 10
                   2267: [\f2count\fP]\f3t\fP\f2c\fP
                   2268: Equivalent to
                   2269: .B f
                   2270: followed by
                   2271: .BR h .
                   2272: .TP 10
                   2273: [\f2count\fP]\f3T\fP\f2c\fP
                   2274: Equivalent to
                   2275: .B F
                   2276: followed by
                   2277: .BR l .
                   2278: .TP 10
                   2279: .B ;
                   2280: Repeats the last single character find command,
                   2281: .BR f ,
                   2282: .BR F ,
                   2283: .BR t ,
                   2284: or
                   2285: .BR T .
                   2286: .TP 10
                   2287: .B ,
                   2288: Reverses the last single character find command.
                   2289: .TP 10
                   2290: .B 0 
                   2291: Cursor to start of line.
                   2292: .TP 10
                   2293: .B ^ 
                   2294: Cursor to first non-blank character in line.
                   2295: .TP 10
                   2296: .B $ 
                   2297: Cursor to end of line.
                   2298: .RE
                   2299: .SS "\ \ \ \ \ Search Edit Commands"
                   2300: .RS
                   2301: These commands access your command history.
                   2302: .TP 10
                   2303: [\f2count\fP]\f3k\fP
                   2304: Fetch previous command. 
                   2305: Each time 
                   2306: .B k 
                   2307: is entered
                   2308: the previous command back in time is accessed.
                   2309: .TP 10
                   2310: [\f2count\fP]\f3\-\fP
                   2311: Equivalent to
                   2312: .BR k .
                   2313: .TP 10
                   2314: [\f2count\fP]\f3j\fP
                   2315: Fetch next command. 
                   2316: Each time 
                   2317: .B j 
                   2318: is entered
                   2319: the next command forward in time is accessed.
                   2320: .TP 10
                   2321: [\f2count\fP]\f3+\fP
                   2322: Equivalent to
                   2323: .BR j .
                   2324: .TP 10
                   2325: [\f2count\fP]\f3G\fP
                   2326: The command number
                   2327: .I count
                   2328: is fetched.
                   2329: The default is the least recent history command.
                   2330: .TP 10
                   2331: .BI / string
                   2332: Search backward through history for a previous command containing
                   2333: .IR string .
                   2334: .I String
                   2335: is terminated by a "RETURN" or "NEW\ LINE".
                   2336: If \fIstring\fP is null the previous string will be used.
                   2337: .TP 10
                   2338: .BI ? string
                   2339: Same as
                   2340: .B /
                   2341: except that search will be in the forward direction.
                   2342: .TP 10
                   2343: .B n
                   2344: Search for next match of the last pattern to
                   2345: .B /
                   2346: or
                   2347: .B ?
                   2348: commands.
                   2349: .TP 10
                   2350: .B N
                   2351: Search for next match of the last pattern to
                   2352: .B /
                   2353: or
                   2354: .BR ? ,
                   2355: but in reverse direction.
                   2356: Search history for the \fIstring\fP entered by the previous \fB/\fP command.
                   2357: .RE
                   2358: .SS "\ \ \ \ \ Text Modification Edit Commands"
                   2359: .RS
                   2360: These commands will modify the line.
                   2361: .TP 10
                   2362: .B a
                   2363: Enter input mode and enter text after the current character.
                   2364: .TP 10
                   2365: .B A
                   2366: Append text to the end of the line.  Equivalent to
                   2367: .BR $a .
                   2368: .TP 10
                   2369: [\f2count\fP]\f3c\fP\f2motion\fP
                   2370: .TP 10
                   2371: \f3c\fP[\f2count\fP]\f2motion\fP
                   2372: Delete current character through the character
                   2373: .I motion
                   2374: moves the cursor to and enter input mode.
                   2375: If \fImotion\fP is
                   2376: .BR c ,
                   2377: the entire line will be deleted and
                   2378: input mode entered.
                   2379: .TP 10
                   2380: .B C
                   2381: Delete the current character through the end of line and enter input mode.
                   2382: Equivalent to
                   2383: .BR c$ .
                   2384: .TP 10
                   2385: .B S
                   2386: Equivalent to
                   2387: .BR cc .
                   2388: .TP 10
                   2389: .B D
                   2390: Delete the current character through the end of line.
                   2391: .TP 10
                   2392: [\f2count\fP]\f3d\fP\f2motion\fP
                   2393: .TP 10
                   2394: \f3d\fP[\f2count\fP]\f2motion\fP
                   2395: Delete current character through the character
                   2396: .I motion
                   2397: moves the cursor to.  Equivalent to
                   2398: .BR d$ .
                   2399: If \fImotion\fP is
                   2400: .B d ,
                   2401: the entire line will be deleted.
                   2402: .TP 10
                   2403: .B i
                   2404: Enter input mode and insert text before the current character.
                   2405: .TP 10
                   2406: .B I
                   2407: Insert text before the beginning of the line.  Equivalent to
                   2408: the two character sequence
                   2409: .BR ^i .
                   2410: .TP 10
                   2411: [\f2count\fP]\f3P\fP
                   2412: Place the previous text modification before the cursor.
                   2413: .TP 10
                   2414: [\f2count\fP]\f3p\fP
                   2415: Place the previous text modification after the cursor.
                   2416: .TP 10
                   2417: .B R
                   2418: Enter input mode and
                   2419: replace characters on the screen with characters you type overlay fashion.
                   2420: .TP 10
                   2421: .BI r c
                   2422: Replace the current character with
                   2423: .IR c .
                   2424: .TP 10
                   2425: [\f2count\fP]\f3x\fP
                   2426: Delete current character.
                   2427: .TP 10
                   2428: [\f2count\fP]\f3X\fP
                   2429: Delete preceding character.
                   2430: .TP 10
                   2431: [\f2count\fP]\f3.\fP
                   2432: Repeat the previous text modification command.
                   2433: .TP 10
                   2434: .B \(ap
                   2435: Invert the case of the current character and advance the cursor.
                   2436: .TP 10
                   2437: [\f2count\fP]\f3_\fP
                   2438: Causes the
                   2439: .I count\^
                   2440: word of the previous command to be appended and
                   2441: input mode entered.
                   2442: The last word is used
                   2443: if
                   2444: .I count\^
                   2445: is omitted.
                   2446: .TP 10
                   2447: .B *
                   2448: Causes an
                   2449: .B *
                   2450: to be appended to the current word and file name generation attempted.
                   2451: If no match is found,
                   2452: it rings the bell.  Otherwise, the word is replaced
                   2453: by the matching pattern and input mode is entered.
                   2454: .RE
                   2455: .SS "\ \ \ \ \ Other Edit Commands"
                   2456: .RS
                   2457: Miscellaneous commands.
                   2458: .TP 10
                   2459: .B u
                   2460: Undo the last text modifying command.
                   2461: .TP 10
                   2462: .B U
                   2463: Undo all the text modifying commands performed on the line.
                   2464: .TP 10
                   2465: [\f2count\fP]\f3v\fP
                   2466: Returns the command
                   2467: .BI "fc \-e ${\s-1VISUAL\s+1:\-${\s-1EDITOR\s+1:\-vi}}" " count"
                   2468: in the input buffer.
                   2469: If
                   2470: .I count\^
                   2471: is omitted, then the current line is used.
                   2472: .TP 10
                   2473: .BI ^L 
                   2474: Line feed and print current line.
                   2475: Has effect only in control mode.
                   2476: .TP 10
                   2477: .BI ^J 
                   2478: (New\ line)  Execute the current line, regardless of mode.
                   2479: .TP 10
                   2480: .BI ^M 
                   2481: (Return)  Execute the current line, regardless of mode.
                   2482: .TP 10
                   2483: .B \#
                   2484: Equivalent to
                   2485: \f3I#\fP\f2<cr>\fP.
                   2486: Useful for causing the current line to be
                   2487: inserted in the history without being executed.
                   2488: .RE
                   2489: .PD
                   2490: .SS Special Commands.
                   2491: The following simple-commands are executed in the shell process.
                   2492: Input/Output redirection is permitted.
                   2493: File descriptor 1 is the default output location.
                   2494: Parameter assignment lists preceding the command do not
                   2495: remain in effect when the command completes unless noted.
                   2496: .TP
                   2497: \f3:\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2498: Parameter assignments remain in effect after the command completes.
                   2499: The command only expands parameters.
                   2500: A zero exit code is returned.
                   2501: .br
                   2502: .ne 2
                   2503: .TP
                   2504: \f3\|. \f2file\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2505: Parameter assignments remain in effect after the command completes.
                   2506: Read and execute commands from
                   2507: .I file\^
                   2508: and return.
                   2509: The commands are executed in the current Shell environment.
                   2510: The search path
                   2511: specified by
                   2512: .B
                   2513: .SM PATH
                   2514: is used to find the directory containing
                   2515: .IR file .
                   2516: If any arguments
                   2517: .I arg\^
                   2518: are given,
                   2519: they become the positional parameters.
                   2520: Otherwise the positional parameters are unchanged.
                   2521: .TP
                   2522: \f3alias\fP \*(OK \f3\-tx\fP \*(CK \*(OK \f2name\fP\*(OK \f2=value\^\fP \*(CK  .\|.\|. \*(CK
                   2523: .I Alias\^
                   2524: with no arguments prints the list of aliases
                   2525: in the form
                   2526: .I name=value\^
                   2527: on standard output.
                   2528: An
                   2529: .I alias\^
                   2530: is defined
                   2531: for each name whose
                   2532: .I value\^
                   2533: is given.
                   2534: A trailing space in
                   2535: .I value\^
                   2536: causes the next word to be checked for
                   2537: alias substitution.
                   2538: The
                   2539: .B \-t
                   2540: flag is used to set and list tracked aliases.
                   2541: The value of a tracked alias is the full pathname
                   2542: corresponding to the given
                   2543: .IR name .
                   2544: The value becomes undefined when the value of
                   2545: .SM
                   2546: .B PATH
                   2547: is reset but the aliases remained tracked.
                   2548: Without the
                   2549: .B \-t
                   2550: flag,
                   2551: for each
                   2552: .I name\^
                   2553: in the argument list
                   2554: for which no
                   2555: .I value\^
                   2556: is given, the name
                   2557: and value of the alias is printed.
                   2558: The
                   2559: .B \-x
                   2560: flag is used to set or print exported aliases.
                   2561: An exported alias is defined across sub-shell environments.
                   2562: Alias returns true unless a
                   2563: .I name\^
                   2564: is given for which no alias has been defined.
                   2565: .TP
                   2566: \f3bg\fP \*(OK \f3%\f2job\^\fP \*(CK
                   2567: This command is only built-in on systems that support job control.
                   2568: Puts the specified
                   2569: .I job\^
                   2570: into the background.
                   2571: The current job is put in the background
                   2572: if
                   2573: .I job\^
                   2574: is not specified.
                   2575: .TP
                   2576: \f3break\fP \*(OK \f2n\^\fP \*(CK
                   2577: Exit from the enclosing
                   2578: .BR for
                   2579: .BR while
                   2580: .BR until
                   2581: or
                   2582: .B select\^
                   2583: loop, if any.
                   2584: If
                   2585: .I n\^
                   2586: is specified then break
                   2587: .I n\^
                   2588: levels.
                   2589: .TP
                   2590: \f3continue\fP \*(OK \f2n\^\fP \*(CK
                   2591: Resume the next iteration of the enclosing
                   2592: .BR for
                   2593: .BR while
                   2594: .BR until
                   2595: or
                   2596: .B select\^
                   2597: loop.
                   2598: If
                   2599: .I n\^
                   2600: is specified then resume at the
                   2601: .IR n -th
                   2602: enclosing loop.
                   2603: .TP
                   2604: .PD 0
                   2605: \f3cd\fP \*(OK \f2arg\^\fP \*(CK
                   2606: .TP
                   2607: \f3cd\fP  \f2old\^\fP \f2new\^\fP
                   2608: .PD
                   2609: This command can be in either of two forms.
                   2610: In the first form it
                   2611: changes the current directory to
                   2612: .IR arg .
                   2613: If
                   2614: .I arg\^
                   2615: is
                   2616: .B \-
                   2617: the directory is changed to the previous
                   2618: directory.
                   2619: The shell
                   2620: parameter
                   2621: .B
                   2622: .SM HOME
                   2623: is the default
                   2624: .IR arg .
                   2625: The parameter
                   2626: .SM
                   2627: .B PWD
                   2628: is set to the current directory.
                   2629: The shell parameter
                   2630: .B
                   2631: .SM CDPATH
                   2632: defines the search path for
                   2633: the directory containing 
                   2634: .IR arg .
                   2635: Alternative directory names are separated by
                   2636: a colon
                   2637: .RB ( : ).
                   2638: The default path is
                   2639: .B <null>
                   2640: (specifying the current directory).
                   2641: Note that the current directory is specified by a null path name,
                   2642: which can appear immediately after the equal sign
                   2643: or between the colon delimiters anywhere else in the path list.
                   2644: If 
                   2645: .I arg
                   2646: begins with a \f3/\fP then the search path
                   2647: is not used.
                   2648: Otherwise, each directory in the path is
                   2649: searched for
                   2650: .IR arg .
                   2651: .P
                   2652: The second form of
                   2653: .B cd
                   2654: substitutes the string
                   2655: .I new
                   2656: for the string
                   2657: .I old
                   2658: in the current directory name,
                   2659: .SM
                   2660: .B PWD
                   2661: and tries to change to this new directory.
                   2662: .P
                   2663: The
                   2664: .B cd\^
                   2665: command may not be executed by
                   2666: .I rsh\^.
                   2667: .TP
                   2668: \f3eval\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2669: The arguments are read as input
                   2670: to the shell
                   2671: and the resulting command(s) executed.
                   2672: .TP
                   2673: \f3exec\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2674: Parameter assignments remain in effect after the command completes.
                   2675: If
                   2676: .I arg\^
                   2677: is given,
                   2678: the command specified by
                   2679: the arguments is executed in place of this shell
                   2680: without creating a new process.
                   2681: Input/output arguments may appear and
                   2682: affect the current process.
                   2683: If no 
                   2684: arguments are given
                   2685: the effect of this command is to
                   2686: modify file descriptors
                   2687: as prescribed by the input/output redirection list.
                   2688: In this case,
                   2689: any file descriptor numbers greater than 2 that are
                   2690: opened with this mechanism are closed when invoking
                   2691: another program.
                   2692: .TP
                   2693: \f3exit\fP \*(OK \f2n\^\fP \*(CK
                   2694: Causes the shell to exit
                   2695: with the exit status specified by
                   2696: .IR n .
                   2697: If
                   2698: .I n\^
                   2699: is omitted then the exit status is that of the last command executed.
                   2700: An end-of-file will also cause the shell to exit
                   2701: except for a
                   2702: shell which has the
                   2703: .I ignoreeof
                   2704: option (See
                   2705: .B set
                   2706: below) turned on.
                   2707: .TP
                   2708: \f3export\fP \*(OK \f2name\^\fP .\|.\|. \*(CK
                   2709: The given
                   2710: .IR name s
                   2711: are marked for automatic
                   2712: export to the
                   2713: .I environment\^
                   2714: of subsequently-executed commands.
                   2715: .TP
                   2716: .PD 0
                   2717: \f3fc\fP \*(OK \f3\-e \f2ename\^\fP \ \*(CK \*(OK \f3\-\f3nlr\^\f1 \*(CK \*(OK \f2first\^\fP \*(CK \*(OK \f2last\^\fP \*(CK
                   2718: .TP
                   2719: \f3fc \-e \-\fP  \*(OK \f2old\fP\f3\=\fP\f2new\^\fP \*(CK \*(OK \f2command\^\fP \*(CK
                   2720: .PD
                   2721: In the first form,
                   2722: a range of commands from
                   2723: .I first\^
                   2724: to
                   2725: .I last\^
                   2726: is selected from the last
                   2727: .SM
                   2728: .B HISTSIZE
                   2729: commands that were typed at the terminal.
                   2730: The arguments
                   2731: .I first\^
                   2732: and
                   2733: .I last\^
                   2734: may be specified as a number or as a string.
                   2735: A string is used to locate the most recent command starting with
                   2736: the given string.
                   2737: A negative number is used as an offset to the current command number.
                   2738: If the flag
                   2739: .BR \-l ,
                   2740: is selected,
                   2741: the commands are listed on standard output.
                   2742: Otherwise, the editor program
                   2743: .I ename\^
                   2744: is invoked on a file containing these
                   2745: keyboard commands.
                   2746: If
                   2747: .I ename\^
                   2748: is not supplied, then the value of the parameter
                   2749: .SM
                   2750: .B FCEDIT
                   2751: (default /bin/ed)
                   2752: is used as the editor.
                   2753: When editing is complete, the edited command(s)
                   2754: is executed.
                   2755: .I last\^
                   2756: is not specified
                   2757: then it will be set to
                   2758: .IR first .
                   2759: If
                   2760: .I first\^
                   2761: is not specified
                   2762: the default is the previous command
                   2763: for editing and \-16 for listing.
                   2764: The flag
                   2765: .B \-r
                   2766: reverses the order of the commands and
                   2767: the flag
                   2768: .B \-n
                   2769: suppresses command numbers when listing.
                   2770: In the second form the
                   2771: .I command\^
                   2772: is re-executed after the substitution
                   2773: \f2old\^\fP\f3=\fP\f2new\^\fP
                   2774: is performed.
                   2775: .TP
                   2776: \f3fg\fP \*(OK \f3%\f2job\^\fP \*(CK
                   2777: This command is only built-in on systems that support job control.
                   2778: If
                   2779: .I job\^
                   2780: is specified it brings it to the foreground.
                   2781: Otherwise, the current job is
                   2782: brought into the foreground.
                   2783: .TP
                   2784: \f3jobs\fP \*(OK \f3\-l\^\fP \*(CK
                   2785: Lists the active jobs; given the
                   2786: .B \-l
                   2787: options lists process id's in addition to the normal information.
                   2788: .TP
                   2789: \f3kill\fP \*(OK \f3\-\f2sig\^\fP \*(CK \f2process\^\fP .\|.\|.
                   2790: Sends either the TERM (terminate) signal or the
                   2791: specified signal to the specified jobs or processes.
                   2792: Signals are either given by number or by names (as given in
                   2793: .I /usr/include/signal.h,
                   2794: stripped of the prefix ``SIG'').
                   2795: The signal names are listed by
                   2796: .BR "kill \-l'" .
                   2797: There is no default, saying just `kill' does not
                   2798: send a signal to the current job.
                   2799: If the signal being sent is TERM (terminate) or HUP (hangup),
                   2800: then the job or process will be sent a CONT (continue) signal
                   2801: if it is stopped.
                   2802: The argument
                   2803: .I process\^
                   2804: can be either a process id or a job.
                   2805: .TP
                   2806: \f3let\fP  \f2arg\^\fP .\|.\|.
                   2807: Each
                   2808: .I arg
                   2809: is an
                   2810: .IR "arithmetic expression"
                   2811: to be evaluated.
                   2812: All calculations are done as long
                   2813: integers and no check for overflow
                   2814: is performed.
                   2815: Expressions consist of constants,
                   2816: named parameters, and operators.
                   2817: The following set of operators,
                   2818: listed in order of decreasing precedence,
                   2819: have been implemented:
                   2820: .RS
                   2821: .PD 0
                   2822: .TP
                   2823: .B \-
                   2824: unary minus
                   2825: .TP
                   2826: .B !
                   2827: logical negation
                   2828: .TP
                   2829: .B "*  /  %"
                   2830: .br
                   2831: multiplication, division, remainder
                   2832: .TP
                   2833: .B "+  \-"
                   2834: addition, subtraction
                   2835: .TP
                   2836: .B "<=  >=  <  >"
                   2837: .br
                   2838: comparison
                   2839: .TP
                   2840: .B "==  !="
                   2841: .br
                   2842: equality  inequality
                   2843: .TP
                   2844: .B =
                   2845: arithmetic replacement
                   2846: .PD
                   2847: .PP
                   2848: Sub-expressions in parentheses
                   2849: .B (\|)
                   2850: are evaluated first and can be used
                   2851: to override the above precedence rules.
                   2852: The evaluation within a precedence group
                   2853: is from right to left for the
                   2854: .B =
                   2855: operator
                   2856: and from left to right for the others.
                   2857: .PP
                   2858: A parameter name must be a valid
                   2859: .IR identifier .
                   2860: When a parameter is encountered,
                   2861: the value associated with the
                   2862: parameter name is substituted and expression evaluation resumes.
                   2863: Up to nine levels of recursion are
                   2864: permitted.
                   2865: .PP
                   2866: The return code is
                   2867: 0 if the value of the last expression
                   2868: is non-zero, and 1 otherwise.
                   2869: .RE
                   2870: .TP
                   2871: \f3newgrp\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2872: Equivalent to
                   2873: .BI "exec newgrp" " arg\^"
                   2874: \&.\|.\|.\^.
                   2875: .TP
                   2876: \f3print\fP \*(OK \f3\-Rnprsu\^\fP\*(OK\f2n\fP \*(CK  \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   2877: The shell output mechanism.
                   2878: With no flags or with flag
                   2879: .BR \- ,
                   2880: the arguments are printed
                   2881: on standard output as described by
                   2882: .IR echo (1).
                   2883: In raw mode,
                   2884: .B \-R
                   2885: or
                   2886: .BR \-r ,
                   2887: the escape conventions of
                   2888: .I echo
                   2889: are ignored.
                   2890: The
                   2891: .B \-R
                   2892: option will print all subsequent arguments and options
                   2893: other than
                   2894: .BR \-n .
                   2895: The
                   2896: .B \-p
                   2897: option causes the 
                   2898: arguments to be written onto the pipe
                   2899: of the process spawned with
                   2900: .B \(bv& 
                   2901: instead of standard output.
                   2902: The
                   2903: .B \-s
                   2904: option causes the 
                   2905: arguments to be written onto the history file
                   2906: instead of standard output.
                   2907: The
                   2908: .B \-u
                   2909: flag can be used to specify a one digit
                   2910: file descriptor unit number
                   2911: .B n\^
                   2912: on which the
                   2913: output will be placed.
                   2914: The default is 1.
                   2915: If the flag
                   2916: .B \-n
                   2917: is used, no 
                   2918: .B new-line\^
                   2919: is added to the output.
                   2920: .TP
                   2921: \f3read\fP \*(OK \f3\-prsu\^\fP\*(OK \f2n\^\fP \*(CK \*(CK \*(OK \f2name\f3?\f2prompt\^\f1 \*(CK \*(OK \f2name\^\fP .\|.\|. \*(CK
                   2922: The shell input mechanism.
                   2923: One line is read and
                   2924: is broken up into words using the characters in
                   2925: .B
                   2926: .SM IFS
                   2927: as separators.
                   2928: In raw mode,
                   2929: .B \-r,
                   2930: a 
                   2931: .B \e
                   2932: at the end of a line does not signify
                   2933: line continuation.
                   2934: The first
                   2935: word is assigned to the first
                   2936: .IR name ,
                   2937: the second word
                   2938: to the second
                   2939: .IR name ,
                   2940: etc., with leftover words assigned to the last
                   2941: .IR name .
                   2942: The
                   2943: .B \-p
                   2944: option causes the input line
                   2945: to be taken from the input pipe
                   2946: of a process spawned by the shell
                   2947: using
                   2948: .BR \(bv& .
                   2949: If the
                   2950: .B \-s
                   2951: fag is present,
                   2952: the input will be saved as a command in the history file.
                   2953: The flag
                   2954: .B \-u
                   2955: can be used to specify a one digit file
                   2956: descriptor unit to read from.
                   2957: The file descriptor can be opened with the
                   2958: .B exec\^
                   2959: special command.
                   2960: The default value of
                   2961: .I n\^
                   2962: is 0.
                   2963: If
                   2964: .IR name
                   2965: is omitted then
                   2966: .SM
                   2967: .B REPLY
                   2968: is used as the default
                   2969: .IR name.
                   2970: The return code is 0 unless an end-of-file is encountered.
                   2971: An end-of-file with the
                   2972: .B \-p
                   2973: option causes cleanup for this process
                   2974: so that another can be spawned.
                   2975: If the first argument contains a
                   2976: .BR ? ,
                   2977: the remainder of this word is used as a
                   2978: .I prompt\^
                   2979: when the shell is interactive.
                   2980: If the given file descriptor is open for writing
                   2981: and is a terminal device then the prompt is placed
                   2982: on this unit.
                   2983: Otherwise the prompt is issued on file descriptor 2.
                   2984: The return code is 0 unless an end-of-file is encountered.
                   2985: .TP
                   2986: \f3readonly\fP \*(OK \f2name\fP .\|.\|. \*(CK
                   2987: The given
                   2988: .IR names
                   2989: are marked
                   2990: readonly and these
                   2991: names cannot be changed
                   2992: by subsequent assignment.
                   2993: .TP
                   2994: \f3return\fP \*(OK \f2n\^\fP \*(CK
                   2995: Causes a shell
                   2996: .I function
                   2997: to return
                   2998: to the invoking script
                   2999: with the return status specified by
                   3000: .IR n .
                   3001: If
                   3002: .I n\^
                   3003: is omitted then the return status is that of the last command executed.
                   3004: If
                   3005: .B return
                   3006: is invoked while not in a
                   3007: .I function
                   3008: then it is the same as an
                   3009: .BR exit .
                   3010: .TP
                   3011: \f3set\fP \*(OK \f3\-aefhkmnostuvx\fP \*(CK \*(OK \f3\-o\fP \f2option\^\fP .\|.\|. \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK
                   3012: The flags for this command have meaning as follows:
                   3013: .RS
                   3014: .PD 0
                   3015: .TP 8
                   3016: .B \-a
                   3017: All subsequent parameters that are defined are automatically exported.
                   3018: .TP 8
                   3019: .B \-e
                   3020: If the shell is non-interactive and if a command fails,
                   3021: execute the
                   3022: .SM
                   3023: .B ERR
                   3024: trap, if set,
                   3025: and exit immediately.
                   3026: This mode is disabled while reading profiles.
                   3027: .TP 8
                   3028: .B \-f
                   3029: Disables file name generation.
                   3030: .TP 8
                   3031: .B \-h
                   3032: Each command whose name is an
                   3033: .I identifier\^
                   3034: becomes a tracked alias when first encountered.
                   3035: .TP 8
                   3036: .B \-k
                   3037: All parameter assignment arguments are placed in the environment for a command,
                   3038: not just those that precede the command name.
                   3039: .TP 8
                   3040: .B \-m
                   3041: Background jobs will run in a separate process group
                   3042: and a line will print upon completion.
                   3043: The exit status of background jobs is reported in a completion message.
                   3044: On systems with job control,
                   3045: this flag is turned on automatically for
                   3046: interactive shells.
                   3047: .TP 8
                   3048: .B \-n
                   3049: Read commands but do not execute them.
                   3050: .TP 8
                   3051: .B \-o
                   3052: The following argument can be one of the following option names:
                   3053: .RS
                   3054: .TP 8
                   3055: .B allexport
                   3056: Same as
                   3057: .BR \-a .
                   3058: .TP 8
                   3059: .B errexit
                   3060: Same as
                   3061: .BR \-e .
                   3062: .TP 8
                   3063: .B emacs
                   3064: Puts you in an
                   3065: .I emacs
                   3066: style in-line editor for command entry.
                   3067: .TP 8
                   3068: .B gmacs
                   3069: Puts you in a
                   3070: .I gmacs
                   3071: style in-line editor for command entry.
                   3072: .TP 8
                   3073: .B ignoreeof
                   3074: The shell will not exit on end-of-file.
                   3075: The command
                   3076: .B exit
                   3077: must be used.
                   3078: .TP 8
                   3079: .B keyword
                   3080: Same as
                   3081: .BR \-k .
                   3082: .TP 8
                   3083: .B markdirs
                   3084: All directory names resulting from file name generation have a trailing
                   3085: .B /
                   3086: appended.
                   3087: .TP 8
                   3088: .B monitor
                   3089: Same as
                   3090: .BR \-m .
                   3091: .TP 8
                   3092: .B noexec
                   3093: Same as
                   3094: .BR \-n .
                   3095: .TP 8
                   3096: .B noglob
                   3097: Same as
                   3098: .BR \-f .
                   3099: .TP 8
                   3100: .B nounset
                   3101: Same as
                   3102: .BR \-u .
                   3103: .TP 8
                   3104: .B verbose
                   3105: Same as
                   3106: .BR \-v .
                   3107: .TP 8
                   3108: .B trackall
                   3109: Same as
                   3110: .BR \-h .
                   3111: .TP 8
                   3112: .B vi
                   3113: Puts you in insert mode of a
                   3114: .I vi\^
                   3115: style in-line editor
                   3116: until you hit escape character
                   3117: .BR 033 .
                   3118: This puts you in move mode.
                   3119: A return sends the line.
                   3120: .TP 8
                   3121: .B viraw
                   3122: Each character is processed as it is typed
                   3123: in
                   3124: .I vi\^
                   3125: mode.
                   3126: .TP 8
                   3127: .B xtrace
                   3128: Same as
                   3129: .BR \-x .
                   3130: .TP 8
                   3131:    
                   3132: If no option name is supplied then the current option settings are printed.
                   3133: .RE
                   3134: .TP 8
                   3135: .B \-s
                   3136: Sort the positional parameters.
                   3137: .TP 8
                   3138: .B \-t
                   3139: Exit after reading and executing one command.
                   3140: .TP 8
                   3141: .B \-u
                   3142: Treat unset parameters as an error when substituting.
                   3143: .TP 8
                   3144: .B \-v
                   3145: Print shell input lines as they are read.
                   3146: .TP 8
                   3147: .B \-x
                   3148: Print commands and their arguments as they are executed.
                   3149: .TP 8
                   3150: .B \-
                   3151: Turns off
                   3152: .B \-x
                   3153: and
                   3154: .B \-v
                   3155: flags and stops examining arguments for flags.
                   3156: .TP 8
                   3157: .B \-\-
                   3158: Do not change any of the flags; useful in setting
                   3159: .B $1
                   3160: to a value beginning with
                   3161: .BR \- .
                   3162: If no arguments follow this flag then the positional parameters are unset.
                   3163: .PD
                   3164: .PP
                   3165: Using
                   3166: .B \+
                   3167: rather than
                   3168: .B \-
                   3169: causes these flags to be turned off.
                   3170: These flags can also be used upon invocation of the shell.
                   3171: The current set of flags may be found in
                   3172: .BR $\- .
                   3173: The remaining arguments are positional
                   3174: parameters and are assigned, in order,
                   3175: .if t to\p
                   3176: .if n to
                   3177: .BR $1 ,
                   3178: .BR $2 ,
                   3179: \&.\|.\|.\^.
                   3180: If no arguments are given then the values
                   3181: of all names are printed on the standard output.
                   3182: .RE
                   3183: .TP
                   3184: \f3shift\fP \*(OK \f2n\^\fP \*(CK
                   3185: .br
                   3186: The positional parameters from
                   3187: \f3$\fP\f2n\fP\f3+1\fP
                   3188: \&.\|.\|.
                   3189: are renamed
                   3190: .B $1
                   3191: \&.\|.\|.\^
                   3192: , default
                   3193: .I n\^
                   3194: is 1.
                   3195: The parameter
                   3196: .I n\^
                   3197: can be any arithmetic expression that evaluates to a non-negative
                   3198: number less than or equal to
                   3199: .BR $# .
                   3200: .TP
                   3201: \f3test\fP \*(OK \f2expr\^\fP \*(CK
                   3202: .br
                   3203: Evaluate conditional expression
                   3204: .IR expr .
                   3205: See
                   3206: .IR test (1)
                   3207: for usage and description.
                   3208: The arithmetic comparison operators
                   3209: are not restricted to integers.
                   3210: They allow any arithmetic expression.
                   3211: Four additional primitive expressions are allowed:
                   3212: .RS
                   3213: .PD 0
                   3214: .TP
                   3215: \f3\-L\fP \f2file\^\fP
                   3216: True if
                   3217: .I file\^
                   3218: is a symbolic link.
                   3219: .TP
                   3220: \f2file1\^\fP \f3\-nt\fP \f2file2\^\fP
                   3221: True if
                   3222: .I file1\^
                   3223: is newer than
                   3224: .IR file2 .
                   3225: .TP
                   3226: \f2file1\^\fP \f3\-ot\fP \f2file2\^\fP
                   3227: True if
                   3228: .I file1\^
                   3229: is older than
                   3230: .IR file2 .
                   3231: .TP
                   3232: \f2file1\^\fP \f3\-ef\fP \f2file2\^\fP
                   3233: True if
                   3234: .I file1\^
                   3235: has the same device and i-node number as
                   3236: .IR file2 .
                   3237: .PD
                   3238: .RE
                   3239: .TP
                   3240: \f3times\fP
                   3241: .br
                   3242: Print the accumulated user and system times for
                   3243: the shell and for processes
                   3244: run from the shell.
                   3245: .TP
                   3246: \f3trap\fP \*(OK \f2arg\^\fP \*(CK \*(OK \f2sig\^\fP \*(CK .\|.\|.
                   3247: .I arg\^
                   3248: is a command to be read and executed when the shell
                   3249: receives signal(s)
                   3250: .IR sig .
                   3251: (Note that
                   3252: .I arg\^
                   3253: is scanned once when
                   3254: the trap is set and once when the trap
                   3255: is taken.)
                   3256: Each
                   3257: .I sig\^
                   3258: can be given as a number or as the name of the signal.
                   3259: Trap commands are executed in order of signal number.
                   3260: Any attempt to set a trap on a signal that
                   3261: was ignored on entry to the current shell
                   3262: is ineffective.
                   3263: An attempt to trap on signal 11 (memory fault) produces an error.
                   3264: If
                   3265: .I arg\^
                   3266: is omitted or is
                   3267: .BR \- ,
                   3268: then all trap(s)
                   3269: .I sig\^
                   3270: are reset
                   3271: to their original values.
                   3272: If
                   3273: .I arg\^
                   3274: is the null
                   3275: string then this signal is ignored by the shell and by the commands
                   3276: it invokes.
                   3277: If
                   3278: .I sig\^
                   3279: is
                   3280: .SM
                   3281: .B ERR
                   3282: then
                   3283: .I arg\^
                   3284: will be executed whenever a command has a non-zero exit code.
                   3285: This trap is not inherited by functions.
                   3286: If
                   3287: .I sig\^
                   3288: is
                   3289: .B 0
                   3290: or
                   3291: .SM
                   3292: .B EXIT
                   3293: and the
                   3294: .B trap
                   3295: statement is executed inside the body of a function,
                   3296: then the command
                   3297: .I arg\^
                   3298: is executed
                   3299: after the function completes.
                   3300: If
                   3301: .I sig\^
                   3302: is
                   3303: .B 0
                   3304: or
                   3305: .SM
                   3306: .B EXIT
                   3307: for a
                   3308: .B trap
                   3309: set outside any function
                   3310: then the command
                   3311: .I arg\^
                   3312: is executed
                   3313: on exit from the shell.
                   3314: The
                   3315: .B trap
                   3316: command
                   3317: with no arguments prints a list
                   3318: of commands associated with each signal number.
                   3319: .TP
                   3320: \f3typeset\fP \*(OK \f3\-FLRZefilprtux\^\fP\*(OK\f2n\fP \*(CK \*(OK \f2name\fP\*(OK \f2=value\^\fP \*(CK \^ \*(CK  .\|.\|. \*(CK
                   3321: Parameter assignments remain in effect after the command completes.
                   3322: When invoked inside a function,
                   3323: a new instance of the parameter
                   3324: .I name\^
                   3325: is created.
                   3326: The parameter value and type are restored
                   3327: when the function completes.
                   3328: The following list of attributes may be specified:
                   3329: .RS
                   3330: .PD 0
                   3331: .TP
                   3332: .B \-F
                   3333: This flag provides UNIX to host-name file mapping on non-UNIX
                   3334: machines.
                   3335: .TP
                   3336: .B \-L
                   3337: Left justify and remove leading blanks from
                   3338: .IR value .
                   3339: If
                   3340: .I n
                   3341: is non-zero it defines the width 
                   3342: of the field,
                   3343: otherwise it is determined by the width of the value of
                   3344: first assignment.
                   3345: When the parameter is assigned to, it is
                   3346: filled on the right with blanks or truncated, if necessary,  to
                   3347: fit into the field.
                   3348: Leading zeros are removed if the
                   3349: .B \-Z
                   3350: flag is also set.
                   3351: The
                   3352: .B \-R
                   3353: flag is turned off.
                   3354: .TP
                   3355: .B \-R
                   3356: Right justify and fill with leading blanks.
                   3357: If
                   3358: .I n
                   3359: is non-zero it defines the width 
                   3360: of the field,
                   3361: otherwise it is determined by the width of the value of
                   3362: first assignment.
                   3363: The field is left filled with blanks or
                   3364: truncated from the end if the
                   3365: parameter is reassigned.
                   3366: The
                   3367: .B L
                   3368: flag is turned off.
                   3369: .TP
                   3370: .B \-Z
                   3371: Right justify and fill with leading zeros if
                   3372: the first non-blank character is a digit and the
                   3373: .B \-L
                   3374: flag has not been set.
                   3375: If
                   3376: .I n
                   3377: is non-zero it defines the width 
                   3378: of the field,
                   3379: otherwise it is determined by the width of the value of
                   3380: first assignment.
                   3381: .TP
                   3382: .B \-e
                   3383: Tag the parameter as having an error.
                   3384: This tag is currently unused by the shell and can be
                   3385: set or cleared by the user.
                   3386: .TP
                   3387: .B \-f
                   3388: The names refer to function names rather than
                   3389: parameter names.
                   3390: No assignments can be made and the only other
                   3391: valid flag is
                   3392: .BR \-x .
                   3393: .TP
                   3394: .B \-i
                   3395: Parameter is an integer.
                   3396: This makes arithmetic faster.
                   3397: If
                   3398: .I n
                   3399: is non-zero it defines the output arithmetic base, 
                   3400: otherwise the first assignment determines the output base.
                   3401: .TP
                   3402: .B \-l
                   3403: All upper-case characters
                   3404: converted to lower-case.
                   3405: The upper-case flag,
                   3406: .B \-u
                   3407: is turned off.
                   3408: .TP
                   3409: .B \-p
                   3410: The output of this command, if any,  is written onto the two-way pipe
                   3411: .TP
                   3412: .B \-r
                   3413: The given
                   3414: .IR names
                   3415: are marked
                   3416: readonly and these
                   3417: names cannot be changed
                   3418: by subsequent assignment.
                   3419: .TP
                   3420: .B \-t
                   3421: Tags the named parameters.
                   3422: Tags are user definable and have no special
                   3423: meaning to the shell.
                   3424: .TP
                   3425: .B \-u
                   3426: All lower-case characters are converted
                   3427: to upper-case characters.
                   3428: The lower-case flag,
                   3429: .B \-l
                   3430: is turned off.
                   3431: .TP
                   3432: .B \-x
                   3433: The given
                   3434: .IR name s
                   3435: are marked for automatic
                   3436: export to the
                   3437: .I environment\^
                   3438: of subsequently-executed commands.
                   3439: .PD
                   3440: .PP
                   3441: Using
                   3442: .B \+
                   3443: rather than
                   3444: .B \-
                   3445: causes these flags to be turned off.
                   3446: If no
                   3447: .I name\^
                   3448: arguments are given but flags are specified,
                   3449: a list of
                   3450: .I names\^
                   3451: (and optionally the
                   3452: .I values\^
                   3453: )
                   3454: of the
                   3455: .I parameters\^
                   3456: which have these
                   3457: flags set
                   3458: is printed.
                   3459: (Using
                   3460: .B \+
                   3461: rather than
                   3462: .B \-
                   3463: keeps the
                   3464: values to be printed.)
                   3465: If no
                   3466: .IR name s
                   3467: and flags
                   3468: are given,
                   3469: the
                   3470: .I names\^
                   3471: and
                   3472: .I attributes\^
                   3473: of all
                   3474: .I parameters\^
                   3475: are printed.
                   3476: .RE
                   3477: .TP
                   3478: \f3ulimit\fP \*(OK \f3\-cdfmpt\fP \*(CK \*(OK \f2n\^\fP \*(CK
                   3479: .RS
                   3480: .PD 0
                   3481: .TP
                   3482: .B \-c
                   3483: imposes a size limit of 
                   3484: .I n\^
                   3485: blocks on the size of core dumps
                   3486: (\s-1BSD\s+1 only).
                   3487: .TP
                   3488: .B \-d
                   3489: imposes a size limit of 
                   3490: .I n\^
                   3491: blocks on the size of the data area
                   3492: (\s-1BSD\s+1 only).
                   3493: .TP
                   3494: .B \-f
                   3495: imposes a size limit of 
                   3496: .I n\^
                   3497: blocks on files written by child processes (files of any size may be read).
                   3498: .TP
                   3499: .B \-m
                   3500: imposes a soft limit of 
                   3501: .I n\^
                   3502: blocks on the size of physical memory
                   3503: (\s-1BSD\s+1 only).
                   3504: .TP
                   3505: .B \-p
                   3506: changes the pipe size to
                   3507: .I n\^
                   3508: (\s-1UNIX\s+1/\s-1RT\s+1 only).
                   3509: .TP
                   3510: .B \-t
                   3511: imposes a time limit of 
                   3512: .I n\^
                   3513: seconds to be used by each process
                   3514: (\s-1BSD\s+1 only).
                   3515: .PD
                   3516: .PP
                   3517: If no option is given,
                   3518: .B \-f
                   3519: is assumed.
                   3520: If
                   3521: .I n\^
                   3522: is not given the current limit is printed.
                   3523: .RE
                   3524: .TP
                   3525: \f3umask\fP \*(OK \f2nnn\^\fP \*(CK
                   3526: The user file-creation mask is set to
                   3527: .I nnn\^
                   3528: (see
                   3529: .IR umask (2)).
                   3530: If
                   3531: .I nnn\^
                   3532: is omitted, the current value of the mask is printed.
                   3533: .TP
                   3534: \f3unalias\fP \f2name\^\fP .\|.\|.
                   3535: The
                   3536: .IR
                   3537: parameters
                   3538: given by the list of
                   3539: .IR name s
                   3540: are removed from the
                   3541: .I alias\^
                   3542: list.
                   3543: .TP
                   3544: \f3unset\fP \*(OK \f3\-f\fP \*(CK \f2name\^\fP .\|.\|.
                   3545: The parameters given by the list of
                   3546: .IR name s
                   3547: are unassigned,
                   3548: i. e.,
                   3549: their values and attributes are erased.
                   3550: Readonly variables cannot be unset.
                   3551: If the flag,
                   3552: .BR \-f ,
                   3553: is set, then the names refer to
                   3554: .I function\^
                   3555: names.
                   3556: .TP
                   3557: \f3wait\fP \*(OK \f2n\^\fP \*(CK
                   3558: Wait for the specified process and
                   3559: report its termination status.
                   3560: If
                   3561: .I n\^
                   3562: is not given then all currently active child processes are waited for.
                   3563: The return code from this command is that of
                   3564: the process waited for.
                   3565: .TP
                   3566: \f3whence\fP \*(OK \f3\-v\fP \*(CK \f2name\^\fP .\|.\|.
                   3567: For each
                   3568: .IR name ,
                   3569: indicate how it
                   3570: would be interpreted if used as a command name.
                   3571: .P
                   3572: The flag,
                   3573: .BR \-v ,
                   3574: produces a more verbose report.
                   3575: .SS Invocation.
                   3576: If the shell is invoked by
                   3577: .IR exec (2),
                   3578: and the first character of argument zero
                   3579: .RB ( $0 )
                   3580: is
                   3581: .BR \- ,
                   3582: then the shell is assumed to be a
                   3583: .I login
                   3584: shell and
                   3585: commands are read from
                   3586: .B /etc/profile
                   3587: and then from either
                   3588: .B .profile
                   3589: in the current directory or
                   3590: .BR \s-1$HOME\s+1/.profile ,
                   3591: if either file exists.
                   3592: Next, commands are read from
                   3593: the file named by
                   3594: performing parameter substitution on
                   3595: the value of the environment parameter
                   3596: .SM
                   3597: .B ENV
                   3598: if the file exists.
                   3599: Commands are then read as described below;
                   3600: the following flags are interpreted by the shell
                   3601: when it is invoked:
                   3602: .PP
                   3603: .PD 0
                   3604: .TP 10
                   3605: .BI \-c "\| string\^"
                   3606: If the
                   3607: .B \-c
                   3608: flag is present then
                   3609: commands are read from
                   3610: .IR string .
                   3611: .TP
                   3612: .B \-s
                   3613: If the
                   3614: .B \-s
                   3615: flag is present or if no
                   3616: arguments remain
                   3617: then commands are read from the standard input.
                   3618: Shell output,
                   3619: except for the output of some of the 
                   3620: .I Special commands\^
                   3621: listed above,
                   3622: is written to
                   3623: file descriptor 2.
                   3624: .TP
                   3625: .B \-i
                   3626: If the
                   3627: .B \-i
                   3628: flag is present or
                   3629: if the shell input and output are attached to a terminal (as told by
                   3630: .IR gtty (2))
                   3631: then this shell is
                   3632: .IR interactive .
                   3633: In this case \s-1TERMINATE\s+1 is ignored (so that \f3kill 0\fP
                   3634: does not kill an interactive shell) and \s-1INTERRUPT\s+1 is caught and ignored
                   3635: (so that
                   3636: .B wait
                   3637: is interruptible).
                   3638: In all cases, \s-1QUIT\s+1 is ignored by the shell.
                   3639: .TP
                   3640: .B \-r
                   3641: If the
                   3642: .B \-r
                   3643: flag is present the shell is a restricted shell.
                   3644: .PD
                   3645: .PP
                   3646: The remaining flags and arguments are described under the
                   3647: .B set
                   3648: command above.
                   3649: .SS Rsh Only.
                   3650: .I Rsh
                   3651: is used to set up login names and execution environments whose
                   3652: capabilities are more controlled than those of the standard shell.
                   3653: The actions of
                   3654: .I rsh\^
                   3655: are identical to those of
                   3656: .IR sh ,
                   3657: except that the following are disallowed:
                   3658: .RS
                   3659: .PD 0
                   3660: .PP
                   3661: changing directory (see
                   3662: .IR cd (1)),
                   3663: .br
                   3664: setting the value of
                   3665: .SM
                   3666: .B SHELL
                   3667: or
                   3668: .SM
                   3669: .BR PATH\*S,
                   3670: .br
                   3671: specifying path or
                   3672: command names containing
                   3673: .BR / ,
                   3674: .br
                   3675: redirecting output
                   3676: .RB ( >
                   3677: and
                   3678: .BR >> ).
                   3679: .PD
                   3680: .RE
                   3681: .PP
                   3682: The restrictions above are enforced
                   3683: after \f3.profile\fP and the
                   3684: .SM
                   3685: .B ENV
                   3686: files are interpreted.
                   3687: .PP
                   3688: When a command to be executed is found to be a shell procedure,
                   3689: .I rsh\^
                   3690: invokes
                   3691: .I sh\^
                   3692: to execute it.
                   3693: Thus, it is possible to provide to the end-user shell procedures 
                   3694: that have access to the full power of
                   3695: the standard shell,
                   3696: while imposing a limited menu of commands;
                   3697: this scheme assumes that the end-user does not have write and
                   3698: execute permissions in the same directory.
                   3699: .PP
                   3700: The net effect of these rules is that the writer of the
                   3701: .B .profile
                   3702: has complete control over user actions,
                   3703: by performing guaranteed setup actions
                   3704: and leaving the user in an appropriate directory
                   3705: (probably
                   3706: .I not\^
                   3707: the login directory).
                   3708: .PP
                   3709: The system administrator often sets up a directory
                   3710: of commands
                   3711: (i.e.,
                   3712: .BR /usr/rbin )
                   3713: that can be safely invoked by
                   3714: .IR rsh .
                   3715: Some systems also provide a restricted editor
                   3716: .IR red .
                   3717: .SH EXIT STATUS
                   3718: Errors detected by the shell, such as syntax errors,
                   3719: cause the shell
                   3720: to return a non-zero exit status.
                   3721: If the shell is being used non-interactively
                   3722: then execution of the shell file is abandoned.
                   3723: Otherwise, the shell returns the exit status of
                   3724: the last command executed (see also the
                   3725: .B exit
                   3726: command above).
                   3727: .SH FILES
                   3728: /etc/passwd
                   3729: .br
                   3730: /etc/profile
                   3731: .br
                   3732: \s-1$HOME\s+1/\f3.\fPprofile
                   3733: .br
                   3734: /tmp/sh\(**
                   3735: .br
                   3736: /dev/null
                   3737: .SH SEE ALSO
                   3738: cat(1),
                   3739: cd(1),
                   3740: echo(1),
                   3741: emacs(1),
                   3742: env(1),
                   3743: gmacs(1),
                   3744: newgrp(1),
                   3745: test(1),
                   3746: umask(1),
                   3747: vi(1),
                   3748: dup(2),
                   3749: exec(2),
                   3750: fork(2),
                   3751: gtty(2),
                   3752: pipe(2),
                   3753: signal(2),
                   3754: umask(2),
                   3755: ulimit(2),
                   3756: wait(2),
                   3757: rand(3),
                   3758: a.out(5),
                   3759: profile(5),
                   3760: environ(7).
                   3761: .SH CAVEATS
                   3762: .PP
                   3763: If a command which is a
                   3764: .I "tracked alias"
                   3765: is executed, and then a command with the same name is 
                   3766: installed in a directory in the search path before the directory where the
                   3767: original command was found, the shell will continue to 
                   3768: .I exec\^
                   3769: the original command.
                   3770: Use the 
                   3771: .B \-t
                   3772: option of the
                   3773: .B alias\^
                   3774: command to correct this situation
                   3775: .PP
                   3776: If you move the current directory or one above it, 
                   3777: .B pwd\^
                   3778: may not give the correct response.
                   3779: Use the 
                   3780: .B cd\^
                   3781: command with a full path name
                   3782: to correct this situation.
                   3783: .PP
                   3784: Some very old shell scripts contain a
                   3785: .B ^
                   3786: as a synonym for the pipe character
                   3787: .BR \(bv .

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.