old-sh.html revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
2N/A<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2N/A<HTML>
2N/A<HEAD>
2N/A<META NAME="generator" CONTENT="troff2html (AT&T Labs Research) 04/01/97 -man">
2N/A<TITLE>sh.1 man document</TITLE>
2N/A<H3><TABLE WIDTH=100%><TR><TH ALIGN=LEFT>&nbsp;SH&nbsp;(&nbsp;1&nbsp;)&nbsp;<TH ALIGN=CENTER>USER COMMANDS<TH ALIGN=RIGHT>SH&nbsp;(&nbsp;1&nbsp;)</TABLE>
2N/A</H3> </HEAD>
2N/A<BODY>
2N/A<HR>
2N/A<DL COMPACT><FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="NAME">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>sh, rsh &#045; shell, the standard/restricted command and programming language
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="SYNOPSIS">SYNOPSIS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><STRONG>sh </STRONG>[ <STRONG>&#177;abcefhikmnoprstuvxCD </STRONG>] [ <STRONG>&#045;R </STRONG>file ] [ <STRONG>&#177;o </STRONG>option ] .&nbsp;.&nbsp;.
2N/A[ <STRONG>&#045; </STRONG>] [ arg .&nbsp;.&nbsp;.
2N/A] <STRONG><BR>
2N/Arsh </STRONG>[ <STRONG>&#177;abcefhikmnoprstuvxCD </STRONG>] [ <STRONG>&#045;R </STRONG>file ] [ <STRONG>&#177;o </STRONG>option ] .&nbsp;.&nbsp;.
2N/A[ <STRONG>&#045; </STRONG>] [ arg .&nbsp;.&nbsp;.
2N/A] <FONT SIZE=-1><STRONG>
2N/A<P>
2N/A<DT>
2N/A<H3><A NAME="DESCRIPTION">DESCRIPTION &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><EM>Sh </EM>is a command and programming language that executes commands read from
2N/Aa terminal or a file.
2N/A<EM>Rsh </EM>is a restricted version of the standard command interpreter <EM>sh</EM>; it
2N/Ais used to set up login names and execution environments whose capabilities
2N/Aare more controlled than those of the standard shell.
2N/ASee <EM>Invocation </EM>below for the meaning of arguments to the shell.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Definitions">Definitions.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>A <EM>metacharacter </EM>is one of the following characters: <DL COMPACT><STRONG><P>
2N/A; &amp; ( ) | &lt; &gt; new-line space tab</STRONG> </DL>
2N/A<P>
2N/AA <EM>blank </EM>is a <STRONG>tab </STRONG>or a <STRONG>space</STRONG>.
2N/AAn <EM>identifier </EM>is a sequence of letters, digits, or underscores starting
2N/Awith a letter or underscore.
2N/AIdentifiers are used as components of <EM>variable </EM>names.
2N/AA <EM>vname </EM>is a sequence of one or more identifiers separated by a <STRONG><FONT SIZE=+1>.</FONT></STRONG> and optionally
2N/Apreceded by a <STRONG><FONT SIZE=+1>.</FONT></STRONG>.
2N/AVnames are used as function and variable names.
2N/AA <EM>word </EM>is a sequence of <EM>characters </EM>from the character set defined by the
2N/Acurrent locale, excluding non-quoted <EM>metacharacters</EM>.
2N/A<P>
2N/AA <EM>command </EM>is a sequence of characters in the syntax of the shell language.
2N/AThe shell reads each command and carries out the desired action either
2N/Adirectly or by invoking separate utilities.
2N/AA built-in command is a command that is carried out by the shell itself
2N/Awithout creating a separate process.
2N/ASome commands are built-in purely for convenience and are not documented
2N/Ahere.
2N/ABuilt-ins that cause side effects in the shell environment and built-ins
2N/Athat are found before performing a path search (see <A HREF="#Execution"><EM>Execution </EM></A>below) are
2N/Adocumented here.
2N/AFor historical reasons, some of these built-ins behave differently than
2N/Aother built-ins and are called <EM>special built-ins</EM>.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Commands">Commands.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>A <EM>simple-command </EM>is a list of variable assignments (see <A HREF="#Variable Assignments"><EM>Variable Assignments
2N/A</EM></A>below) or a sequence of <EM>blank </EM>separated words which may be preceded by
2N/Aa list of variable assignments (see <A HREF="#Environment"><EM>Environment </EM></A>below).
2N/AThe first word specifies the name of the command to be executed.
2N/AExcept as specified below, the remaining words are passed as arguments
2N/Ato the invoked command.
2N/AThe command name is passed as argument 0 (see <A HREF="exec(2)"><EM>exec</EM>(2)</A>).
2N/AThe <EM>value </EM>of a simple-command is its exit status; 0-255 if it terminates
2N/Anormally; 256+<EM>signum&nbsp;</EM> if it terminates abnormally (the name of the signal
2N/Acorresponding to the exit status can be obtained via the <STRONG>&#045;l </STRONG>option of the
2N/A<STRONG>kill </STRONG>built-in utility).
2N/A<P>
2N/AA <EM>pipeline </EM>is a sequence of one or more <EM>commands </EM>separated by <STRONG>|</STRONG>.
2N/AThe standard output of each command but the last is connected by a <EM>pipe</EM>(2)
2N/Ato the standard input of the next command.
2N/AEach command, except possibly the last, is run as a separate process; the
2N/Ashell waits for the last command to terminate.
2N/AThe exit status of a pipeline is the exit status of the last command.
2N/AEach pipeline can be preceded by the <EM>reserved word </EM><STRONG>! </STRONG>which causes the exit
2N/Astatus of the pipeline to become 0 if the exit status of the last command
2N/Ais non-zero, and 1 if the exit status of the last command is 0.
2N/A<P>
2N/AA <EM>list </EM>is a sequence of one or more pipelines separated by <STRONG>;</STRONG>, <STRONG>&amp;</STRONG>, <STRONG>|&amp;</STRONG>, <STRONG>&amp;&amp;</STRONG>,
2N/Aor <STRONG>|&nbsp;|</STRONG>, and optionally terminated by <STRONG>;</STRONG>, <STRONG>&amp;</STRONG>, or <STRONG>|&amp;</STRONG>.
2N/AOf these five symbols, <STRONG>;</STRONG>, <STRONG>&amp;</STRONG>, and <STRONG>|&amp; </STRONG>have equal precedence, which is lower
2N/Athan that of <STRONG>&amp;&amp; </STRONG>and <STRONG>|&nbsp;|</STRONG>.
2N/AThe symbols <STRONG>&amp;&amp; </STRONG>and <STRONG>|&nbsp;| </STRONG>also have equal precedence.
2N/AA semicolon (<STRONG>;</STRONG>) causes sequential execution of the preceding pipeline;
2N/Aan ampersand (<STRONG>&amp;</STRONG>) causes asynchronous execution of the preceding pipeline
2N/A(i.e., the shell does <EM>not </EM>wait for that pipeline to finish).
2N/AThe symbol <STRONG>|&amp; </STRONG>causes asynchronous execution of the preceding pipeline with
2N/Aa two-way pipe established to the parent shell; the standard input and
2N/Aoutput of the spawned pipeline can be written to and read from by the parent
2N/Ashell by applying the redirection operators <STRONG>&lt;&amp; </STRONG>and <STRONG>&gt;&amp; </STRONG>with arg <STRONG>p </STRONG>to commands
2N/Aand by using <STRONG>&#045;p </STRONG>option of the built-in commands <STRONG>read </STRONG>and <STRONG>print </STRONG>described
2N/Alater.
2N/AThe symbol <STRONG>&amp;&amp; </STRONG>(&nbsp;<STRONG>|&nbsp;|</STRONG>&nbsp;) causes the <EM>list </EM>following it to be executed only
2N/Aif the preceding pipeline returns a zero (non-zero) value.
2N/AOne or more new-lines may appear in a <EM>list </EM>instead of a semicolon, to delimit
2N/Aa command.
2N/A<P>
2N/AA <EM>command </EM>is either a simple-command or one of the following.
2N/AUnless otherwise stated, the value returned by a command is that of the
2N/Alast simple-command executed in the command.
2N/A<DL COMPACT><STRONG><P>
2N/A<DT>
2N/Afor</STRONG> <EM>vname&nbsp;</EM> [&nbsp; <STRONG>in</STRONG> <EM>word&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;] <STRONG>;do</STRONG><EM>list&nbsp;</EM><STRONG>;done</STRONG>
2N/A<DD>Each time a <STRONG>for </STRONG>command is executed, <EM>vname </EM>is set to the next <EM>word </EM>taken
2N/Afrom the <STRONG>in </STRONG><EM>word </EM>list.
2N/AIf <STRONG>in</STRONG><EM> word&nbsp; </EM>.&nbsp;.&nbsp;.
2N/Ais omitted, then the <STRONG>for </STRONG>command executes the <STRONG>do</STRONG> <EM>list&nbsp;</EM> once for each positional
2N/Aparameter that is set starting from <STRONG>1 </STRONG>(see <A HREF="#Parameter Expansion"><EM>Parameter Expansion </EM></A>below).
2N/AExecution ends when there are no more words in the list.
2N/A<STRONG><P>
2N/A<DT>
2N/Afor ((</STRONG> [&nbsp;<EM>expr1&nbsp;</EM>&nbsp;] <STRONG>;</STRONG> [&nbsp;<EM>expr2&nbsp;</EM>&nbsp;] <STRONG>;</STRONG> [&nbsp;<EM>expr3&nbsp;</EM>&nbsp;] <STRONG>))</STRONG><STRONG>;do</STRONG><EM>list&nbsp;</EM><STRONG>;done</STRONG>
2N/A<DD>The arithmetic expression <EM>expr1 </EM>is evaluated first (see <A HREF="#Arithmetic Evaluation"><EM>Arithmetic Evaluation
2N/A</EM></A>below).
2N/AThe arithmetic expression <EM>expr2 </EM>is repeatedly evaluated until it evaluates
2N/Ato zero and when non-zero, <EM>list </EM>is executed and the arithmetic expression
2N/A<EM>expr3 </EM>evaluated.
2N/AIf any expression is omitted, then it behaves as if it evaluated to 1.
2N/A<STRONG><P>
2N/A<DT>
2N/Aselect</STRONG> <EM>vname&nbsp;</EM> [&nbsp; <STRONG>in</STRONG> <EM>word&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;] <STRONG>;do</STRONG><EM>list&nbsp;</EM><STRONG>;done</STRONG>
2N/A<DD>A <STRONG>select </STRONG>command prints on standard error (file descriptor 2) the set of
2N/A<EM>word</EM>s, each preceded by a number.
2N/AIf <STRONG>in</STRONG><EM> word&nbsp; </EM>.&nbsp;.&nbsp;.
2N/Ais omitted, then the positional parameters starting from <STRONG>1 </STRONG>are used instead
2N/A(see <A HREF="#Parameter Expansion"><EM>Parameter Expansion </EM></A>below).
2N/AThe <FONT SIZE=-1><STRONG>PS3 </STRONG></FONT>prompt is printed and a line is read from the standard input.
2N/AIf this line consists of the number of one of the listed <EM>word</EM>s, then the
2N/Avalue of the variable <EM>vname </EM>is set to the <EM>word </EM>corresponding to this number.
2N/AIf this line is empty, the selection list is printed again.
2N/AOtherwise the value of the variable <EM>vname </EM>is set to <EM>null</EM>.
2N/AThe contents of the line read from standard input is saved in the variable
2N/A<FONT SIZE=-1><STRONG>REPLY</STRONG>.
2N/A</FONT>The <EM>list </EM>is executed for each selection until a <STRONG>break </STRONG>or <EM>end-of-file </EM>is
2N/Aencountered.
2N/AIf the <FONT SIZE=-1><STRONG>REPLY </STRONG></FONT>variable is set to <EM>null </EM>by the execution of <EM>list</EM>, then the
2N/Aselection list is printed before displaying the <FONT SIZE=-1><STRONG>PS3 </STRONG></FONT>prompt for the next
2N/Aselection.
2N/A<STRONG><P>
2N/A<DT>
2N/Acase</STRONG> <EM>word&nbsp;</EM> <STRONG>in</STRONG> [&nbsp; [&nbsp;<STRONG>(</STRONG>&nbsp;]<EM>pattern&nbsp;</EM> [&nbsp; | <EM>pattern&nbsp;</EM>&nbsp;].&nbsp;.&nbsp;.<STRONG>)</STRONG><EM>list&nbsp;</EM><STRONG>;;</STRONG>&nbsp;].&nbsp;.&nbsp;.<STRONG>esac</STRONG>
2N/A<DD>A <STRONG>case </STRONG>command executes the <EM>list </EM>associated with the first <EM>pattern </EM>that
2N/Amatches <EM>word</EM>.
2N/AThe form of the patterns is the same as that used for file-name generation
2N/A(see <A HREF="#File Name Generation"><EM>File Name Generation </EM></A>below).
2N/AThe <STRONG>;; </STRONG>operator causes execution of <STRONG>case </STRONG>to terminate.
2N/AIf <STRONG>;&amp; </STRONG>is used in place of <STRONG>;; </STRONG>the next subsequent list, if any, is executed.
2N/A<STRONG><P>
2N/A<DT>
2N/Aif</STRONG> <EM>list&nbsp;</EM> <STRONG>;then</STRONG> <EM>list&nbsp;</EM> [&nbsp; <STRONG>elif</STRONG> <EM>list&nbsp;</EM> <STRONG>;then</STRONG><EM>list&nbsp;</EM>&nbsp;].&nbsp;.&nbsp;.[&nbsp;<STRONG>;else</STRONG><EM>list&nbsp;</EM>&nbsp;]<STRONG>;fi</STRONG>
2N/A<DD>The <EM>list </EM>following <STRONG>if</STRONG> is executed and, if it returns a zero exit status,
2N/Athe <EM>list </EM>following the first <STRONG>then </STRONG>is executed.
2N/AOtherwise, the <EM>list </EM>following <STRONG>elif</STRONG> is executed and, if its value is zero,
2N/Athe <EM>list </EM>following the next <STRONG>then </STRONG>is executed.
2N/AFailing each successive <STRONG>elif </STRONG><EM>list&nbsp;</EM>, the <STRONG>else </STRONG><EM>list </EM>is executed.
2N/AIf the <STRONG>if </STRONG><EM>list </EM>has non-zero exit status and there is no <STRONG>else </STRONG><EM>list</EM>, then
2N/Athe <STRONG>if </STRONG>command returns a zero exit status.
2N/A<STRONG><P>
2N/A<DT>
2N/Awhile</STRONG> <EM>list&nbsp;</EM> <STRONG>;do</STRONG> <EM>list&nbsp;</EM> <STRONG>;done</STRONG>
2N/A<DD><STRONG><DT>
2N/Auntil</STRONG> <EM>list&nbsp;</EM> <STRONG>;do</STRONG> <EM>list&nbsp;</EM> <STRONG>;done</STRONG>
2N/A<DD>A <STRONG>while </STRONG>command repeatedly executes the <STRONG>while </STRONG><EM>list </EM>and, if the exit status
2N/Aof the last command in the list is zero, executes the <STRONG>do </STRONG><EM>list</EM>; otherwise
2N/Athe loop terminates.
2N/AIf no commands in the <STRONG>do </STRONG><EM>list </EM>are executed, then the <STRONG>while </STRONG>command returns
2N/Aa zero exit status; <STRONG>until </STRONG>may be used in place of <STRONG>while </STRONG>to negate the loop
2N/Atermination test.
2N/A<STRONG><P>
2N/A<DT>
2N/A((</STRONG><EM>expression&nbsp;</EM><STRONG>))</STRONG>
2N/A<DD>The <EM>expression </EM>is evaluated using the rules for arithmetic evaluation described
2N/Abelow.
2N/AIf the value of the arithmetic expression is non-zero, the exit status
2N/Ais 0, otherwise the exit status is 1.
2N/A<STRONG><P>
2N/A<DT>
2N/A(</STRONG><EM>list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Execute <EM>list </EM>in a separate environment.
2N/ANote, that if two adjacent open parentheses are needed for nesting, a space
2N/Amust be inserted to avoid evaluation as an arithmetic command as described
2N/Aabove.
2N/A<STRONG><P>
2N/A<DT>
2N/A{ </STRONG><EM>list&nbsp;</EM><STRONG>;}</STRONG>
2N/A<DD><EM>list </EM>is simply executed.
2N/ANote that unlike the metacharacters <STRONG>( </STRONG>and <STRONG>)</STRONG>, <STRONG>{ </STRONG>and <STRONG>} </STRONG>are <EM>reserved word</EM>s
2N/Aand must occur at the beginning of a line or after a <STRONG>; </STRONG>in order to be recognized.
2N/A<STRONG><P>
2N/A<DT>
2N/A[[</STRONG><EM> expression &nbsp;</EM><STRONG>]]</STRONG>
2N/A<DD>Evaluates <EM>expression </EM>and returns a zero exit status when <EM>expression </EM>is
2N/Atrue.
2N/ASee <EM>Conditional Expressions </EM>below, for a description of <EM>expression</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Afunction</STRONG> <EM>varname&nbsp;</EM> <STRONG>{</STRONG> <EM>list&nbsp;</EM> <STRONG>;}</STRONG>
2N/A<DD><EM><DT>
2N/Avarname&nbsp;</EM> <STRONG>() {</STRONG> <EM>list&nbsp;</EM> <STRONG>;}</STRONG>
2N/A<DD>Define a function which is referenced by <EM>varname</EM>.
2N/AA function whose <EM>varname </EM>contains a <STRONG><FONT SIZE=+1>.</FONT> </STRONG>is called a discipline function and
2N/Athe portion of the <EM>varname </EM>preceding the last <STRONG><FONT SIZE=+1>.</FONT> </STRONG>must refer to an existing
2N/Avariable.
2N/AThe body of the function is the <EM>list </EM>of commands between <STRONG>{ </STRONG>and <STRONG>}</STRONG>.
2N/AA function defined with the <STRONG>function</STRONG> <EM>varname&nbsp;</EM> syntax can also be used as
2N/Aan argument to the <STRONG>.</STRONG> special built-in command to get the equivalent behavior
2N/Aas if the <EM>varname&nbsp;</EM><STRONG>()</STRONG> syntax were used to define it.
2N/A(See <EM>Functions </EM>below.) <STRONG>
2N/A<P>
2N/A<DT>
2N/Atime</STRONG> [&nbsp; <EM>pipeline&nbsp;</EM> &nbsp;]
2N/A<DD>If <EM>pipeline&nbsp;</EM> is omitted the user and system time for the current shell
2N/Aand completed child processes is printed on standard error.
2N/AOtherwise, <EM>pipeline </EM>is executed and the elapsed time as well as the user
2N/Aand system time are printed on standard error.
2N/A</DL><P>
2N/AThe following reserved words are recognized as reserved only when they
2N/Aare the first word of a command and are not quoted: <DL COMPACT><STRONG><P>
2N/Aif then else elif fi case esac for while until do done { } function select
2N/Atime [[ ]] ! </STRONG></DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Variable Assignments">Variable &nbsp;Assignments.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>One or more variable assignments can start a simple command or can be arguments
2N/Ato the <STRONG>typeset</STRONG>, <STRONG>export</STRONG>, or <STRONG>readonly </STRONG>special built-in commands.
2N/AThe syntax for an <EM>assignment&nbsp;</EM> is of the form: <DL COMPACT><EM>
2N/A<P>
2N/A<DT>
2N/Avarname&nbsp;</EM><STRONG>=</STRONG><EM>word&nbsp;</EM>
2N/A<DD><EM><DT>
2N/Avarname&nbsp;</EM><STRONG>[</STRONG><EM>word&nbsp;</EM><STRONG>]</STRONG>=<STRONG></STRONG><EM>word&nbsp;</EM><STRONG>
2N/A<DD></STRONG>No space is permitted between <EM>varname&nbsp;</EM> and the <STRONG>=</STRONG> or between <STRONG>=</STRONG> and <EM>word&nbsp;</EM>.
2N/A<EM><P>
2N/A<DT>
2N/Avarname&nbsp;</EM><STRONG>=(</STRONG><EM>assign_list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>No space is permitted between <EM>varname&nbsp;</EM> and the <STRONG>=</STRONG>.
2N/AAn <EM>assign_list&nbsp;</EM> can be one of the following: <DL COMPACT><DL COMPACT><EM>
2N/A<DT>
2N/Aword&nbsp;</EM> ...
2N/A<DD>Indexed array assignment.
2N/A<STRONG><DT>
2N/A[</STRONG><EM>word&nbsp;</EM><STRONG>]=</STRONG><EM>word&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>Associative array assignment.
2N/A<EM><DT>
2N/Aassignment&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>Nested variable assignment.
2N/A<STRONG><DT>
2N/Atypeset</STRONG> [&nbsp;<EM>options</EM>&nbsp;] <EM>assignment&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>Nested variable assignment.
2N/AMultiple assignments can be specified by separating each of them with a
2N/A<STRONG>;</STRONG>.
2N/A</DL>
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Comments">Comments.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>A word beginning with <STRONG># </STRONG>causes that word and all the following characters
2N/Aup to a new-line to be ignored.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Aliasing">Aliasing.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The first word of each command is replaced by the text of an <STRONG>alias </STRONG>if an
2N/A<STRONG>alias </STRONG>for this word has been defined.
2N/AAn <STRONG>alias </STRONG>name consists of any number of characters excluding metacharacters,
2N/Aquoting characters, file expansion characters, parameter expansion and
2N/Acommand substitution characters, and <STRONG>=</STRONG>.
2N/AThe replacement string can contain any valid shell script including the
2N/Ametacharacters listed above.
2N/AThe first word of each command in the replaced text, other than any that
2N/Aare in the process of being replaced, will be tested for aliases.
2N/AIf the last character of the alias value is a <EM>blank </EM>then the word following
2N/Athe alias will also be checked for alias substitution.
2N/AAliases can be used to redefine built-in commands but cannot be used to
2N/Aredefine the reserved words listed above.
2N/AAliases can be created and listed with the <STRONG>alias </STRONG>command and can be removed
2N/Awith the <STRONG>unalias </STRONG>command.
2N/A<EM><P>
2N/AAliasing </EM>is performed when scripts are read, not while they are executed.
2N/ATherefore, for an alias to take effect, the <STRONG>alias </STRONG>definition command has
2N/Ato be executed before the command which references the alias is read.
2N/A<P>
2N/AThe following aliases are compiled into the shell but can be unset or redefined:
2N/A<DL COMPACT><DL COMPACT><STRONG><DT>
2N/Aautoload='typeset &#045;fu' </STRONG>
2N/A<DD><STRONG><DT>
2N/Acommand='command ' </STRONG>
2N/A<DD><STRONG><DT>
2N/Afc=hist </STRONG>
2N/A<DD><STRONG><DT>
2N/Afloat='typeset &#045;E' </STRONG>
2N/A<DD><STRONG><DT>
2N/Afunctions='typeset &#045;f' </STRONG>
2N/A<DD><STRONG><DT>
2N/Ahash='alias &#045;t &#045;&nbsp;&#045;' </STRONG>
2N/A<DD><STRONG><DT>
2N/Ahistory='hist &#045;l' </STRONG>
2N/A<DD><STRONG><DT>
2N/Ainteger='typeset &#045;i' </STRONG>
2N/A<DD><STRONG><DT>
2N/Anameref='typeset &#045;n' </STRONG>
2N/A<DD><STRONG><DT>
2N/Anohup='nohup ' </STRONG>
2N/A<DD><STRONG><DT>
2N/Ar='hist &#045;s' </STRONG>
2N/A<DD><STRONG><DT>
2N/Aredirect='command exec' </STRONG>
2N/A<DD><STRONG><DT>
2N/Astop='kill &#045;s <FONT SIZE=-1>STOP</FONT>' </STRONG>
2N/A<DD><STRONG><DT>
2N/Asuspend='kill &#045;s <FONT SIZE=-1>STOP</FONT> $$' </STRONG>
2N/A<DD><STRONG><DT>
2N/Atimes='{ { time;} 2&gt;&amp;1;}' </STRONG>
2N/A<DD><STRONG><DT>
2N/Atype='whence &#045;v' </STRONG>
2N/A<DD></DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Tilde Substitution">Tilde &nbsp;Substitution.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>After alias substitution is performed, each word is checked to see if it
2N/Abegins with an unquoted <STRONG>~</STRONG>.
2N/AFor tilde substitution, <EM>word </EM>also refers to the <EM>word </EM>portion of parameter
2N/Aexpansion (see <A HREF="#Parameter Expansion"><EM>Parameter Expansion </EM></A>below).
2N/AIf it does, then the word up to a <STRONG>/ </STRONG>is checked to see if it matches a user
2N/Aname in the password database (often the <STRONG>/etc/passwd </STRONG>file).
2N/AIf a match is found, the <STRONG>~ </STRONG>and the matched login name are replaced by the
2N/Alogin directory of the matched user.
2N/AIf no match is found, the original text is left unchanged.
2N/AA <STRONG>~ </STRONG>by itself, or in front of a <STRONG>/</STRONG>, is replaced by <FONT SIZE=-1><STRONG>$HOME</STRONG>.
2N/A</FONT>A <STRONG>~ </STRONG>followed by a <STRONG>+ </STRONG>or <STRONG>&#045; </STRONG>is replaced by the value of <STRONG><FONT SIZE=-1>$PWD </FONT></STRONG>and <STRONG><FONT SIZE=-1>$OLDPWD </FONT></STRONG>respectively.
2N/A<P>
2N/AIn addition, when expanding a <EM>variable assignment</EM>, <EM>tilde </EM>substitution is
2N/Aattempted when the value of the assignment begins with a <STRONG>~</STRONG>, and when a
2N/A<STRONG>~ </STRONG>appears after a <STRONG>:</STRONG>.
2N/AThe <STRONG>: </STRONG>also terminates a <STRONG>~ </STRONG>login name.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Command Substitution">Command &nbsp;Substitution.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The standard output from a command enclosed in parentheses preceded by
2N/Aa dollar sign ( <STRONG>$(&nbsp;) </STRONG>) or a pair of grave accents (&nbsp;<STRONG><FONT SIZE=+1><SUB>`</SUB></FONT>&nbsp;<FONT SIZE=+1><SUB>`</SUB></FONT></STRONG>&nbsp;) may be used as
2N/Apart or all of a word; trailing new-lines are removed.
2N/AIn the second (obsolete) form, the string between the quotes is processed
2N/Afor special quoting characters before the command is executed (see <A HREF="#Quoting"><EM>Quoting
2N/A</EM></A>below).
2N/AThe command substitution &nbsp;<STRONG>$(&nbsp;cat file&nbsp;)</STRONG>&nbsp; can be replaced by the equivalent
2N/Abut faster &nbsp;<STRONG>$(&nbsp;&lt;file&nbsp;)</STRONG>&nbsp;.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Arithmetic Substitution">Arithmetic &nbsp;Substitution.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>An arithmetic expression enclosed in double parentheses preceded by a dollar
2N/Asign ( <STRONG>$((&nbsp;)) </STRONG>) is replaced by the value of the arithmetic expression within
2N/Athe double parentheses.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Process Substitution">Process &nbsp;Substitution.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>This feature is only available on versions of the UNIX operating system
2N/Athat support the <STRONG>/dev/fd </STRONG>directory for naming open files.
2N/AEach command argument of the form <STRONG>&lt;(</STRONG><EM>list&nbsp;</EM><STRONG>)</STRONG> or <STRONG>&gt;(</STRONG><EM>list&nbsp;</EM><STRONG>)</STRONG> will run process
2N/A<EM>list </EM>asynchronously connected to some file in <STRONG>/dev/fd</STRONG>.
2N/AThe name of this file will become the argument to the command.
2N/AIf the form with <STRONG>&gt; </STRONG>is selected then writing on this file will provide input
2N/Afor <EM>list</EM>.
2N/AIf <STRONG>&lt; </STRONG>is used, then the file passed as an argument will contain the output
2N/Aof the <EM>list </EM>process.
2N/AFor example, <DL COMPACT><STRONG><P>
2N/Apaste &lt;(cut &#045;f1</STRONG> <EM>file1</EM><STRONG>) &lt;(cut &#045;f3</STRONG> <EM>file2</EM><STRONG>) | tee &gt;(</STRONG><EM>process1</EM><STRONG>) &gt;(</STRONG><EM>process2</EM><STRONG>)</STRONG><EM> </EM><EM><P>
2N/Acuts </EM></DL>
2N/Afields 1 and 3 from the files <EM>file1 </EM>and <EM>file2 </EM>respectively, <EM>pastes </EM>the
2N/Aresults together, and sends it to the processes <EM>process1 </EM>and <EM>process2</EM>,
2N/Aas well as putting it onto the standard output.
2N/ANote that the file, which is passed as an argument to the command, is a
2N/AUNIX <EM>pipe</EM>(2) so programs that expect to <EM>lseek</EM>(2) on the file will not work.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Parameter Expansion">Parameter &nbsp;Expansion.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>A <EM>parameter </EM>is a <EM>variable</EM>, one or more digits, or any of the characters
2N/A<STRONG>*</STRONG>, <STRONG>@</STRONG>, <STRONG>#</STRONG>, <STRONG>?</STRONG>, <STRONG>&#045;</STRONG>, <STRONG>$</STRONG>, and <STRONG>!&nbsp;</STRONG>.
2N/AA <EM>variable </EM>is denoted by a <EM>vname</EM>.
2N/ATo create a variable whose <EM>vname </EM>contains a <STRONG><FONT SIZE=+1>.</FONT></STRONG>, a variable whose <EM>vname </EM>consists
2N/Aof everything before the last <STRONG><FONT SIZE=+1>.</FONT></STRONG> must already exist.
2N/AA <EM>variable </EM>has a <EM>value </EM>and zero or more <EM>attributes</EM>.
2N/A<EM>Variables </EM>can be assigned <EM>values </EM>and <EM>attributes </EM>by using the <STRONG>typeset </STRONG>special
2N/Abuilt-in command.
2N/AThe attributes supported by the shell are described later with the <STRONG>typeset
2N/A</STRONG>special built-in command.
2N/AExported variables pass values and attributes to the environment.
2N/A<P>
2N/AThe shell supports both indexed and associative arrays.
2N/AAn element of an array variable is referenced by a <EM>subscript</EM>.
2N/AA <EM>subscript </EM>for an indexed array is denoted by an <EM>arithmetic expression
2N/A</EM>(see <A HREF="#Arithmetic Evaluation"><EM>Arithmetic Evaluation </EM></A>below) between a <STRONG>[ </STRONG>and a <STRONG>]</STRONG>.
2N/ATo assign values to an indexed array, use <STRONG>set &#045;A</STRONG> <EM>vname</EM> <EM>value</EM> .&nbsp;.&nbsp;.
2N/A.
2N/AThe value of all subscripts must be in the range of 0 through 4095.
2N/AIndexed arrays need not be declared.
2N/AAny reference to a variable with a valid subscript is legal and an array
2N/Awill be created if necessary.
2N/A<P>
2N/AAn associative array is created with the <STRONG>&#045;A </STRONG>option to <STRONG>typeset.
2N/A</STRONG>A <EM>subscript </EM>for an associative array is denoted by a string enclosed between
2N/A<STRONG>[ </STRONG>and <STRONG>]</STRONG>.
2N/A<P>
2N/AReferencing any array without a subscript is equivalent to referencing
2N/Athe array with subscript 0.
2N/A<P>
2N/AThe <EM>value </EM>of a <EM>variable </EM>may be assigned by writing: <DL COMPACT><EM><P>
2N/Avname</EM><STRONG>=</STRONG><EM>value&nbsp;&nbsp; </EM>[&nbsp; <EM>vname</EM><STRONG>=</STRONG><EM>value </EM>&nbsp;] .&nbsp;.&nbsp;.
2N/A</DL>
2N/A<P>
2N/Aor <DL COMPACT><EM><BR>
2N/Avname</EM><STRONG>[</STRONG><EM>subscript</EM><STRONG>]=</STRONG><EM>value&nbsp;&nbsp; </EM>[&nbsp; <EM>vname</EM><STRONG>[</STRONG><EM>subscript</EM><STRONG>]=</STRONG><EM>value </EM>&nbsp;] .&nbsp;.&nbsp;.
2N/A</DL>
2N/A<P>
2N/ANote that no space is allowed before or after the <STRONG>=</STRONG>.
2N/A<P>
2N/AA <EM>nameref </EM>is a variable that is a reference to another variable.
2N/AA nameref is created with the <STRONG>&#045;n </STRONG>attribute of <STRONG>typeset</STRONG>.
2N/AThe value of the variable at the time of the <STRONG>typeset </STRONG>command becomes the
2N/Avariable that will be referenced whenever the nameref variable is used.
2N/AThe name of a nameref cannot contain a <STRONG><FONT SIZE=+1>.</FONT></STRONG>.
2N/AWhen a variable or function name contains a <STRONG><FONT SIZE=+1>.</FONT></STRONG>, and the portion of the name
2N/Aup to the first <STRONG><FONT SIZE=+1>.</FONT></STRONG> matches the name of a nameref, the variable referred
2N/Ato is obtained by replacing the nameref portion with the name of the variable
2N/Areferenced by the nameref.
2N/AA nameref provides a convenient way to refer to the variable inside a function
2N/Awhose name is passed as an argument to a function.
2N/AFor example, if the name of a variable is passed as the first argument
2N/Ato a function, the command <DL COMPACT><STRONG><BR>
2N/Atypeset &#045;n var=$1</STRONG> </DL>
2N/A<BR>
2N/Ainside the function causes references and assignments to <STRONG>var </STRONG>to be references
2N/Aand assignments to the variable whose name has been passed to the function.
2N/A<P>
2N/AIf either of the floating point attributes, <STRONG>&#045;E</STRONG>, or <STRONG>&#045;F</STRONG>, or the integer attribute,
2N/A<STRONG>&#045;i</STRONG>, is set for <EM>vname</EM>, then the <EM>value </EM>is subject to arithmetic evaluation
2N/Aas described below.
2N/A<P>
2N/APositional parameters, parameters denoted by a number, may be assigned
2N/Avalues with the <STRONG>set </STRONG>special built-in command.
2N/AParameter <STRONG>$0 </STRONG>is set from argument zero when the shell is invoked.
2N/A<P>
2N/AThe character <STRONG>$ </STRONG>is used to introduce substitutable <EM>parameters</EM>.
2N/A<DL COMPACT><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>The shell reads all the characters from <STRONG>${ </STRONG>to the matching <STRONG>} </STRONG>as part of
2N/Athe same word even if it contains braces or metacharacters.
2N/AThe value, if any, of the parameter is substituted.
2N/AThe braces are required when <EM>parameter </EM>is followed by a letter, digit,
2N/Aor underscore that is not to be interpreted as part of its name, when the
2N/Avariable name contains a <STRONG><FONT SIZE=+1>.</FONT></STRONG>, or when a variable is subscripted.
2N/AIf <EM>parameter </EM>is one or more digits then it is a positional parameter.
2N/AA positional parameter of more than one digit must be enclosed in braces.
2N/AIf <EM>parameter </EM>is <STRONG>* </STRONG>or <STRONG>@</STRONG>, then all the positional parameters, starting with
2N/A<STRONG>$1</STRONG>, are substituted (separated by a field separator character).
2N/AIf an array <EM>vname </EM>with subscript <STRONG>* </STRONG>or <STRONG>@ </STRONG>is used, then the value for each
2N/Aof the elements is substituted, separated by the first character of the
2N/Avalue of <FONT SIZE=-1><STRONG>IFS</STRONG>.
2N/A</FONT><STRONG><DT>
2N/A${#</STRONG><EM>parameter&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If <EM>parameter </EM>is <STRONG>* </STRONG>or <STRONG>@</STRONG>, the number of positional parameters is substituted.
2N/AOtherwise, the length of the value of the <EM>parameter </EM>is substituted.
2N/A<STRONG><DT>
2N/A${#</STRONG><EM>vname</EM><STRONG>[*]}</STRONG>
2N/A<DD><STRONG><DT>
2N/A${#</STRONG><EM>vname</EM><STRONG>[@]}</STRONG>
2N/A<DD>The number of elements in the array <EM>vname </EM>is substituted.
2N/A<STRONG><P>
2N/A<DT>
2N/A${!</STRONG><EM>vname&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>Expands to the name of the variable referred to by <EM>vname</EM>.
2N/AThis will be <EM>vname </EM>except when <EM>vname </EM>is a name reference.
2N/A<STRONG><P>
2N/A<DT>
2N/A${!</STRONG><EM>vname&nbsp;</EM><STRONG>[</STRONG><EM>subscript&nbsp;</EM><STRONG>]}</STRONG><EM>
2N/A<DD></EM>Expands to name of the subscript unless <EM>subscript </EM>is <STRONG>* </STRONG>or <STRONG>@</STRONG>.
2N/AWhen <EM>subscript </EM>is <STRONG>*</STRONG>, the list of array subscripts for <EM>vname&nbsp;</EM> is generated.
2N/AFor a variable that is not an array, the value is 0 if the variable is
2N/Aset.
2N/AOtherwise it is null.
2N/AWhen <EM>subscript </EM>is <STRONG>@</STRONG>, same as above, except that when used in double quotes,
2N/Aeach array subscript yields a separate argument.
2N/A<STRONG><P>
2N/A<DT>
2N/A${!</STRONG><EM>prefix&nbsp;</EM><STRONG>*}</STRONG>
2N/A<DD>Expands to the names of the variables whose names begin with <EM>prefix</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:&#045;</STRONG><EM>word&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If <EM>parameter </EM>is set and is non-null then substitute its value; otherwise
2N/Asubstitute <EM>word</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:=</STRONG><EM>word&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If <EM>parameter </EM>is not set or is null then set it to <EM>word</EM>; the value of the
2N/Aparameter is then substituted.
2N/APositional parameters may not be assigned to in this way.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:?</STRONG><EM>word&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If <EM>parameter </EM>is set and is non-null then substitute its value; otherwise,
2N/Aprint <EM>word </EM>and exit from the shell (if not interactive).
2N/AIf <EM>word </EM>is omitted then a standard message is printed.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:+</STRONG><EM>word&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If <EM>parameter </EM>is set and is non-null then substitute <EM>word</EM>; otherwise substitute
2N/Anothing.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:</STRONG><EM>offset&nbsp;</EM><STRONG>:</STRONG><EM>length&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>:</STRONG><EM>offset&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>Expands to the portion of the value of <EM>parameter </EM>starting at the character
2N/A(counting from <STRONG>0&nbsp;</STRONG>) determined by expanding <EM>offset </EM>as an arithmetic expression
2N/Aand consisting of the number of characters determined by the arithmetic
2N/Aexpression defined by <EM>length.
2N/A</EM>In the second form, the remainder of the value is used.
2N/AIf <EM>parameter </EM>is <STRONG>* </STRONG>or <STRONG>@</STRONG>, or is an array name indexed by <STRONG>* </STRONG>or <STRONG>@</STRONG>, then <EM>offset
2N/A</EM>and <EM>length </EM>refer to the array index and number of elements respectively.
2N/A<STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>#</STRONG><EM>pattern&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>##</STRONG><EM>pattern&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If the shell <EM>pattern </EM>matches the beginning of the value of <EM>parameter</EM>, then
2N/Athe value of this expansion is the value of the <EM>parameter </EM>with the matched
2N/Aportion deleted; otherwise the value of this <EM>parameter </EM>is substituted.
2N/AIn the first form the smallest matching pattern is deleted and in the second
2N/Aform the largest matching pattern is deleted.
2N/AWhen <EM>parameter </EM>is <STRONG>@</STRONG>, <STRONG>*</STRONG>, or an array variable with subscript <STRONG>@ </STRONG>or <STRONG>*</STRONG>, the
2N/Asubstring operation is applied to each element in turn.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>%</STRONG><EM>pattern&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>%%</STRONG><EM>pattern&nbsp;</EM><STRONG>}</STRONG>
2N/A<DD>If the shell <EM>pattern </EM>matches the end of the value of <EM>parameter</EM>, then the
2N/Avalue of this expansion is the value of the <EM>parameter </EM>with the matched
2N/Apart deleted; otherwise substitute the value of <EM>parameter</EM>.
2N/AIn the first form the smallest matching pattern is deleted and in the second
2N/Aform the largest matching pattern is deleted.
2N/AWhen <EM>parameter </EM>is <STRONG>@</STRONG>, <STRONG>*</STRONG>, or an array variable with subscript <STRONG>@ </STRONG>or <STRONG>*</STRONG>, the
2N/Asubstring operation is applied to each element in turn.
2N/A<STRONG><P>
2N/A<DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>/</STRONG><EM>pattern&nbsp;</EM><STRONG>/</STRONG><EM>string&nbsp;</EM><STRONG>} </STRONG>
2N/A<DD><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>//</STRONG><EM>pattern&nbsp;</EM><STRONG>/</STRONG><EM>string&nbsp;</EM><STRONG>}
2N/A<DD></STRONG><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>/#</STRONG><EM>pattern&nbsp;</EM><STRONG>/</STRONG><EM>string&nbsp;</EM><STRONG>}
2N/A<DD></STRONG><STRONG><DT>
2N/A${</STRONG><EM>parameter&nbsp;</EM><STRONG>/%</STRONG><EM>pattern&nbsp;</EM><STRONG>/</STRONG><EM>string&nbsp;</EM><STRONG>}
2N/A<DD></STRONG>Expands <EM>parameter </EM>and replaces the longest match of <EM>pattern </EM>with the given
2N/A<EM>string.
2N/A</EM>Each occurrence of <STRONG>&#092;</STRONG><EM>n&nbsp;</EM> in <EM>string </EM>is replaced by the portion of <EM>parameter&nbsp;</EM>
2N/Athat matches the <EM>n&nbsp;</EM>-th sub-pattern.
2N/AIn the first form, only the first occurrence of <EM>pattern </EM>is replaced.
2N/AIn the second form, each match for <EM>pattern </EM>is replaced by the given <EM>string.
2N/A</EM>The third form restricts the pattern match to the beginning of the string
2N/Awhile the fourth form restricts the pattern match to the end of the string.
2N/AWhen <EM>string </EM>is null, the <EM>pattern </EM>will be deleted and the <STRONG>/ </STRONG>in front of
2N/A<EM>string </EM>may be omitted.
2N/AWhen <EM>parameter </EM>is <STRONG>@</STRONG>, <STRONG>*</STRONG>, or an array variable with subscript <STRONG>@ </STRONG>or <STRONG>*</STRONG>, the
2N/Asubstitution operation is applied to each element in turn.
2N/A</DL>
2N/A<P>
2N/AIn the above, <EM>word </EM>is not evaluated unless it is to be used as the substituted
2N/Astring, so that, in the following example, <STRONG>pwd </STRONG>is executed only if <STRONG>d </STRONG>is
2N/Anot set or is null:
2N/A<DL COMPACT>
2N/A<P>
2N/Aprint &nbsp;${d:&#045;&nbsp;$(&nbsp;pwd&nbsp;)&nbsp;} </DL>
2N/A<P>
2N/AIf the colon ( <STRONG>: ) </STRONG>is omitted from the above expressions, then the shell
2N/Aonly checks whether <EM>parameter </EM>is set or not.
2N/A<P>
2N/AThe following parameters are automatically set by the shell: <DL COMPACT><DL COMPACT><STRONG>
2N/A<DT>
2N/A# </STRONG>
2N/A<DD>The number of positional parameters in decimal.
2N/A<STRONG><DT>
2N/A&#045; </STRONG>
2N/A<DD>Options supplied to the shell on invocation or by the <STRONG>set </STRONG>command.
2N/A<STRONG><DT>
2N/A? </STRONG>
2N/A<DD>The decimal value returned by the last executed command.
2N/A<STRONG><DT>
2N/A$ </STRONG>
2N/A<DD>The process number of this shell.
2N/A<STRONG><DT>
2N/A_ </STRONG>
2N/A<DD>Initially, the value of <STRONG>_ </STRONG>is an absolute pathname of the shell or script
2N/Abeing executed as passed in the <EM>environment</EM>.
2N/ASubsequently it is assigned the last argument of the previous command.
2N/AThis parameter is not set for commands which are asynchronous.
2N/AThis parameter is also used to hold the name of the matching <STRONG><FONT SIZE=-1>MAIL </FONT></STRONG>file
2N/Awhen checking for mail.
2N/A<STRONG><DT>
2N/A! </STRONG>
2N/A<DD>The process number of the last background command invoked.
2N/A<STRONG><DT>
2N/A.sh.edchar </STRONG>
2N/A<DD>This variable contains the value of the keyboard character (or sequence
2N/Aof characters if the first character is an ESC, ascii <STRONG>033&nbsp;</STRONG>) that has been
2N/Aentered when processing a <STRONG><FONT SIZE=-1>KEYBD </FONT></STRONG>trap (see <A HREF="#Key Bindings"><EM>Key Bindings </EM></A>below).
2N/AIf the value is changed as part of the trap action, then the new value
2N/Areplaces the key (or key sequence) that caused the trap.
2N/A<STRONG><DT>
2N/A.sh.edcol </STRONG>
2N/A<DD>The character position of the cursor at the time of the most recent <STRONG><FONT SIZE=-1>KEYBD
2N/A</FONT></STRONG>trap.
2N/A<STRONG><DT>
2N/A.sh.edmode </STRONG>
2N/A<DD>The value is set to ESC when processing a <STRONG><FONT SIZE=-1>KEYBD </FONT></STRONG>trap while in <STRONG>vi </STRONG>insert
2N/Amode.
2N/A(See <EM>Vi Editing Mode </EM>below.) Otherwise, <STRONG>.sh.edmode </STRONG>is null when processing
2N/Aa <STRONG><FONT SIZE=-1>KEYBD </FONT></STRONG>trap.
2N/A<STRONG><DT>
2N/A.sh.edtext </STRONG>
2N/A<DD>The characters in the input buffer at the time of the most recent <STRONG><FONT SIZE=-1>KEYBD
2N/A</FONT></STRONG>trap.
2N/AThe value is null when not processing a <STRONG><FONT SIZE=-1>KEYBD </FONT></STRONG>trap.
2N/A<STRONG><DT>
2N/A.sh.name </STRONG>
2N/A<DD>Set to the name of the variable at the time that a discipline function
2N/Ais invoked.
2N/A<STRONG><DT>
2N/A.sh.subscript </STRONG>
2N/A<DD>Set to the name subscript of the variable at the time that a discipline
2N/Afunction is invoked.
2N/A<STRONG><DT>
2N/A.sh.value </STRONG>
2N/A<DD>Set to the value of the variable at the time that the <STRONG>set </STRONG>discipline function
2N/Ais invoked.
2N/A<STRONG><DT>
2N/A.sh.version </STRONG>
2N/A<DD>Set to a value that identifies the version of this shell.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LINENO </FONT></STRONG>
2N/A<DD>The current line number within the script or function being executed.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>OLDPWD </FONT></STRONG>
2N/A<DD>The previous working directory set by the <STRONG>cd </STRONG>command.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>OPTARG </FONT></STRONG>
2N/A<DD>The value of the last option argument processed by the <STRONG>getopts </STRONG>built-in
2N/Acommand.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>OPTIND </FONT></STRONG>
2N/A<DD>The index of the last option argument processed by the <STRONG>getopts </STRONG>built-in
2N/Acommand.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>PPID </FONT></STRONG>
2N/A<DD>The process number of the parent of the shell.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>PWD </FONT></STRONG>
2N/A<DD>The present working directory set by the <STRONG>cd </STRONG>command.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>RANDOM </FONT></STRONG>
2N/A<DD>Each time this variable is referenced, a random integer, uniformly distributed
2N/Abetween 0 and 32767, is generated.
2N/AThe sequence of random numbers can be initialized by assigning a numeric
2N/Avalue to <FONT SIZE=-1><STRONG>RANDOM</STRONG>.
2N/A</FONT><STRONG><DT>
2N/A<FONT SIZE=-1>REPLY </FONT></STRONG>
2N/A<DD>This variable is set by the <STRONG>select </STRONG>statement and by the <STRONG>read </STRONG>built-in command
2N/Awhen no arguments are supplied.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>SECONDS </FONT></STRONG>
2N/A<DD>Each time this variable is referenced, the number of seconds since shell
2N/Ainvocation is returned.
2N/AIf this variable is assigned a value, then the value returned upon reference
2N/Awill be the value that was assigned plus the number of seconds since the
2N/Aassignment.
2N/A</DL></DL><P>
2N/AThe following variables are used by the shell: <DL COMPACT><DL COMPACT><STRONG>
2N/A<DT>
2N/A<FONT SIZE=-1>CDPATH </FONT></STRONG>
2N/A<DD>The search path for the <STRONG>cd </STRONG>command.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>COLUMNS </FONT></STRONG>
2N/A<DD>If this variable is set, the value is used to define the width of the edit
2N/Awindow for the shell edit modes and for printing <STRONG>select </STRONG>lists.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>EDITOR </FONT></STRONG>
2N/A<DD>If the value of this variable ends in <EM>emacs</EM>, <EM>gmacs</EM>, or <EM>vi </EM>and the <STRONG><FONT SIZE=-1>VISUAL
2N/A</FONT></STRONG>variable is not set, then the corresponding option (see special built-in
2N/Acommand <A HREF="#set"><STRONG>set </STRONG></A>below) will be turned on.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>ENV </STRONG>
2N/A<DD></FONT>If this variable is set, then parameter expansion, command substitution,
2N/Aand arithmetic substitution are performed on the value to generate the
2N/Apathname of the script that will be executed when the shell is invoked
2N/A(see <A HREF="#Invocation"><EM>Invocation </EM></A>below).
2N/AThis file is typically used for <STRONG>alias </STRONG>and <STRONG>function </STRONG>definitions.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>FCEDIT </FONT></STRONG>
2N/A<DD>Obsolete name for the default editor name for the <STRONG>hist </STRONG>command.
2N/A<STRONG><FONT SIZE=-1>FCEDIT </FONT></STRONG>is not used when <STRONG><FONT SIZE=-1>HISTEDIT </FONT></STRONG>is set.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>FIGNORE </STRONG>
2N/A<DD></FONT>A pattern that defines the set of filenames that will be ignored when performing
2N/Afilename matching.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>FPATH </STRONG>
2N/A<DD></FONT>The search path for function definitions.
2N/AThis path is searched for a file with the same name as the function or
2N/Acommand when a function with the <STRONG>&#045;u </STRONG>attribute is referenced and when a
2N/Acommand is not found.
2N/AIf an executable file with the name of that command is found, then it is
2N/Aread and executed in the current environment.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>HISTCMD </FONT></STRONG>
2N/A<DD>Number of the current command in the history file.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>HISTEDIT </FONT></STRONG>
2N/A<DD>Name for the default editor name for the <STRONG>hist </STRONG>command.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>HISTFILE </STRONG>
2N/A<DD></FONT>If this variable is set when the shell is invoked, then the value is the
2N/Apathname of the file that will be used to store the command history (see
2N/A<A HREF="#Command Re-entry"><EM>Command Re-entry </EM></A>below).
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>HISTSIZE </STRONG>
2N/A<DD></FONT>If this variable is set when the shell is invoked, then the number of previously
2N/Aentered commands that are accessible by this shell will be greater than
2N/Aor equal to this number.
2N/AThe default is 128.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>HOME </FONT></STRONG>
2N/A<DD>The default argument (home directory) for the <STRONG>cd </STRONG>command.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>IFS </STRONG>
2N/A<DD></FONT>Internal field separators, normally <STRONG>space</STRONG>, <STRONG>tab</STRONG>, and <STRONG>new-line </STRONG>that are used
2N/Ato separate the results of command substitution or parameter expansion
2N/Aand to separate fields with the built-in command <STRONG>read</STRONG>.
2N/AThe first character of the <FONT SIZE=-1><STRONG>IFS </STRONG></FONT>variable is used to separate arguments for
2N/Athe <STRONG>"$*" </STRONG>substitution (see <A HREF="#Quoting"><EM>Quoting </EM></A>below).
2N/AEach single occurrence of an <FONT SIZE=-1><STRONG>IFS </STRONG></FONT>character in the string to be split, that
2N/Ais not in the <EM>isspace&nbsp;</EM> character class, and any adjacent characters in
2N/A<FONT SIZE=-1><STRONG>IFS </STRONG></FONT>that are in the <EM>isspace&nbsp;</EM> character class, delimit a field.
2N/AOne or more characters in <FONT SIZE=-1><STRONG>IFS </STRONG></FONT>that belong to the <EM>isspace&nbsp;</EM> character class,
2N/Adelimit a field.
2N/AIn addition, if the same <EM>isspace&nbsp;</EM> character appears consecutively inside
2N/A<FONT SIZE=-1><STRONG>IFS</STRONG>, </FONT>this character is treated as if it were not in the <EM>isspace&nbsp;</EM> class,
2N/Aso that if <FONT SIZE=-1><STRONG>IFS </STRONG></FONT>consists of two <STRONG>tab </STRONG>characters, then two adjacent <STRONG>tab </STRONG>characters
2N/Adelimit a null field.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LANG </FONT></STRONG>
2N/A<DD>This variable determines the locale category for any category not specifically
2N/Aselected with a variable starting with <STRONG><FONT SIZE=-1>LC_ </FONT></STRONG>or <FONT SIZE=-1><STRONG>LANG</STRONG>.
2N/A</FONT><STRONG><DT>
2N/A<FONT SIZE=-1>LC_ALL </FONT></STRONG>
2N/A<DD>This variable overrides the value of the <STRONG><FONT SIZE=-1>LANG </FONT></STRONG>variable and any other <STRONG><FONT SIZE=-1>LC_
2N/A</FONT></STRONG>variable.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LC_COLLATE </FONT></STRONG>
2N/A<DD>This variable determines the locale category for character collation information.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LC_CTYPE </FONT></STRONG>
2N/A<DD>This variable determines the locale category for character handling functions.
2N/AIt determines the character classes for pattern matching (see <A HREF="#File Name Generation"><EM>File Name
2N/AGeneration </EM></A>below).
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LC_NUMERIC </FONT></STRONG>
2N/A<DD>This variable determines the locale category for the decimal point character.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>LINES </FONT></STRONG>
2N/A<DD>If this variable is set, the value is used to determine the column length
2N/Afor printing <STRONG>select </STRONG>lists.
2N/ASelect lists will print vertically until about two-thirds of <STRONG><FONT SIZE=-1>LINES </FONT></STRONG>lines
2N/Aare filled.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>MAIL </FONT></STRONG>
2N/A<DD>If this variable is set to the name of a mail file <EM>and </EM>the <STRONG><FONT SIZE=-1>MAILPATH </FONT></STRONG>variable
2N/Ais not set, then the shell informs the user of arrival of mail in the specified
2N/Afile.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>MAILCHECK </FONT></STRONG>
2N/A<DD>This variable specifies how often (in seconds) the shell will check for
2N/Achanges in the modification time of any of the files specified by the <STRONG><FONT SIZE=-1>MAILPATH
2N/A</FONT></STRONG>or <STRONG><FONT SIZE=-1>MAIL </FONT></STRONG>variables.
2N/AThe default value is 600 seconds.
2N/AWhen the time has elapsed the shell will check before issuing the next
2N/Aprompt.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>MAILPATH </FONT></STRONG>
2N/A<DD>A colon ( <STRONG>: </STRONG>) separated list of file names.
2N/AIf this variable is set, then the shell informs the user of any modifications
2N/Ato the specified files that have occurred within the last <STRONG><FONT SIZE=-1>MAILCHECK </FONT></STRONG>seconds.
2N/AEach file name can be followed by a <STRONG>? </STRONG>and a message that will be printed.
2N/AThe message will undergo parameter expansion, command substitution, and
2N/Aarithmetic substitution with the variable <STRONG>$_ </STRONG>defined as the name of the
2N/Afile that has changed.
2N/AThe default message is <EM>you have mail in $_&nbsp;.
2N/A</EM><STRONG><DT>
2N/A<FONT SIZE=-1>PATH </FONT></STRONG>
2N/A<DD>The search path for commands (see <A HREF="#Execution"><EM>Execution </EM></A>below).
2N/AThe user may not change <STRONG><FONT SIZE=-1>PATH</FONT> </STRONG>if executing under <STRONG>rsh </STRONG>(except in <STRONG>.profile&nbsp;).
2N/A</STRONG><DT>
2N/A<FONT SIZE=-1><STRONG>PS1 </STRONG>
2N/A<DD></FONT>The value of this variable is expanded for parameter expansion, command
2N/Asubstitution, and arithmetic substitution to define the primary prompt
2N/Astring which by default is ``<STRONG>$&nbsp;&nbsp;&nbsp;</STRONG>''.
2N/AThe character <STRONG>! </STRONG>in the primary prompt string is replaced by the <EM>command
2N/A</EM>number (see <A HREF="#Command Re-entry"><EM>Command Re-entry </EM></A>below).
2N/ATwo successive occurrences of <STRONG>! </STRONG>will produce a single <STRONG>! </STRONG>when the prompt
2N/Astring is printed.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>PS2 </STRONG>
2N/A<DD></FONT>Secondary prompt string, by default ``<STRONG>&gt; &nbsp;</STRONG>''.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>PS3 </STRONG>
2N/A<DD></FONT>Selection prompt string used within a <STRONG>select </STRONG>loop, by default ``<STRONG>#? &nbsp;</STRONG>''.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>PS4 </STRONG>
2N/A<DD></FONT>The value of this variable is expanded for parameter evaluation, command
2N/Asubstitution, and arithmetic substitution and precedes each line of an
2N/Aexecution trace.
2N/ABy default, <FONT SIZE=-1><STRONG>PS4 </STRONG></FONT>is ``<STRONG>+ &nbsp;</STRONG>''.
2N/AIn addition when <FONT SIZE=-1><STRONG>PS4 </STRONG></FONT>is unset, the execution trace prompt is also ``<STRONG>+ &nbsp;</STRONG>''.
2N/A<DT>
2N/A<FONT SIZE=-1><STRONG>SHELL </STRONG>
2N/A<DD></FONT>The pathname of the <EM>shell </EM>is kept in the environment.
2N/AAt invocation, if the basename of this variable is <STRONG>rsh</STRONG>, <STRONG>rksh</STRONG>, or <STRONG>krsh</STRONG>,
2N/Athen the shell becomes restricted.
2N/A<STRONG><DT>
2N/A<FONT SIZE=-1>TMOUT </FONT></STRONG>
2N/A<DD>If set to a value greater than zero, <STRONG><FONT SIZE=-1>TMOUT </FONT></STRONG>will be the default timeout
2N/Avalue for the <STRONG>read </STRONG>built-in command.
2N/AThe <STRONG>select </STRONG>compound command terminates after <STRONG><FONT SIZE=-1>TMOUT </FONT></STRONG>seconds when input is
2N/Afrom a terminal.
2N/AOtherwise, the shell will terminate if a line is not entered within the
2N/Aprescribed number of seconds while reading from a terminal.
2N/A(Note that the shell can be compiled with a maximum bound for this value
2N/Awhich cannot be exceeded.) <STRONG>
2N/A<DT>
2N/A<FONT SIZE=-1>VISUAL </FONT></STRONG>
2N/A<DD>If the value of this variable ends in <EM>emacs</EM>, <EM>gmacs</EM>, or <EM>vi </EM>then the corresponding
2N/Aoption (see Special Command <A HREF="#set"><STRONG>set </STRONG></A>below) will be turned on.
2N/AThe value of <STRONG><FONT SIZE=-1>VISUAL </FONT></STRONG>overrides the value of <STRONG><FONT SIZE=-1>EDITOR.
2N/A</FONT></STRONG></DL></DL><P>
2N/AThe shell gives default values to <STRONG><FONT SIZE=-1>PATH</FONT></STRONG>, <STRONG><FONT SIZE=-1>PS1</FONT></STRONG>, <STRONG><FONT SIZE=-1>PS2</FONT></STRONG>, <STRONG><FONT SIZE=-1>PS3</FONT></STRONG>, <STRONG><FONT SIZE=-1>PS4</FONT></STRONG>, <STRONG><FONT SIZE=-1>MAILCHECK</FONT></STRONG>,
2N/A<STRONG><FONT SIZE=-1>FCEDIT</FONT></STRONG>, <STRONG><FONT SIZE=-1>TMOUT</FONT></STRONG> and <STRONG><FONT SIZE=-1>IFS</FONT></STRONG>, while <FONT SIZE=-1><STRONG>HOME</STRONG>, </FONT><FONT SIZE=-1><STRONG>SHELL</STRONG>, </FONT><FONT SIZE=-1><STRONG>ENV</STRONG>, </FONT>and <FONT SIZE=-1><STRONG>MAIL </STRONG></FONT>are not set at
2N/Aall by the shell (although <FONT SIZE=-1><STRONG>HOME </STRONG></FONT><EM>is </EM>set by <EM>login</EM>(1)).
2N/AOn some systems <FONT SIZE=-1><STRONG>MAIL </STRONG></FONT>and <FONT SIZE=-1><STRONG>SHELL </STRONG></FONT>are also set by <EM>login</EM>(1).
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Field Splitting">Field &nbsp;Splitting.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>After parameter expansion and command substitution, the results of substitutions
2N/Aare scanned for the field separator characters (those found in <FONT SIZE=-1><STRONG>IFS&nbsp; </STRONG></FONT>) and
2N/Asplit into distinct fields where such characters are found.
2N/AExplicit null fields (&nbsp;<STRONG>"&nbsp;"</STRONG> or <STRONG>'&nbsp;'</STRONG>&nbsp;) are retained.
2N/AImplicit null fields (those resulting from <EM>parameters </EM>that have no values
2N/Aor command substitutions with no output) are removed.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="File Name Generation">File &nbsp;Name &nbsp;Generation.
2N/A&nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Following splitting, each field is scanned for the characters <STRONG>*</STRONG>, <STRONG>?</STRONG>, <STRONG>(</STRONG>,
2N/Aand <STRONG>[&nbsp; </STRONG>unless the <STRONG>&#045;f </STRONG>option has been set.
2N/AIf one of these characters appears, then the word is regarded as a <EM>pattern</EM>.
2N/AEach file name component that contains any pattern character is replaced
2N/Awith a lexicographically sorted set of names that matches the pattern from
2N/Athat directory.
2N/AIf no file name is found that matches the pattern, then that component
2N/Aof the filename is left unchanged.
2N/AIf <FONT SIZE=-1><STRONG>FIGNORE </STRONG></FONT>is set, then each file name component that matches the pattern
2N/Adefined by the value of <FONT SIZE=-1><STRONG>FIGNORE </STRONG></FONT>is ignored when generating the matching
2N/Afilenames.
2N/AThe names <STRONG>.
2N/A</STRONG>and <STRONG>..
2N/A</STRONG>are also ignored.
2N/AIf <FONT SIZE=-1><STRONG>FIGNORE </STRONG></FONT>is not set, the character <STRONG>.
2N/A</STRONG>at the start of each file name component will be ignored unless the first
2N/Acharacter of the pattern corresponding to this component is the character
2N/A<STRONG>.
2N/A</STRONG>itself.
2N/ANote, that for other uses of pattern matching the <STRONG>/ </STRONG>and <STRONG>.
2N/A</STRONG>are not treated specially.
2N/A<DL COMPACT><DL COMPACT><STRONG><P>
2N/A<DT>
2N/A* </STRONG>
2N/A<DD>Matches any string, including the null string.
2N/A<STRONG><DT>
2N/A? </STRONG>
2N/A<DD>Matches any single character.
2N/A<DT>
2N/A<STRONG>[&nbsp;</STRONG>&nbsp;.&nbsp;.&nbsp;.&nbsp;<STRONG>&nbsp;] </STRONG>
2N/A<DD>Matches any one of the enclosed characters.
2N/AA pair of characters separated by <STRONG>&#045; </STRONG>matches any character lexically between
2N/Athe pair, inclusive.
2N/AIf the first character following the opening <STRONG>[&nbsp; </STRONG>is a <STRONG>! </STRONG>then any character
2N/Anot enclosed is matched.
2N/AA <STRONG>&#045; </STRONG>can be included in the character set by putting it as the first or
2N/Alast character.
2N/A<BR>
2N/AWithin <STRONG>[&nbsp; </STRONG>and <STRONG>&nbsp;]&nbsp;</STRONG>, character classes can be specified with the syntax <STRONG>[:</STRONG><EM>class</EM><STRONG>:]</STRONG>
2N/Awhere class is one of the following classes defined in the ANSI-C standard:
2N/A<STRONG><BR>
2N/Aalnum alpha blank cntrl digit graph lower print punct space upper xdigit
2N/A</STRONG><BR>
2N/AWithin <STRONG>[&nbsp; </STRONG>and <STRONG>&nbsp;]&nbsp;</STRONG>, an equivalence class can be specified with the syntax
2N/A<STRONG>[=</STRONG><EM>c</EM><STRONG>=]</STRONG> which matches all characters with the same primary collation weight
2N/A(as defined by the current locale) as the character <EM>c</EM>.
2N/A<BR>
2N/AWithin <STRONG>[&nbsp; </STRONG>and <STRONG>&nbsp;]&nbsp;</STRONG>, <STRONG>[.</STRONG><EM>symbol</EM><STRONG>.]</STRONG> matches the collating symbol <EM>symbol</EM>.
2N/A</DL>
2N/A</DL>
2N/AA <EM>pattern-list </EM>is a list of one or more patterns separated from each other
2N/Awith a <STRONG>&amp; </STRONG>or <STRONG>|</STRONG>.
2N/AA <STRONG>&amp; </STRONG>signifies that all patterns must be matched whereas <STRONG>| </STRONG>requires that
2N/Aonly one pattern be matched.
2N/AComposite patterns can be formed with one or more of the following sub-patterns:
2N/A<DL COMPACT><DL COMPACT><STRONG><DT>
2N/A?(</STRONG><EM>pattern-list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Optionally matches any one of the given patterns.
2N/A<STRONG><DT>
2N/A*(</STRONG><EM>pattern-list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Matches zero or more occurrences of the given patterns.
2N/A<STRONG><DT>
2N/A+(</STRONG><EM>pattern-list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Matches one or more occurrences of the given patterns.
2N/A<STRONG><DT>
2N/A@(</STRONG><EM>pattern-list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Matches exactly one of the given patterns.
2N/A<STRONG><DT>
2N/A!(</STRONG><EM>pattern-list&nbsp;</EM><STRONG>)</STRONG>
2N/A<DD>Matches anything except one of the given patterns.
2N/A</DL>
2N/A</DL>
2N/AEach sub-pattern in a composite pattern is numbered, starting at 1, by
2N/Athe location of the <STRONG>(</STRONG> within the pattern.
2N/AThe sequence <STRONG>&#092;</STRONG><EM>n&nbsp;</EM>, where <EM>n&nbsp;</EM> is a single digit and <STRONG>&#092;</STRONG><EM>n&nbsp;</EM> comes after the <EM>n</EM>-th.
2N/Asub-pattern, matches the same string as the sub-pattern itself.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Quoting">Quoting.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Each of the <EM>metacharacters </EM>listed earlier (see <A HREF="#Definitions"><EM>Definitions </EM></A>above) has a
2N/Aspecial meaning to the shell and causes termination of a word unless quoted.
2N/AA character may be <EM>quoted </EM>(i.e., made to stand for itself) by preceding
2N/Ait with a <STRONG>&#092;</STRONG>.
2N/AThe pair <STRONG>&#092;new-line </STRONG>is removed.
2N/AAll characters enclosed between a pair of single quote marks (&nbsp;<STRONG>'&nbsp;'</STRONG>&nbsp;) that
2N/Ais not preceded by a <STRONG>$ </STRONG>are quoted.
2N/AA single quote cannot appear within the single quotes.
2N/AA single quoted string preceded by an unquoted <STRONG>$ </STRONG>is processed as an ANSI-C
2N/Astring except that <STRONG>&#092;0 </STRONG>within the string causes the remainder of the string
2N/Ato be ignored and <STRONG>&#092;E </STRONG>is equivalent to the escape character (ascii <STRONG>033</STRONG>).
2N/AInside double quote marks (<STRONG>"&nbsp;"</STRONG>), parameter and command substitution occur
2N/Aand <STRONG>&#092; </STRONG>quotes the characters <STRONG>&#092;</STRONG>, <STRONG><FONT SIZE=+1><SUB>`</SUB></FONT></STRONG>, <STRONG>"</STRONG>, and <STRONG>$</STRONG>.
2N/AA <STRONG>$ </STRONG>in front of a double quoted string will be ignored in the "C" or "POSIX"
2N/Alocale, and may cause the string to be replaced by a locale specific string
2N/Aotherwise.
2N/AThe meaning of <STRONG>$* </STRONG>and <STRONG>$@ </STRONG>is identical when not quoted or when used as a
2N/Avariable assignment value or as a file name.
2N/AHowever, when used as a command argument, <STRONG>"$*" </STRONG>is equivalent to <STRONG>"$1</STRONG><EM>d</EM><STRONG>&nbsp;$2</STRONG><EM>d</EM>&nbsp;.&nbsp;.&nbsp;.<STRONG>"</STRONG>,
2N/Awhere <EM>d </EM>is the first character of the <FONT SIZE=-1><STRONG>IFS </STRONG></FONT>variable, whereas <STRONG>"$@" </STRONG>is equivalent
2N/Ato <STRONG>"$1"&nbsp; </STRONG><STRONG>"$2"&nbsp; </STRONG>.&nbsp;.&nbsp;.&nbsp;.
2N/AInside grave quote marks (<STRONG><FONT SIZE=+1><SUB>`</SUB></FONT>&nbsp;<FONT SIZE=+1><SUB>`</SUB></FONT></STRONG>), <STRONG>&#092; </STRONG>quotes the characters <STRONG>&#092;</STRONG>, <STRONG><FONT SIZE=+1><SUB>`</SUB></FONT></STRONG>, and <STRONG>$</STRONG>.
2N/AIf the grave quotes occur within double quotes, then <STRONG>&#092; </STRONG>also quotes the
2N/Acharacter <STRONG>"</STRONG>.
2N/A<P>
2N/AThe special meaning of reserved words or aliases can be removed by quoting
2N/Aany character of the reserved word.
2N/AThe recognition of function names or built-in command names listed below
2N/Acannot be altered by quoting them.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Arithmetic Evaluation">Arithmetic &nbsp;Evaluation.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The shell performs arithmetic evaluation for arithmetic substitution, to
2N/Aevaluate an arithmetic command, to evaluate an indexed array subscript,
2N/Aand to evaluate arguments to the built-in commands <STRONG>shift </STRONG>and <STRONG>let</STRONG>.
2N/AEvaluations are performed using double precision floating point arithmetic.
2N/AFloating point constants follow the ANSI-C programming language conventions.
2N/AInteger constants are of the form [&nbsp;<EM>base</EM><STRONG>#&nbsp;</STRONG>&nbsp;]<EM>n&nbsp;</EM> where <EM>base </EM>is a decimal
2N/Anumber between two and sixty-four representing the arithmetic base and
2N/A<EM>n </EM>is a number in that base.
2N/AThe digits above 9 are represented by the lower case letters, the upper
2N/Acase letters, <STRONG>@</STRONG>, and <STRONG>_ </STRONG>respectively.
2N/AFor bases less than or equal to 36, upper and lower case characters can
2N/Abe used interchangeably.
2N/AIf <EM>base </EM>is omitted, then base 10 is used.
2N/A<P>
2N/AAn arithmetic expression uses the same syntax, precedence, and associativity
2N/Aof expression as the C language.
2N/AAll the C language operators that apply to floating point quantities can
2N/Abe used.
2N/AIn addition, when the value of an arithmetic variable or sub-expression
2N/Acan be represented as a long integer, all C language integer arithmetic
2N/Aoperations can be performed.
2N/AVariables can be referenced by name within an arithmetic expression without
2N/Ausing the parameter expansion syntax.
2N/AWhen a variable is referenced, its value is evaluated as an arithmetic
2N/Aexpression.
2N/A<P>
2N/AThe following math library functions can be used with an arithmetic expression:
2N/A<DL COMPACT><STRONG><P>
2N/Aabs acos asin atan cos cosh exp int log sin sinh sqrt tan tanh </STRONG></DL>
2N/A<P>
2N/AAn internal representation of a <EM>variable </EM>as a double precision floating
2N/Apoint can be specified with the <STRONG>&#045;E</STRONG> [&nbsp;<EM>n&nbsp;</EM>&nbsp;] or <STRONG>&#045;F</STRONG> [&nbsp;<EM>n&nbsp;</EM>&nbsp;] option of the <STRONG>typeset
2N/A</STRONG>special built-in command.
2N/AThe <STRONG>&#045;E </STRONG>option causes the expansion of the value to be represented using
2N/Ascientific notation when it is expanded.
2N/AThe optional option argument <EM>n </EM>defines the number of significant figures.
2N/AThe <STRONG>&#045;F </STRONG>option causes the expansion to be represented as a floating decimal
2N/Anumber when it is expanded.
2N/AThe optional option argument <EM>n </EM>defines the number of places after the decimal
2N/Apoint in this case.
2N/A<P>
2N/AAn internal integer representation of a <EM>variable </EM>can be specified with
2N/Athe <STRONG>&#045;i</STRONG> [&nbsp;<EM>n&nbsp;</EM>&nbsp;] option of the <STRONG>typeset </STRONG>special built-in command.
2N/AThe optional option argument <EM>n </EM>specifies an arithmetic base to be used
2N/Awhen expanding the variable.
2N/AIf you do not specify an arithmetic base, the first assignment to the variable
2N/Adetermines the arithmetic base.
2N/A<P>
2N/AArithmetic evaluation is performed on the value of each assignment to a
2N/Avariable with the <STRONG>&#045;E</STRONG>, <STRONG>&#045;F</STRONG>, or <STRONG>&#045;i </STRONG>attribute.
2N/AAssigning a floating point number to a variable whose type is an integer
2N/Acauses the fractional part to be truncated.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Prompting">Prompting.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>When used interactively, the shell prompts with the value of <FONT SIZE=-1><STRONG>PS1 </STRONG></FONT>after
2N/Aexpanding it for parameter expansion, command substitution, and arithmetic
2N/Asubstitution, before reading a command.
2N/AIn addition, each single <STRONG>! </STRONG>in the prompt is replaced by the command number.
2N/AA <STRONG>!! </STRONG>is required to place <STRONG>! </STRONG>in the prompt.
2N/AIf at any time a new-line is typed and further input is needed to complete
2N/Aa command, then the secondary prompt (i.e., the value of <STRONG><FONT SIZE=-1>PS2</FONT></STRONG>) is issued.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Conditional Expressions">Conditional &nbsp;Expressions.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>A <EM>conditional expression </EM>is used with the <STRONG>[[ </STRONG>compound command to test attributes
2N/Aof files and to compare strings.
2N/AField splitting and file name generation are not performed on the words
2N/Abetween <STRONG>[[ </STRONG>and <STRONG>]]</STRONG>.
2N/AEach expression can be constructed from one or more of the following unary
2N/Aor binary expressions: <DL COMPACT><EM>
2N/A<DT>
2N/Astring</EM>
2N/A<DD>True, if <EM>string </EM>is not null.
2N/A<STRONG><DT>
2N/A&#045;a</STRONG> <EM>file</EM>
2N/A<DD>Same as <STRONG>&#045;e</STRONG> below.
2N/AThis is obsolete.
2N/A<STRONG><DT>
2N/A&#045;b</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a block special file.
2N/A<STRONG><DT>
2N/A&#045;c</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a character special file.
2N/A<STRONG><DT>
2N/A&#045;d</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a directory.
2N/A<STRONG><DT>
2N/A&#045;e</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists.
2N/A<STRONG><DT>
2N/A&#045;f</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is an ordinary file.
2N/A<STRONG><DT>
2N/A&#045;g</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and it has its setgid bit set.
2N/A<STRONG><DT>
2N/A&#045;k</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and it has its sticky bit set.
2N/A<STRONG><DT>
2N/A&#045;n</STRONG> <EM>string</EM>
2N/A<DD>True, if length of <EM>string </EM>is non-zero.
2N/A<STRONG><DT>
2N/A&#045;o</STRONG> <EM>option</EM>
2N/A<DD>True, if option named <EM>option </EM>is on.
2N/A<STRONG><DT>
2N/A&#045;p</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a fifo special file or a pipe.
2N/A<STRONG><DT>
2N/A&#045;r</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is readable by current process.
2N/A<STRONG><DT>
2N/A&#045;s</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and has size greater than zero.
2N/A<STRONG><DT>
2N/A&#045;t</STRONG> <EM>fildes</EM>
2N/A<DD>True, if file descriptor number <EM>fildes </EM>is open and associated with a terminal
2N/Adevice.
2N/A<STRONG><DT>
2N/A&#045;u</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and it has its setuid bit set.
2N/A<STRONG><DT>
2N/A&#045;w</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is writable by current process.
2N/A<STRONG><DT>
2N/A&#045;x</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is executable by current process.
2N/AIf <EM>file </EM>exists and is a directory, then true if the current process has
2N/Apermission to search in the directory.
2N/A<STRONG><DT>
2N/A&#045;z</STRONG> <EM>string</EM>
2N/A<DD>True, if length of <EM>string </EM>is zero.
2N/A<STRONG><DT>
2N/A&#045;L</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a symbolic link.
2N/A<STRONG><DT>
2N/A&#045;O</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is owned by the effective user id of this process.
2N/A<STRONG><DT>
2N/A&#045;G</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and its group matches the effective group id of this
2N/Aprocess.
2N/A<STRONG><DT>
2N/A&#045;S</STRONG> <EM>file</EM>
2N/A<DD>True, if <EM>file </EM>exists and is a socket.
2N/A<EM><DT>
2N/Afile1</EM> <STRONG>&#045;nt</STRONG> <EM>file2</EM>
2N/A<DD>True, if <EM>file1 </EM>exists and <EM>file2 </EM>does not, or <EM>file1 </EM>is newer than <EM>file2</EM>.
2N/A<EM><DT>
2N/Afile1</EM> <STRONG>&#045;ot</STRONG> <EM>file2</EM>
2N/A<DD>True, if <EM>file2 </EM>exists and <EM>file1 </EM>does not, or <EM>file1 </EM>is older than <EM>file2</EM>.
2N/A<EM><DT>
2N/Afile1</EM> <STRONG>&#045;ef</STRONG> <EM>file2</EM>
2N/A<DD>True, if <EM>file1 </EM>and <EM>file2 </EM>exist and refer to the same file.
2N/A<EM><DT>
2N/Astring</EM> <STRONG>==</STRONG> <EM>pattern</EM>
2N/A<DD>True, if <EM>string </EM>matches <EM>pattern</EM>.
2N/AAny part of <EM>pattern </EM>can be quoted to cause it to be matched as a string.
2N/A<EM><DT>
2N/Astring</EM> <STRONG>=</STRONG> <EM>pattern</EM>
2N/A<DD>Same as <STRONG>==</STRONG> above, but is obsolete.
2N/A<EM><DT>
2N/Astring</EM> <STRONG>!=</STRONG> <EM>pattern</EM>
2N/A<DD>True, if <EM>string </EM>does not match <EM>pattern</EM>.
2N/A<EM><DT>
2N/Astring1</EM> <STRONG>&lt;</STRONG> <EM>string2</EM>
2N/A<DD>True, if <EM>string1 </EM>comes before <EM>string2 </EM>based on ASCII value of their characters.
2N/A<EM><DT>
2N/Astring1</EM> <STRONG>&gt;</STRONG> <EM>string2</EM>
2N/A<DD>True, if <EM>string1 </EM>comes after <EM>string2 </EM>based on ASCII value of their characters.
2N/A</DL>
2N/A<BR>
2N/AThe following obsolete arithmetic comparisons are also permitted: <DL COMPACT><EM>
2N/A<DT>
2N/Aexp1</EM> <STRONG>&#045;eq</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is equal to <EM>exp2</EM>.
2N/A<EM><DT>
2N/Aexp1</EM> <STRONG>&#045;ne</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is not equal to <EM>exp2</EM>.
2N/A<EM><DT>
2N/Aexp1</EM> <STRONG>&#045;lt</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is less than <EM>exp2</EM>.
2N/A<EM><DT>
2N/Aexp1</EM> <STRONG>&#045;gt</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is greater than <EM>exp2</EM>.
2N/A<EM><DT>
2N/Aexp1</EM> <STRONG>&#045;le</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is less than or equal to <EM>exp2</EM>.
2N/A<EM><DT>
2N/Aexp1</EM> <STRONG>&#045;ge</STRONG> <EM>exp2</EM>
2N/A<DD>True, if <EM>exp1 </EM>is greater than or equal to <EM>exp2</EM>.
2N/A</DL>
2N/A<P>
2N/AIn each of the above expressions, if <EM>file </EM>is of the form <STRONG>/dev/fd/</STRONG><EM>n</EM>, where
2N/A<EM>n </EM>is an integer, then the test is applied to the open file whose descriptor
2N/Anumber is <EM>n</EM>.
2N/A<P>
2N/AA compound expression can be constructed from these primitives by using
2N/Aany of the following, listed in decreasing order of precedence.
2N/A<DL COMPACT><STRONG><DT>
2N/A(</STRONG><EM>expression</EM><STRONG>)</STRONG>
2N/A<DD>True, if <EM>expression </EM>is true.
2N/AUsed to group expressions.
2N/A<STRONG><DT>
2N/A!</STRONG> <EM>expression</EM>
2N/A<DD>True if <EM>expression </EM>is false.
2N/A<EM><DT>
2N/Aexpression1</EM> <STRONG>&amp;&amp;</STRONG> <EM>expression2</EM>
2N/A<DD>True, if <EM>expression1 </EM>and <EM>expression2 </EM>are both true.
2N/A<EM><DT>
2N/Aexpression1</EM> <STRONG>||</STRONG> <EM>expression2</EM>
2N/A<DD>True, if either <EM>expression1 </EM>or <EM>expression2 </EM>is true.
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Input/Output">Input/Output.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Before a command is executed, its input and output may be redirected using
2N/Aa special notation interpreted by the shell.
2N/AThe following may appear anywhere in a simple-command or may precede or
2N/Afollow a <EM>command </EM>and are <EM>not </EM>passed on to the invoked command.
2N/ACommand substitution, parameter expansion, and arithmetic substitution
2N/Aoccur before <EM>word </EM>or <EM>digit </EM>is used except as noted below.
2N/AFile name generation occurs only if the shell is interactive and the pattern
2N/Amatches a single file.
2N/AField splitting is not performed.
2N/A<P>
2N/AIn each of the following redirections, if <EM>file </EM>is of the form <STRONG>/dev/tcp/</STRONG><EM>host</EM><STRONG>/</STRONG><EM>port</EM>,
2N/Aor <STRONG>/dev/udp/</STRONG><EM>host</EM><STRONG>/</STRONG><EM>port</EM>, where <EM>host </EM>is a hostname or host address, and <EM>port
2N/A</EM>is an integer port number, then the redirection attempts to make a <STRONG>tcp</STRONG>
2N/Aor <STRONG>udp</STRONG> connection to the corresponding socket.
2N/A<DL COMPACT>
2N/A<P>
2N/A<DT>
2N/A<STRONG>&lt;</STRONG><EM>word </EM>
2N/A<DD>Use file <EM>word </EM>as standard input (file descriptor 0).
2N/A<P>
2N/A<DT>
2N/A<STRONG>&gt;</STRONG><EM>word </EM>
2N/A<DD>Use file <EM>word </EM>as standard output (file descriptor 1).
2N/AIf the file does not exist then it is created.
2N/AIf the file exists, and the <STRONG>noclobber </STRONG>option is on, this causes an error;
2N/Aotherwise, it is truncated to zero length.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&gt;|</STRONG><EM>word </EM>
2N/A<DD>Sames as <STRONG>&gt;</STRONG>, except that it overrides the <STRONG>noclobber </STRONG>option.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&gt;&gt;</STRONG><EM>word </EM>
2N/A<DD>Use file <EM>word </EM>as standard output.
2N/AIf the file exists, then output is appended to it (by first seeking to
2N/Athe end-of-file); otherwise, the file is created.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&lt;&gt;</STRONG><EM>word </EM>
2N/A<DD>Open file <EM>word </EM>for reading and writing as standard input.
2N/A<STRONG><P>
2N/A<DT>
2N/A&lt;&lt;</STRONG>[&nbsp;<STRONG>&#045;</STRONG>&nbsp;]<EM>word</EM>
2N/A<DD>The shell input is read up to a line that is the same as <EM>word </EM>after any
2N/Aquoting has been removed, or to an end-of-file.
2N/ANo parameter substitution, command substitution, arithmetic substitution
2N/Aor file name generation is performed on <EM>word</EM>.
2N/AThe resulting document, called a <EM>here-document</EM>, becomes the standard input.
2N/AIf any character of <EM>word </EM>is quoted, then no interpretation is placed upon
2N/Athe characters of the document; otherwise, parameter expansion, command
2N/Asubstitution, and arithmetic substitution occur, <STRONG>&#092;new-line </STRONG>is ignored,
2N/Aand <STRONG>&#092; </STRONG>must be used to quote the characters <STRONG>&#092;</STRONG>, <STRONG>$</STRONG>, <STRONG><FONT SIZE=+1><SUB>`</SUB></FONT></STRONG>.
2N/AIf <STRONG>&#045; </STRONG>is appended to <STRONG>&lt;&lt;</STRONG>, then all leading tabs are stripped from <EM>word </EM>and
2N/Afrom the document.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&lt;&amp;</STRONG><EM>digit </EM>
2N/A<DD>The standard input is duplicated from file descriptor <EM>digit </EM>(see <A HREF="dup(2)"><EM>dup</EM>(2)</A>).
2N/ASimilarly for the standard output using <STRONG>&gt;&amp;&nbsp;</STRONG><EM>digit</EM>.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&lt;&amp;</STRONG><EM>digit</EM><STRONG>&#045; </STRONG>
2N/A<DD>The file descriptor given by <EM>digit </EM>is moved to standard input.
2N/ASimilarly for the standard output using <STRONG>&gt;&amp;&nbsp;</STRONG><EM>digit</EM><STRONG>&#045;</STRONG>.
2N/A<STRONG><P>
2N/A<DT>
2N/A&lt;&amp;&#045; </STRONG>
2N/A<DD>The standard input is closed.
2N/ASimilarly for the standard output using <STRONG>&gt;&amp;&#045;</STRONG>.
2N/A<STRONG><P>
2N/A<DT>
2N/A&lt;&amp;p </STRONG>
2N/A<DD>The input from the co-process is moved to standard input.
2N/A<STRONG><P>
2N/A<DT>
2N/A&gt;&amp;p </STRONG>
2N/A<DD>The output to the co-process is moved to standard output.
2N/A</DL>
2N/A<P>
2N/AIf one of the above is preceded by a digit, then the file descriptor number
2N/Areferred to is that specified by the digit (instead of the default 0 or
2N/A1).
2N/AFor example: <DL COMPACT><STRONG><P>
2N/A.&nbsp;.&nbsp;.
2N/A&nbsp;2&gt;&amp;1</STRONG> </DL>
2N/A<P>
2N/Ameans file descriptor 2 is to be opened for writing as a duplicate of file
2N/Adescriptor 1.
2N/A<P>
2N/AThe order in which redirections are specified is significant.
2N/AThe shell evaluates each redirection in terms of the (<EM>file descriptor</EM>,
2N/A<EM>file</EM>) association at the time of evaluation.
2N/AFor example: <DL COMPACT><STRONG><P>
2N/A.&nbsp;.&nbsp;.
2N/A&nbsp;1&gt;</STRONG><EM>fname&nbsp;</EM><STRONG> 2&gt;&amp;1</STRONG> </DL>
2N/A<P>
2N/Afirst associates file descriptor 1 with file <EM>fname&nbsp;</EM>.
2N/AIt then associates file descriptor 2 with the file associated with file
2N/Adescriptor 1 (i.e.
2N/A<EM>fname&nbsp;</EM>).
2N/AIf the order of redirections were reversed, file descriptor 2 would be
2N/Aassociated with the terminal (assuming file descriptor 1 had been) and
2N/Athen file descriptor 1 would be associated with file <EM>fname&nbsp;</EM>.
2N/A<P>
2N/AIf a command is followed by <STRONG>&amp; </STRONG>and job control is not active, then the default
2N/Astandard input for the command is the empty file <STRONG>/dev/null</STRONG>.
2N/AOtherwise, the environment for the execution of a command contains the
2N/Afile descriptors of the invoking shell as modified by input/output specifications.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Environment">Environment.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The <EM>environment </EM>(see <A HREF="environ(7)"><EM>environ</EM>(7)</A>) is a list of name-value pairs that is
2N/Apassed to an executed program in the same way as a normal argument list.
2N/AThe names must be <EM>identifiers </EM>and the values are character strings.
2N/AThe shell interacts with the environment in several ways.
2N/AOn invocation, the shell scans the environment and creates a variable for
2N/Aeach name found, giving it the corresponding value and attributes and marking
2N/Ait <EM>export</EM>.
2N/AExecuted commands inherit the environment.
2N/AIf the user modifies the values of these variables or creates new ones,
2N/Ausing the <STRONG>export </STRONG>or <STRONG>typeset &#045;x </STRONG>commands, they become part of the environment.
2N/AThe environment seen by any executed command is thus composed of any name-value
2N/Apairs originally inherited by the shell, whose values may be modified by
2N/Athe current shell, plus any additions which must be noted in <STRONG>export </STRONG>or
2N/A<STRONG>typeset &#045;x </STRONG>commands.
2N/A<P>
2N/AThe environment for any <EM>simple-command </EM>or function may be augmented by
2N/Aprefixing it with one or more variable assignments.
2N/AA variable assignment argument is a word of the form <EM>identifier=value</EM>.
2N/AThus: <DL COMPACT><STRONG><FONT SIZE=-1><P>
2N/ATERM</FONT>=450 &nbsp;cmd &nbsp;args</STRONG> and <STRONG><BR>
2N/A(export &nbsp;<FONT SIZE=-1>TERM</FONT>; &nbsp;<FONT SIZE=-1>TERM</FONT>=450; &nbsp;cmd &nbsp;args)</STRONG> </DL>
2N/A<P>
2N/Aare equivalent (as far as the above execution of <EM>cmd </EM>is concerned except
2N/Afor special built-in commands listed below &#045; those that are preceded with
2N/Aa dagger).
2N/A<P>
2N/AIf the obsolete <STRONG>&#045;k </STRONG>option is set, <EM>all </EM>variable assignment arguments are
2N/Aplaced in the environment, even if they occur after the command name.
2N/AThe following first prints <STRONG>a=b c </STRONG>and then <STRONG>c</STRONG>: <PRE>
2N/A<DL COMPACT><STRONG> echo &nbsp;a=b &nbsp;c
2N/A set &nbsp;&#045;k
2N/A echo &nbsp;a=b &nbsp;c
2N/A</STRONG></DL></PRE>This feature is intended for use with scripts written for early versions
2N/Aof the shell and its use in new scripts is strongly discouraged.
2N/AIt is likely to disappear someday.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Functions">Functions.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>For historical reasons, there are two ways to define functions, the <EM>name</EM><STRONG>(&nbsp;)
2N/A</STRONG>syntax and the <STRONG>function </STRONG><EM>name </EM>syntax, described in the <EM>Commands </EM>section
2N/Aabove.
2N/AShell functions are read in and stored internally.
2N/AAlias names are resolved when the function is read.
2N/AFunctions are executed like commands with the arguments passed as positional
2N/Aparameters.
2N/A(See <EM>Execution </EM>below.) <P>
2N/AFunctions defined by the <STRONG>function </STRONG><EM>name </EM>syntax and called by name execute
2N/Ain the same process as the caller and share all files and present working
2N/Adirectory with the caller.
2N/ATraps caught by the caller are reset to their default action inside the
2N/Afunction.
2N/AA trap condition that is not caught or ignored by the function causes the
2N/Afunction to terminate and the condition to be passed on to the caller.
2N/AA trap on <FONT SIZE=-1><STRONG>EXIT </STRONG></FONT>set inside a function is executed in the environment of
2N/Athe caller after the function completes.
2N/AOrdinarily, variables are shared between the calling program and the function.
2N/AHowever, the <STRONG>typeset </STRONG>special built-in command used within a function defines
2N/Alocal variables whose scope includes the current function and all functions
2N/Ait calls.
2N/AErrors within functions return control to the caller.
2N/A<P>
2N/AFunctions defined with the <EM>name</EM><STRONG>(&nbsp;) </STRONG>syntax and functions defined with the
2N/A<STRONG>function </STRONG><EM>name </EM>syntax that are invoked with the <STRONG><FONT SIZE=+1>.</FONT></STRONG> special built-in are executed
2N/Ain the caller's environment and share all variables and traps with the
2N/Acaller.
2N/AErrors within these function executions cause the script that contains
2N/Athem to abort.
2N/A<P>
2N/AThe special built-in command <STRONG>return </STRONG>is used to return from function calls.
2N/A<P>
2N/AFunction names can be listed with the <STRONG>&#045;f </STRONG>or <STRONG>+f </STRONG>option of the <STRONG>typeset </STRONG>special
2N/Abuilt-in command.
2N/AThe text of functions, when available, will also be listed with <STRONG>&#045;f</STRONG>.
2N/AFunctions can be undefined with the <STRONG>&#045;f </STRONG>option of the <STRONG>unset </STRONG>special built-in
2N/Acommand.
2N/A<P>
2N/AOrdinarily, functions are unset when the shell executes a shell script.
2N/AFunctions that need to be defined across separate invocations of the shell
2N/Ashould be placed in a directory and the <STRONG><FONT SIZE=-1>FPATH </FONT></STRONG>variable should contain the
2N/Aname of this directory.
2N/AThey may also be specified in the <STRONG><FONT SIZE=-1>ENV </FONT></STRONG>file.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Discipline Functions">Discipline &nbsp;Functions.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Each variable can have zero or more discipline functions associated with
2N/Ait.
2N/AThe shell initially understands the discipline names <STRONG>get</STRONG>, <STRONG>set</STRONG>, and <STRONG>unset</STRONG>
2N/Abut on most systems others can be added at run time via the C programming
2N/Ainterface extension provided by the <STRONG>builtin </STRONG>built-in utility.
2N/AIf the <STRONG>get</STRONG> discipline is defined for a variable, it is invoked whenever
2N/Athe given variable is referenced.
2N/AIf the variable <STRONG>.sh.value</STRONG> is assigned a value inside the discipline function,
2N/Athe referenced variable will evaluate to this value instead.
2N/AIf the <STRONG>set</STRONG> discipline is defined for a variable, it is invoked whenever
2N/Athe given variable is assigned a value.
2N/AThe variable <STRONG>.sh.value</STRONG> is given the value of the variable before invoking
2N/Athe discipline, and the variable will be assigned the value of <STRONG>.sh.value</STRONG>
2N/Aafter the discipline completes.
2N/AIf <STRONG>.sh.value</STRONG> is unset inside the discipline, then that value is unchanged.
2N/AIf the <STRONG>unset</STRONG> discipline is defined for a variable, it is invoked whenever
2N/Athe given variable is unset.
2N/AThe variable will not be unset unless it is unset explicitly from within
2N/Athis discipline function.
2N/A<P>
2N/AThe variable <STRONG>.sh.name </STRONG>contains the name of the variable for which the discipline
2N/Afunction is called, <STRONG>.sh.subscript </STRONG>is the subscript of the variable, and
2N/A<STRONG>.sh.value </STRONG>will contain the value being assigned inside the <STRONG>.set </STRONG>discipline
2N/Afunction.
2N/AFor the <STRONG>set</STRONG> discipline, changing <STRONG>.sh.value </STRONG>will change the value that gets
2N/Aassigned.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Jobs">Jobs.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>If the <STRONG>monitor </STRONG>option of the <STRONG>set </STRONG>command is turned on, an interactive shell
2N/Aassociates a <EM>job</EM> with each pipeline.
2N/AIt keeps a table of current jobs, printed by the <STRONG>jobs </STRONG>command, and assigns
2N/Athem small integer numbers.
2N/AWhen a job is started asynchronously with <STRONG>&amp;</STRONG>, the shell prints a line which
2N/Alooks like: <P>
2N/A[1] 1234 <P>
2N/Aindicating that the job which was started asynchronously was job number
2N/A1 and had one (top-level) process, whose process id was 1234.
2N/A<P>
2N/AThis paragraph and the next require features that are not in all versions
2N/Aof UNIX and may not apply.
2N/AIf you are running a job and wish to do something else you may hit the
2N/Akey <STRONG>^Z</STRONG> (control-Z) which sends a STOP signal to the current job.
2N/AThe shell will then normally indicate that the job has been `Stopped',
2N/Aand print another prompt.
2N/AYou can then manipulate the state of this job, putting it in the background
2N/Awith the <STRONG>bg </STRONG>command, or run some other commands and then eventually bring
2N/Athe job back into the foreground with the foreground command <STRONG>fg</STRONG>.
2N/AA <STRONG>^Z</STRONG> takes effect immediately and is like an interrupt in that pending
2N/Aoutput and unread input are discarded when it is typed.
2N/A<P>
2N/AA job being run in the background will stop if it tries to read from the
2N/Aterminal.
2N/ABackground jobs are normally allowed to produce output, but this can be
2N/Adisabled by giving the command <STRONG>stty tostop</STRONG>.
2N/AIf you set this tty option, then background jobs will stop when they try
2N/Ato produce output like they do when they try to read input.
2N/A<P>
2N/AThere are several ways to refer to jobs in the shell.
2N/AA job can be referred to by the process id of any process of the job or
2N/Aby one of the following:
2N/A<DL COMPACT>
2N/A<DT>
2N/A<STRONG>%</STRONG><EM>number </EM>
2N/A<DD>The job with the given number.
2N/A<DT>
2N/A<STRONG>%</STRONG><EM>string </EM>
2N/A<DD>Any job whose command line begins with <EM>string</EM>.
2N/A<DT>
2N/A<STRONG>%?</STRONG><EM>string </EM>
2N/A<DD>Any job whose command line contains <EM>string</EM>.
2N/A<DT>
2N/A<STRONG>%% </STRONG>
2N/A<DD>Current job.
2N/A<DT>
2N/A<STRONG>%+ </STRONG>
2N/A<DD>Equivalent to <STRONG>%%</STRONG>.
2N/A<DT>
2N/A<STRONG>%&#045; </STRONG>
2N/A<DD>Previous job.
2N/A</DL>
2N/A<P>
2N/AThe shell learns immediately whenever a process changes state.
2N/AIt normally informs you whenever a job becomes blocked so that no further
2N/Aprogress is possible, but only just before it prints a prompt.
2N/AThis is done so that it does not otherwise disturb your work.
2N/AThe <STRONG>notify </STRONG>option of the <STRONG>set </STRONG>command causes the shell to print these job
2N/Achange messages as soon as they occur.
2N/A<P>
2N/AWhen the <STRONG>monitor </STRONG>option is on, each background job that completes triggers
2N/Aany trap set for <STRONG>CHLD</STRONG>.
2N/A<P>
2N/AWhen you try to leave the shell while jobs are running or stopped, you
2N/Awill be warned that `You have stopped(running) jobs.' You may use the <STRONG>jobs
2N/A</STRONG>command to see what they are.
2N/AIf you immediately try to exit again, the shell will not warn you a second
2N/Atime, and the stopped jobs will be terminated.
2N/AWhen a login shell receives a HUP signal, it sends a HUP signal to each
2N/Ajob that has not been disowned with the <STRONG>disown </STRONG>built-in command described
2N/Abelow.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Signals">Signals.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The <FONT SIZE=-1>INT</FONT> and <FONT SIZE=-1>QUIT</FONT> signals for an invoked command are ignored if the command
2N/Ais followed by <STRONG>&amp; </STRONG>and the <STRONG>monitor </STRONG>option is not active.
2N/AOtherwise, signals have the values inherited by the shell from its parent
2N/A(but see also the <STRONG>trap </STRONG>built-in command below).
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Execution">Execution.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Each time a command is read, the above substitutions are carried out.
2N/AIf the command name matches one of the <EM>Special Built-in Commands </EM>listed
2N/Abelow, it is executed within the current shell process.
2N/ANext, the command name is checked to see if it matches a user defined function.
2N/AIf it does, the positional parameters are saved and then reset to the arguments
2N/Aof the <EM>function </EM>call.
2N/AA function is also executed in the current shell process.
2N/AWhen the <EM>function </EM>completes or issues a <STRONG>return</STRONG>, the positional parameter
2N/Alist is restored.
2N/AFor functions defined with the <STRONG>function </STRONG><EM>name </EM>syntax, any trap set on <FONT SIZE=-1><STRONG>EXIT
2N/A</STRONG></FONT>within the function is executed.
2N/AThe exit value of a <EM>function </EM>is the value of the last command executed.
2N/AIf a command name is not a <EM>special built-in command </EM>or a user defined <EM>function</EM>,
2N/Abut it is one of the built-in commands listed below, it is executed in
2N/Athe current shell process.
2N/A<P>
2N/AThe shell variable <STRONG><FONT SIZE=-1>PATH </FONT></STRONG>defines the search path for the directory containing
2N/Athe command.
2N/AAlternative directory names are separated by a colon (<STRONG>:</STRONG>).
2N/AThe default path is <STRONG>/bin:/usr/bin: </STRONG>(specifying <STRONG>/bin</STRONG>, <STRONG>/usr/bin</STRONG>, and the
2N/Acurrent directory in that order).
2N/AThe current directory can be specified by two or more adjacent colons,
2N/Aor by a colon at the beginning or end of the path list.
2N/AIf the command name contains a <STRONG>/</STRONG>, then the search path is not used.
2N/AOtherwise, each directory in the path is searched for an executable file
2N/Athat is not a directory.
2N/AIf the shell determines that there is a built-in version of a command corresponding
2N/Ato a given pathname, this built-in is invoked in the current process.
2N/AA process is created and an attempt is made to execute the command via
2N/A<EM>exec</EM>(2).
2N/AIf the file has execute permission but is not an <STRONG>a.out </STRONG>file, it is assumed
2N/Ato be a file containing shell commands.
2N/AA separate shell is spawned to read it.
2N/AAll non-exported variables are removed in this case.
2N/AIf the shell command file doesn't have read permission, or if the <EM>setuid
2N/A</EM>and/or <EM>setgid </EM>bits are set on the file, then the shell executes an agent
2N/Awhose job it is to set up the permissions and execute the shell with the
2N/Ashell command file passed down as an open file.
2N/AA parenthesized command is executed in a sub-shell without removing non-exported
2N/Avariables.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Command Re-entry">Command &nbsp;Re-entry.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The text of the last <STRONG><FONT SIZE=-1>HISTSIZE </FONT></STRONG>(default 128) commands entered from a terminal
2N/Adevice is saved in a <EM>history </EM>file.
2N/AThe file <STRONG><FONT SIZE=-1>$HOME</FONT>/.sh_history </STRONG>is used if the <STRONG><FONT SIZE=-1>HISTFILE </FONT></STRONG>variable is not set
2N/Aor if the file it names is not writable.
2N/AA shell can access the commands of all <EM>interactive </EM>shells which use the
2N/Asame named <FONT SIZE=-1><STRONG>HISTFILE</STRONG>.
2N/A</FONT>The built-in command <STRONG>hist </STRONG>is used to list or edit a portion of this file.
2N/AThe portion of the file to be edited or listed can be selected by number
2N/Aor by giving the first character or characters of the command.
2N/AA single command or range of commands can be specified.
2N/AIf you do not specify an editor program as an argument to <STRONG>hist </STRONG>then the
2N/Avalue of the variable <FONT SIZE=-1><STRONG>HISTEDIT </STRONG></FONT>is used.
2N/AIf <FONT SIZE=-1><STRONG>HISTEDIT </STRONG></FONT>is unset, the obsolete variable <FONT SIZE=-1><STRONG>FCEDIT </STRONG></FONT>is used.
2N/AIf <FONT SIZE=-1><STRONG>FCEDIT </STRONG></FONT>is not defined, then <STRONG>/bin/ed </STRONG>is used.
2N/AThe edited command(s) is printed and re-executed upon leaving the editor
2N/Aunless you quit without writing.
2N/AThe <STRONG>&#045;s </STRONG>option (and in obsolete versions, the editor name <STRONG>&#045;&nbsp;</STRONG>) is used to
2N/Askip the editing phase and to re-execute the command.
2N/AIn this case a substitution parameter of the form <EM>old</EM><STRONG>=</STRONG><EM>new</EM> can be used to
2N/Amodify the command before execution.
2N/AFor example, with the preset alias <STRONG>r</STRONG>, which is aliased to <STRONG>'hist &#045;s'</STRONG>, typing
2N/A`<STRONG>r bad=good c</STRONG>' will re-execute the most recent command which starts with
2N/Athe letter <STRONG>c</STRONG>, replacing the first occurrence of the string <STRONG>bad </STRONG>with the
2N/Astring <STRONG>good</STRONG>.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="In-line Editing Options">In-line &nbsp;Editing &nbsp;Options.
2N/A&nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Normally, each command line entered from a terminal device is simply typed
2N/Afollowed by a <STRONG>new-line</STRONG> (`RETURN' or `LINE&nbsp;FEED').
2N/AIf either the <STRONG>emacs</STRONG>, <STRONG>gmacs</STRONG>, or <STRONG>vi </STRONG>option is active, the user can edit the
2N/Acommand line.
2N/ATo be in either of these edit modes <STRONG>set </STRONG>the corresponding option.
2N/AAn editing option is automatically selected each time the <FONT SIZE=-1><STRONG>VISUAL </STRONG></FONT>or <FONT SIZE=-1><STRONG>EDITOR
2N/A</STRONG></FONT>variable is assigned a value ending in either of these option names.
2N/A<P>
2N/AThe editing features require that the user's terminal accept `RETURN' as
2N/Acarriage return without line feed and that a space (`&nbsp;') must overwrite
2N/Athe current character on the screen.
2N/A<P>
2N/AThe editing modes implement a concept where the user is looking through
2N/Aa window at the current line.
2N/AThe window width is the value of <FONT SIZE=-1><STRONG>COLUMNS </STRONG></FONT>if it is defined, otherwise 80.
2N/AIf the window width is too small to display the prompt and leave at least
2N/A8 columns to enter input, the prompt is truncated from the left.
2N/AIf the line is longer than the window width minus two, a mark is displayed
2N/Aat the end of the window to notify the user.
2N/AAs the cursor moves and reaches the window boundaries the window will be
2N/Acentered about the cursor.
2N/AThe mark is a <STRONG>&gt;</STRONG> (&lt;<STRONG>, </STRONG><STRONG>*</STRONG>) if the line extends on the right (left, both) side(s)
2N/Aof the window.
2N/A<P>
2N/AThe search commands in each edit mode provide access to the history file.
2N/AOnly strings are matched, not patterns, although a leading <STRONG>^ </STRONG>in the string
2N/Arestricts the match to begin at the first character in the line.
2N/A<P>
2N/AEach of the edit modes has an operation to list the files or commands that
2N/Amatch a partially entered word.
2N/AWhen applied to the first word on the line, or the first word after a <STRONG>;</STRONG>,
2N/A<STRONG>|</STRONG>, <STRONG>&amp;</STRONG>, or <STRONG>(</STRONG>, and the word does not begin with <STRONG>~ </STRONG>or contain a <STRONG>/</STRONG>, the list
2N/Aof aliases, functions, and executable commands defined by the <STRONG><FONT SIZE=-1>PATH </FONT></STRONG>variable
2N/Athat could match the partial word is displayed.
2N/AOtherwise, the list of files that match the given word is displayed.
2N/AIf the partially entered word does not contain any file expansion characters,
2N/Aa <STRONG>* </STRONG>is appended before generating these lists.
2N/AAfter displaying the generated list, the input line is redrawn.
2N/AThese operations are called command name listing and file name listing,
2N/Arespectively.
2N/AThere are additional operations, referred to as command name completion
2N/Aand file name completion, which compute the list of matching commands or
2N/Afiles, but instead of printing the list, replace the current word with
2N/Aa complete or partial match.
2N/AFor file name completion, if the match is unique, a <STRONG>/ </STRONG>is appended if the
2N/Afile is a directory and a space is appended if the file is not a directory.
2N/AOtherwise, the longest common prefix for all the matching files replaces
2N/Athe word.
2N/AFor command name completion, only the portion of the file names after the
2N/Alast <STRONG>/ </STRONG>are used to find the longest command prefix.
2N/AIf only a single name matches this prefix, then the word is replaced with
2N/Athe command name followed by a space.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Key Bindings">Key &nbsp;Bindings.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The <STRONG><FONT SIZE=-1>KEYBD </FONT></STRONG>trap can be used to intercept keys as they are typed and change
2N/Athe characters that are actually seen by the shell.
2N/AThis trap is executed after each character (or sequence of characters when
2N/Athe first character is ESC) is entered while reading from a terminal.
2N/AThe variable <STRONG>.sh.edchar </STRONG>contains the character or character sequence which
2N/Agenerated the trap.
2N/AChanging the value of <STRONG>.sh.edchar </STRONG>in the trap action causes the shell to
2N/Abehave as if the new value were entered from the keyboard rather than the
2N/Aoriginal value.
2N/A<P>
2N/AThe variable <STRONG>.sh.edcol </STRONG>is set to the input column number of the cursor
2N/Aat the time of the input.
2N/AThe variable <STRONG>.sh.edmode </STRONG>is set to ESC when in <STRONG>vi </STRONG>insert mode (see below)
2N/Aand is null otherwise.
2N/ABy prepending <STRONG>${.sh.editmode} </STRONG>to a value assigned to <STRONG>.sh.edchar </STRONG>it will
2N/Acause the shell to change to control mode if it is not already in this
2N/Amode.
2N/A<P>
2N/AThis trap is not invoked for characters entered as arguments to editing
2N/Adirectives, or while reading input for a character search.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Emacs Editing Mode">Emacs &nbsp;Editing &nbsp;Mode.
2N/A&nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>This mode is entered by enabling either the <STRONG>emacs </STRONG>or <STRONG>gmacs </STRONG>option.
2N/AThe only difference between these two modes is the way they handle <STRONG>^T</STRONG>.
2N/ATo edit, the user moves the cursor to the point needing correction and
2N/Athen inserts or deletes characters or words as needed.
2N/AAll the editing commands are control characters or escape sequences.
2N/AThe notation for control characters is caret (<STRONG>^</STRONG>) followed by the character.
2N/AFor example, <STRONG>^F </STRONG>is the notation for control <STRONG>F</STRONG>.
2N/AThis is entered by depressing `f' while holding down the `CTRL' (control)
2N/Akey.
2N/AThe `SHIFT' key is <EM>not </EM>depressed.
2N/A(The notation <STRONG>^? </STRONG>indicates the DEL (delete) key.) <P>
2N/AThe notation for escape sequences is <STRONG>M- </STRONG>followed by a character.
2N/AFor example, <STRONG>M-f </STRONG>(pronounced Meta f) is entered by depressing ESC (ascii
2N/A<STRONG>033</STRONG>) followed by `f'.
2N/A(<STRONG>M-F </STRONG>would be the notation for ESC followed by `SHIFT' (capital) `F'.)
2N/A<P>
2N/AAll edit commands operate from any place on the line (not just at the beginning).
2N/ANeither the `RETURN' nor the `LINE FEED' key is entered after edit commands
2N/Aexcept when noted.
2N/A<DL COMPACT>
2N/A<P>
2N/A<DT>
2N/A<STRONG>^F </STRONG>
2N/A<DD>Move cursor forward (right) one character.
2N/A<DT>
2N/A<STRONG>M-f </STRONG>
2N/A<DD>Move cursor forward one word.
2N/A(The <STRONG>emacs </STRONG>editor's idea of a word is a string of characters consisting
2N/Aof only letters, digits and underscores.)
2N/A<DT>
2N/A<STRONG>^B </STRONG>
2N/A<DD>Move cursor backward (left) one character.
2N/A<DT>
2N/A<STRONG>M-b </STRONG>
2N/A<DD>Move cursor backward one word.
2N/A<DT>
2N/A<STRONG>^A </STRONG>
2N/A<DD>Move cursor to start of line.
2N/A<DT>
2N/A<STRONG>^E </STRONG>
2N/A<DD>Move cursor to end of line.
2N/A<DT>
2N/A<STRONG>^]</STRONG><EM>char </EM>
2N/A<DD>Move cursor forward to character <EM>char </EM>on current line.
2N/A<DT>
2N/A<STRONG>M-^]</STRONG><EM>char </EM>
2N/A<DD>Move cursor backward to character <EM>char </EM>on current line.
2N/A<DT>
2N/A<STRONG>^X^X </STRONG>
2N/A<DD>Interchange the cursor and mark.
2N/A<EM><DT>
2N/Aerase </EM>
2N/A<DD>(User defined erase character as defined by the <EM>stty</EM>(1) command, usually
2N/A<STRONG>^H </STRONG>or <STRONG>#</STRONG>.) Delete previous character.
2N/A<DT>
2N/A<STRONG>^D </STRONG>
2N/A<DD>Delete current character.
2N/A<DT>
2N/A<STRONG>M-d </STRONG>
2N/A<DD>Delete current word.
2N/A<DT>
2N/A<STRONG>M-^H </STRONG>
2N/A<DD>(Meta-backspace) Delete previous word.
2N/A<DT>
2N/A<STRONG>M-h </STRONG>
2N/A<DD>Delete previous word.
2N/A<DT>
2N/A<STRONG>M-^? </STRONG>
2N/A<DD>(Meta-DEL) Delete previous word (if your interrupt character is <STRONG>^? </STRONG>(DEL,
2N/Athe default) then this command will not work).
2N/A<DT>
2N/A<STRONG>^T </STRONG>
2N/A<DD>Transpose current character with previous character and advance the cursor
2N/Ain <EM>emacs </EM>mode.
2N/ATranspose two previous characters in <EM>gmacs </EM>mode.
2N/A<DT>
2N/A<STRONG>^C </STRONG>
2N/A<DD>Capitalize current character.
2N/A<DT>
2N/A<STRONG>M-c </STRONG>
2N/A<DD>Capitalize current word.
2N/A<DT>
2N/A<STRONG>M-l </STRONG>
2N/A<DD>Change the current word to lower case.
2N/A<DT>
2N/A<STRONG>^K </STRONG>
2N/A<DD>Delete from the cursor to the end of the line.
2N/AIf preceded by a numerical parameter whose value is less than the current
2N/Acursor position, then delete from given position up to the cursor.
2N/AIf preceded by a numerical parameter whose value is greater than the current
2N/Acursor position, then delete from cursor up to given cursor position.
2N/A<DT>
2N/A<STRONG>^W </STRONG>
2N/A<DD>Kill from the cursor to the mark.
2N/A<DT>
2N/A<STRONG>M-p </STRONG>
2N/A<DD>Push the region from the cursor to the mark on the stack.
2N/A<EM><DT>
2N/Akill </EM>
2N/A<DD>(User defined kill character as defined by the stty command, usually <STRONG>^G
2N/A</STRONG>or <STRONG>@</STRONG>.) Kill the entire current line.
2N/AIf two <EM>kill </EM>characters are entered in succession, all kill characters from
2N/Athen on cause a line feed (useful when using paper terminals).
2N/A<DT>
2N/A<STRONG>^Y </STRONG>
2N/A<DD>Restore last item removed from line.
2N/A(Yank item back to the line.)
2N/A<DT>
2N/A<STRONG>^L </STRONG>
2N/A<DD>Line feed and print current line.
2N/A<DT>
2N/A<STRONG>^@ </STRONG>
2N/A<DD>(Null character) Set mark.
2N/A<DT>
2N/A<STRONG>M-</STRONG><EM>space </EM>
2N/A<DD>(Meta space) Set mark.
2N/A<DT>
2N/A<STRONG>^J </STRONG>
2N/A<DD>(New&nbsp;line) Execute the current line.
2N/A<DT>
2N/A<STRONG>^M </STRONG>
2N/A<DD>(Return) Execute the current line.
2N/A<EM><DT>
2N/Aeof </EM>
2N/A<DD>End-of-file character, normally <STRONG>^D</STRONG>, is processed as an End-of-file only
2N/Aif the current line is null.
2N/A<DT>
2N/A<STRONG>^P </STRONG>
2N/A<DD>Fetch previous command.
2N/AEach time <STRONG>^P </STRONG>is entered the previous command back in time is accessed.
2N/AMoves back one line when not on the first line of a multi-line command.
2N/A<DT>
2N/A<STRONG>M-&lt; </STRONG>
2N/A<DD>Fetch the least recent (oldest) history line.
2N/A<DT>
2N/A<STRONG>M-&gt; </STRONG>
2N/A<DD>Fetch the most recent (youngest) history line.
2N/A<DT>
2N/A<STRONG>^N </STRONG>
2N/A<DD>Fetch next command line.
2N/AEach time <STRONG>^N </STRONG>is entered the next command line forward in time is accessed.
2N/A<DT>
2N/A<STRONG>^R</STRONG><EM>string </EM>
2N/A<DD>Reverse search history for a previous command line containing <EM>string</EM>.
2N/AIf a parameter of zero is given, the search is forward.
2N/A<EM>String </EM>is terminated by a `RETURN' or `NEW&nbsp;LINE'.
2N/AIf string is preceded by a <STRONG>^</STRONG>, the matched line must begin with <EM>string</EM>.
2N/AIf <EM>string </EM>is omitted, then the next command line containing the most recent
2N/A<EM>string </EM>is accessed.
2N/AIn this case a parameter of zero reverses the direction of the search.
2N/A<STRONG><DT>
2N/A^O </STRONG>
2N/A<DD>Operate &#045; Execute the current line and fetch the next line relative to
2N/Acurrent line from the history file.
2N/A<DT>
2N/A<STRONG>M-</STRONG><EM>digits </EM>
2N/A<DD>(Escape) Define numeric parameter, the digits are taken as a parameter
2N/Ato the next command.
2N/AThe commands that accept a parameter are <STRONG>^F</STRONG>, <STRONG>^B</STRONG>, <EM>erase</EM>, <STRONG>^C</STRONG>, <STRONG>^D</STRONG>, <STRONG>^K</STRONG>, <STRONG>^R</STRONG>,
2N/A<STRONG>^P</STRONG>, <STRONG>^N</STRONG>, <STRONG>^]</STRONG>, <STRONG>M-.</STRONG>, <STRONG>M-^]</STRONG>, <STRONG>M-_</STRONG>, <STRONG>M-b</STRONG>, <STRONG>M-c</STRONG>, <STRONG>M-d</STRONG>, <STRONG>M-f</STRONG>, <STRONG>M-h</STRONG>, <STRONG>M-l </STRONG>and <STRONG>M-^H</STRONG>.
2N/A<DT>
2N/A<STRONG>M-</STRONG><EM>letter </EM>
2N/A<DD>Soft-key &#045; Your alias list is searched for an alias by the name <STRONG>_</STRONG><EM>letter
2N/A</EM>and if an alias of this name is defined, its value will be inserted on
2N/Athe input queue.
2N/AThe <EM>letter </EM>must not be one of the above meta-functions.
2N/A<DT>
2N/A<STRONG>M-[</STRONG><EM>letter </EM>
2N/A<DD>Soft-key &#045; Your alias list is searched for an alias by the name <STRONG>__</STRONG><EM>letter
2N/A</EM>and if an alias of this name is defined, its value will be inserted on
2N/Athe input queue.
2N/AThe can be used to program functions keys on many terminals.
2N/A<STRONG><DT>
2N/AM-.
2N/A</STRONG><DD>The last word of the previous command is inserted on the line.
2N/AIf preceded by a numeric parameter, the value of this parameter determines
2N/Awhich word to insert rather than the last word.
2N/A<STRONG><DT>
2N/AM-_ </STRONG>
2N/A<DD>Same as <STRONG>M-.</STRONG>.
2N/A<STRONG><DT>
2N/AM-* </STRONG>
2N/A<DD>Attempt file name generation on the current word.
2N/AAn asterisk is appended if the word doesn't match any file or contain any
2N/Aspecial pattern characters.
2N/A<STRONG><DT>
2N/AM-ESC </STRONG>
2N/A<DD>Command or file name completion as described above.
2N/A<STRONG><DT>
2N/AM-= </STRONG>
2N/A<DD>Command or file name listing as described above.
2N/A<DT>
2N/A<STRONG>^U </STRONG>
2N/A<DD>Multiply parameter of next command by 4.
2N/A<DT>
2N/A<STRONG>&#092; </STRONG>
2N/A<DD>Escape next character.
2N/AEditing characters, the user's erase, kill and interrupt (normally <STRONG>^?</STRONG>)
2N/Acharacters may be entered in a command line or in a search string if preceded
2N/Aby a <STRONG>&#092;</STRONG>.
2N/AThe <STRONG>&#092; </STRONG>removes the next character's editing features (if any).
2N/A<STRONG><DT>
2N/A^V </STRONG>
2N/A<DD>Display version of the shell.
2N/A<STRONG><DT>
2N/AM-# </STRONG>
2N/A<DD>If the line does not begin with a <STRONG>#</STRONG>, a <STRONG># </STRONG>is inserted at the beginning of
2N/Athe line and after each new-line, and the line is entered.
2N/AThis causes a comment to be inserted in the history file.
2N/AIf the line begins with a <STRONG>#</STRONG>, the <STRONG># </STRONG>is deleted and one <STRONG># </STRONG>after each new-line
2N/Ais also deleted.
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Vi Editing Mode">Vi &nbsp;Editing &nbsp;Mode.
2N/A&nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>There are two typing modes.
2N/AInitially, when you enter a command you are in the <EM>input </EM>mode.
2N/ATo edit, the user enters <EM>control </EM>mode by typing ESC (<STRONG>033</STRONG>) and moves the
2N/Acursor to the point needing correction and then inserts or deletes characters
2N/Aor words as needed.
2N/AMost control commands accept an optional repeat <EM>count </EM>prior to the command.
2N/A<P>
2N/AWhen in <STRONG>vi </STRONG>mode on most systems, canonical processing is initially enabled
2N/Aand the command will be echoed again if the speed is 1200 baud or greater
2N/Aand it contains any control characters or less than one second has elapsed
2N/Asince the prompt was printed.
2N/AThe ESC character terminates canonical processing for the remainder of
2N/Athe command and the user can then modify the command line.
2N/AThis scheme has the advantages of canonical processing with the type-ahead
2N/Aechoing of raw mode.
2N/A<P>
2N/AIf the option <STRONG>viraw </STRONG>is also set, the terminal will always have canonical
2N/Aprocessing disabled.
2N/AThis mode is implicit for systems that do not support two alternate end
2N/Aof line delimiters, and may be helpful for certain terminals.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Input Edit Commands">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Input Edit Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><DL COMPACT>
2N/ABy default the editor is in input mode.
2N/A<DL COMPACT><EM><DT>
2N/Aerase </EM>
2N/A<DD>(User defined erase character as defined by the stty command, usually <STRONG>^H
2N/A</STRONG>or <STRONG>#</STRONG>.) Delete previous character.
2N/A<DT>
2N/A<STRONG>^W </STRONG>
2N/A<DD>Delete the previous blank separated word.
2N/AOn some systems the <STRONG>viraw</STRONG> option may be required for this to work.
2N/A<EM><DT>
2N/Aeof </EM>
2N/A<DD>As the first character of the line causes the shell to terminate unless
2N/Athe <STRONG>ignoreeof</STRONG> option is set.
2N/AOtherwise this character is ignored.
2N/A<DT>
2N/A<STRONG>^V </STRONG>
2N/A<DD>Escape next character.
2N/AEditing characters and the user's erase or kill characters may be entered
2N/Ain a command line or in a search string if preceded by a <STRONG>^V</STRONG>.
2N/AThe <STRONG>^V </STRONG>removes the next character's editing features (if any).
2N/AOn some systems the <STRONG>viraw</STRONG> option may be required for this to work.
2N/A<DT>
2N/A<STRONG>&#092; </STRONG>
2N/A<DD>Escape the next <EM>erase </EM>or <EM>kill </EM>character.
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><DT>
2N/A<H3><A NAME="Motion Edit Commands">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Motion Edit Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><DL COMPACT>
2N/AThese commands will move the cursor.
2N/A<DL COMPACT>
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>l</STRONG>
2N/A<DD>Cursor forward (right) one character.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>w</STRONG>
2N/A<DD>Cursor forward one alpha-numeric word.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>W</STRONG>
2N/A<DD>Cursor to the beginning of the next word that follows a blank.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>e</STRONG>
2N/A<DD>Cursor to end of word.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>E</STRONG>
2N/A<DD>Cursor to end of the current blank delimited word.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>h</STRONG>
2N/A<DD>Cursor backward (left) one character.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>b</STRONG>
2N/A<DD>Cursor backward one word.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>B</STRONG>
2N/A<DD>Cursor to preceding blank separated word.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>|</STRONG>
2N/A<DD>Cursor to column <EM>count</EM>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>f</STRONG><EM>c</EM>
2N/A<DD>Find the next character <EM>c</EM> in the current line.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>F</STRONG><EM>c</EM>
2N/A<DD>Find the previous character <EM>c</EM> in the current line.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>t</STRONG><EM>c</EM>
2N/A<DD>Equivalent to <STRONG>f </STRONG>followed by <STRONG>h</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>T</STRONG><EM>c</EM>
2N/A<DD>Equivalent to <STRONG>F </STRONG>followed by <STRONG>l</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>;</STRONG>
2N/A<DD>Repeats <EM>count </EM>times, the last single character find command, <STRONG>f</STRONG>, <STRONG>F</STRONG>, <STRONG>t</STRONG>, or
2N/A<STRONG>T</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>,</STRONG>
2N/A<DD>Reverses the last single character find command <EM>count </EM>times.
2N/A<STRONG><DT>
2N/A0 </STRONG>
2N/A<DD>Cursor to start of line.
2N/A<STRONG><DT>
2N/A^ </STRONG>
2N/A<DD>Cursor to first non-blank character in line.
2N/A<STRONG><DT>
2N/A$ </STRONG>
2N/A<DD>Cursor to end of line.
2N/A<STRONG><DT>
2N/A% </STRONG>
2N/A<DD>Moves to balancing <STRONG>(</STRONG>, <STRONG>)</STRONG>, <STRONG>{</STRONG>, <STRONG>}</STRONG>, <STRONG>[</STRONG>, or <STRONG>]</STRONG>.
2N/AIf cursor is not on one of the above characters, the remainder of the line
2N/Ais searched for the first occurrence of one of the above characters first.
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><DT>
2N/A<H3><A NAME="Search Edit Commands">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Search Edit Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><DL COMPACT>
2N/AThese commands access your command history.
2N/A<DL COMPACT>
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>k</STRONG>
2N/A<DD>Fetch previous command.
2N/AEach time <STRONG>k </STRONG>is entered the previous command back in time is accessed.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>&#045;</STRONG>
2N/A<DD>Equivalent to <STRONG>k</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>j</STRONG>
2N/A<DD>Fetch next command.
2N/AEach time <STRONG>j </STRONG>is entered the next command forward in time is accessed.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>+</STRONG>
2N/A<DD>Equivalent to <STRONG>j</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>G</STRONG>
2N/A<DD>The command number <EM>count </EM>is fetched.
2N/AThe default is the least recent history command.
2N/A<DT>
2N/A<STRONG>/</STRONG><EM>string </EM>
2N/A<DD>Search backward through history for a previous command containing <EM>string</EM>.
2N/A<EM>String </EM>is terminated by a `RETURN' or `NEW&nbsp;LINE'.
2N/AIf string is preceded by a <STRONG>^</STRONG>, the matched line must begin with <EM>string</EM>.
2N/AIf <EM>string</EM> is null, the previous string will be used.
2N/A<DT>
2N/A<STRONG>?</STRONG><EM>string </EM>
2N/A<DD>Same as <STRONG>/ </STRONG>except that search will be in the forward direction.
2N/A<STRONG><DT>
2N/An </STRONG>
2N/A<DD>Search for next match of the last pattern to <STRONG>/ </STRONG>or <STRONG>? </STRONG>commands.
2N/A<STRONG><DT>
2N/AN </STRONG>
2N/A<DD>Search for next match of the last pattern to <STRONG>/ </STRONG>or <STRONG>?</STRONG>, but in reverse direction.
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><DT>
2N/A<H3><A NAME="Text Modification Edit Commands">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text Modification Edit Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><DL COMPACT>
2N/AThese commands will modify the line.
2N/A<DL COMPACT><STRONG><DT>
2N/Aa </STRONG>
2N/A<DD>Enter input mode and enter text after the current character.
2N/A<STRONG><DT>
2N/AA </STRONG>
2N/A<DD>Append text to the end of the line.
2N/AEquivalent to <STRONG>$a</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>c</STRONG><EM>motion</EM>
2N/A<DD><STRONG><DT>
2N/Ac</STRONG>[<EM>count</EM>]<EM>motion</EM>
2N/A<DD>Delete current character through the character that <EM>motion </EM>would move the
2N/Acursor to and enter input mode.
2N/AIf <EM>motion</EM> is <STRONG>c</STRONG>, the entire line will be deleted and input mode entered.
2N/A<STRONG><DT>
2N/AC </STRONG>
2N/A<DD>Delete the current character through the end of line and enter input mode.
2N/AEquivalent to <STRONG>c$</STRONG>.
2N/A<STRONG><DT>
2N/AS </STRONG>
2N/A<DD>Equivalent to <STRONG>cc</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>s</STRONG>
2N/A<DD>Replace characters under the cursor in input mode.
2N/A<STRONG><DT>
2N/AD </STRONG>
2N/A<DD>Delete the current character through the end of line.
2N/AEquivalent to <STRONG>d$</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>d</STRONG><EM>motion</EM>
2N/A<DD><STRONG><DT>
2N/Ad</STRONG>[<EM>count</EM>]<EM>motion</EM>
2N/A<DD>Delete current character through the character that <EM>motion </EM>would move to.
2N/AIf <EM>motion</EM> is <STRONG>d , </STRONG>the entire line will be deleted.
2N/A<STRONG><DT>
2N/Ai </STRONG>
2N/A<DD>Enter input mode and insert text before the current character.
2N/A<STRONG><DT>
2N/AI </STRONG>
2N/A<DD>Insert text before the beginning of the line.
2N/AEquivalent to <STRONG>0i</STRONG>.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>P</STRONG>
2N/A<DD>Place the previous text modification before the cursor.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>p</STRONG>
2N/A<DD>Place the previous text modification after the cursor.
2N/A<STRONG><DT>
2N/AR </STRONG>
2N/A<DD>Enter input mode and replace characters on the screen with characters you
2N/Atype overlay fashion.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>r</STRONG><EM>c</EM>
2N/A<DD>Replace the <EM>count </EM>character(s) starting at the current cursor position
2N/Awith <EM>c</EM>, and advance the cursor.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>x</STRONG>
2N/A<DD>Delete current character.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>X</STRONG>
2N/A<DD>Delete preceding character.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>.</STRONG>
2N/A<DD>Repeat the previous text modification command.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>~</STRONG>
2N/A<DD>Invert the case of the <EM>count </EM>character(s) starting at the current cursor
2N/Aposition and advance the cursor.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>_</STRONG>
2N/A<DD>Causes the <EM>count </EM>word of the previous command to be appended and input
2N/Amode entered.
2N/AThe last word is used if <EM>count </EM>is omitted.
2N/A<STRONG><DT>
2N/A* </STRONG>
2N/A<DD>Causes an <STRONG>* </STRONG>to be appended to the current word and file name generation
2N/Aattempted.
2N/AIf no match is found, it rings the bell.
2N/AOtherwise, the word is replaced by the matching pattern and input mode
2N/Ais entered.
2N/A<STRONG><DT>
2N/A&#092; </STRONG>
2N/A<DD>Command or file name completion as described above.
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><DT>
2N/A<H3><A NAME="Other Edit Commands">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Other Edit Commands &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><DL COMPACT>
2N/AMiscellaneous commands.
2N/A<DL COMPACT>
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>y</STRONG><EM>motion</EM>
2N/A<DD><STRONG><DT>
2N/Ay</STRONG>[<EM>count</EM>]<EM>motion</EM>
2N/A<DD>Yank current character through character that <EM>motion </EM>would move the cursor
2N/Ato and puts them into the delete buffer.
2N/AThe text and cursor are unchanged.
2N/A<STRONG><DT>
2N/Ayy </STRONG>
2N/A<DD>Yanks the entire line.
2N/A<STRONG><DT>
2N/AY </STRONG>
2N/A<DD>Yanks from current position to end of line.
2N/AEquivalent to <STRONG>y$</STRONG>.
2N/A<STRONG><DT>
2N/Au </STRONG>
2N/A<DD>Undo the last text modifying command.
2N/A<STRONG><DT>
2N/AU </STRONG>
2N/A<DD>Undo all the text modifying commands performed on the line.
2N/A<DT>
2N/A[<EM>count</EM>]<STRONG>v</STRONG>
2N/A<DD>Returns the command <STRONG>hist &#045;e ${<FONT SIZE=-1>VISUAL</FONT>:&#045;${<FONT SIZE=-1>EDITOR</FONT>:&#045;vi}}</STRONG><EM> count </EM>in the input
2N/Abuffer.
2N/AIf <EM>count </EM>is omitted, then the current line is used.
2N/A<DT>
2N/A<STRONG>^L </STRONG>
2N/A<DD>Line feed and print current line.
2N/AHas effect only in control mode.
2N/A<DT>
2N/A<STRONG>^J </STRONG>
2N/A<DD>(New&nbsp;line) Execute the current line, regardless of mode.
2N/A<DT>
2N/A<STRONG>^M </STRONG>
2N/A<DD>(Return) Execute the current line, regardless of mode.
2N/A<STRONG><DT>
2N/A# </STRONG>
2N/A<DD>If the first character of the command is a <STRONG>#</STRONG>, then this command deletes
2N/Athis <STRONG># </STRONG>and each <STRONG># </STRONG>that follows a newline.
2N/AOtherwise, sends the line after inserting a <STRONG># </STRONG>in front of each line in
2N/Athe command.
2N/AUseful for causing the current line to be inserted in the history as a
2N/Acomment and uncommenting previously commented commands in the history file.
2N/A<STRONG><DT>
2N/A= </STRONG>
2N/A<DD>Command or file name listing as described above.
2N/A<DT>
2N/A<STRONG>@</STRONG><EM>letter </EM>
2N/A<DD>Your alias list is searched for an alias by the name <STRONG>_</STRONG><EM>letter </EM>and if an
2N/Aalias of this name is defined, its value will be inserted on the input
2N/Aqueue for processing.
2N/A<DT>
2N/A<STRONG>^V </STRONG>
2N/A<DD>Display version of the shell.
2N/A</DL>
2N/A</DL>
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Built-in Commands">Built-in &nbsp;Commands.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>The following simple-commands are executed in the shell process.
2N/AInput/Output redirection is permitted.
2N/AUnless otherwise indicated, the output is written on file descriptor 1
2N/Aand the exit status, when there is no syntax error, is zero.
2N/AExcept for <STRONG>:</STRONG>, <STRONG>true</STRONG>, <STRONG>false</STRONG>, <STRONG>echo</STRONG>, <STRONG>command</STRONG>, <STRONG>newgrp</STRONG>, and <STRONG>login</STRONG>, all built-in
2N/Acommands accept <STRONG>&#045;&#045; </STRONG>to indicate end of options.
2N/AThey also interpret the option <STRONG>&#045;? </STRONG>as a help request and print a <EM>usage </EM>message
2N/Aon standard error.
2N/ACommands that are preceded by one or two &#167; symbols are special built-in
2N/Acommands and are treated specially in the following ways:
2N/A<DL COMPACT>
2N/A<DT>
2N/A1.
2N/A<DD>Variable assignment lists preceding the command remain in effect when the
2N/Acommand completes.
2N/A<DT>
2N/A2.
2N/A<DD>I/O redirections are processed after variable assignments.
2N/A<DT>
2N/A3.
2N/A<DD>Errors cause a script that contains them to abort.
2N/A<DT>
2N/A4.
2N/A<DD>They are not valid function names.
2N/A<DT>
2N/A5.
2N/A<DD>Words following a command preceded by &#167;&#167; that are in the format of a variable
2N/Aassignment are expanded with the same rules as a variable assignment.
2N/AThis means that tilde substitution is performed after the <STRONG>= </STRONG>sign and field
2N/Asplitting and file name generation are not performed.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>:</STRONG> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>The command only expands parameters.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>&nbsp;.
2N/A</STRONG><EM>name&nbsp;</EM><STRONG> [&nbsp; </STRONG><EM>arg&nbsp;</EM><STRONG> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD></STRONG>If <EM>name </EM>is a function defined with the <STRONG>function </STRONG><EM>name </EM>reserved word syntax,
2N/Athe function is executed in the current environment (as if it had been
2N/Adefined with the <EM>name</EM><STRONG>() </STRONG>syntax.) Otherwise if <EM>name </EM>refers to a file, the
2N/Afile is read in its entirety and the commands are executed in the current
2N/Ashell environment.
2N/AThe search path specified by <STRONG><FONT SIZE=-1>PATH </FONT></STRONG>is used to find the directory containing
2N/Athe file.
2N/AIf any arguments <EM>arg </EM>are given, they become the positional parameters while
2N/Aprocessing the <STRONG>.
2N/A</STRONG>command and the original positional parameters are restored upon completion.
2N/AOtherwise the positional parameters are unchanged.
2N/AThe exit status is the exit status of the last command executed.
2N/A<P>
2N/A<DT>
2N/A&#167;&#167; <STRONG>alias</STRONG> [&nbsp; <STRONG>&#045;ptx</STRONG> &nbsp;] [&nbsp; <EM>name</EM>[&nbsp; <STRONG>=</STRONG><EM>value&nbsp;</EM>&nbsp;]&nbsp;].&nbsp;.&nbsp;.
2N/A<DD><STRONG>alias </STRONG>with no arguments prints the list of aliases in the form <EM>name=value
2N/A</EM>on standard output.
2N/AThe <STRONG>&#045;p </STRONG>option causes the word <STRONG>alias </STRONG>to be inserted before each one.
2N/AWhen one or more arguments are given, an <EM>alias </EM>is defined for each <EM>name
2N/A</EM>whose <EM>value </EM>is given.
2N/AA trailing space in <EM>value </EM>causes the next word to be checked for alias
2N/Asubstitution.
2N/AThe obsolete <STRONG>&#045;t </STRONG>option is used to set and list tracked aliases.
2N/AThe value of a tracked alias is the full pathname corresponding to the
2N/Agiven <EM>name</EM>.
2N/AThe value becomes undefined when the value of <FONT SIZE=-1><STRONG>PATH </STRONG></FONT>is reset but the alias
2N/Aremains tracked.
2N/AWithout the <STRONG>&#045;t </STRONG>option, for each <EM>name </EM>in the argument list for which no
2N/A<EM>value </EM>is given, the name and value of the alias is printed.
2N/AThe obsolete <STRONG>&#045;x </STRONG>option has no effect.
2N/AThe exit status is non-zero if a <EM>name </EM>is given, but no value, and no alias
2N/Ahas been defined for the <EM>name&nbsp;</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Abg</STRONG> [&nbsp; <EM>job&nbsp;</EM>.&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>This command is only on systems that support job control.
2N/APuts each specified <EM>job </EM>into the background.
2N/AThe current job is put in the background if <EM>job </EM>is not specified.
2N/ASee <EM>Jobs </EM>for a description of the format of <EM>job</EM>.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>break</STRONG> [&nbsp; <EM>n&nbsp;</EM> &nbsp;]
2N/A<DD>Exit from the enclosing <STRONG>for&nbsp;</STRONG>, <STRONG>while&nbsp;</STRONG>, <STRONG>until&nbsp;</STRONG>, or <STRONG>select </STRONG>loop, if any.
2N/AIf <EM>n </EM>is specified, then break <EM>n </EM>levels.
2N/A<STRONG><P>
2N/A<DT>
2N/Abuiltin</STRONG> [&nbsp; <STRONG>&#045;ds</STRONG> &nbsp;] [&nbsp; <STRONG>&#045;f</STRONG> <EM>file&nbsp;</EM> &nbsp;][&nbsp;<EM>name&nbsp;</EM>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>If <EM>name </EM>is not specified, and no <STRONG>&#045;f </STRONG>option is specified, the built-ins
2N/Aare printed on standard output.
2N/AThe <STRONG>&#045;s </STRONG>option prints only the special built-ins.
2N/AOtherwise, each <EM>name </EM>represents the pathname whose basename is the name
2N/Aof the built-in.
2N/AThe entry point function name is determined by prepending <STRONG>b_ </STRONG>to the built-in
2N/Aname.
2N/ASpecial built-ins cannot be bound to a pathname or deleted.
2N/AThe <STRONG>&#045;d </STRONG>option deletes each of the given built-ins.
2N/AOn systems that support dynamic loading, the <STRONG>&#045;f </STRONG>option names a shared library
2N/Acontaining the code for built-ins.
2N/AOnce a library is loaded, its symbols become available for subsequent invocations
2N/Aof <STRONG>builtin</STRONG>.
2N/AMultiple libraries can be specified with separate invocations of the <STRONG>builtin
2N/A</STRONG>command.
2N/ALibraries are searched in the reverse order in which they are specified.
2N/AWhen a library is loaded, it looks for a function in the library whose
2N/Aname is <STRONG>lib_init() </STRONG>and invokes this function with an argument of <STRONG>0</STRONG>.
2N/A<STRONG><P>
2N/A<DT>
2N/Acd</STRONG> [&nbsp; <STRONG>&#045;LP</STRONG> &nbsp;] [&nbsp; <EM>arg&nbsp;</EM> &nbsp;]
2N/A<DD><STRONG><DT>
2N/Acd</STRONG> [&nbsp; <STRONG>&#045;LP</STRONG> &nbsp;] <EM>old&nbsp;</EM> <EM>new&nbsp;</EM>
2N/A<DD>This command can be in either of two forms.
2N/AIn the first form it changes the current directory to <EM>arg</EM>.
2N/AIf <EM>arg </EM>is <STRONG>&#045; </STRONG>the directory is changed to the previous directory.
2N/AThe shell variable <STRONG><FONT SIZE=-1>HOME </FONT></STRONG>is the default <EM>arg</EM>.
2N/AThe variable <FONT SIZE=-1><STRONG>PWD </STRONG></FONT>is set to the current directory.
2N/AThe shell variable <STRONG><FONT SIZE=-1>CDPATH </FONT></STRONG>defines the search path for the directory containing
2N/A<EM>arg</EM>.
2N/AAlternative directory names are separated by a colon (<STRONG>:</STRONG>).
2N/AThe default path is <STRONG>&lt;null&gt; </STRONG>(specifying the current directory).
2N/ANote that the current directory is specified by a null path name, which
2N/Acan appear immediately after the equal sign or between the colon delimiters
2N/Aanywhere else in the path list.
2N/AIf <EM>arg </EM>begins with a <STRONG>/</STRONG> then the search path is not used.
2N/AOtherwise, each directory in the path is searched for <EM>arg</EM>.
2N/A<P>
2N/AThe second form of <STRONG>cd </STRONG>substitutes the string <EM>new </EM>for the string <EM>old </EM>in
2N/Athe current directory name, <FONT SIZE=-1><STRONG>PWD</STRONG>, </FONT>and tries to change to this new directory.
2N/A<P>
2N/ABy default, symbolic link names are treated literally when finding the
2N/Adirectory name.
2N/AThis is equivalent to the <STRONG>&#045;L </STRONG>option.
2N/AThe <STRONG>&#045;P </STRONG>option causes symbolic links to be resolved when determining the
2N/Adirectory.
2N/AThe last instance of <STRONG>&#045;L </STRONG>or <STRONG>&#045;P </STRONG>on the command line determines which method
2N/Ais used.
2N/A<P>
2N/AThe <STRONG>cd </STRONG>command may not be executed by <STRONG>rsh&nbsp;.
2N/A</STRONG><STRONG><P>
2N/A<DT>
2N/Acommand</STRONG> [&nbsp; <STRONG>&#045;pvV</STRONG> &nbsp;] <EM>name&nbsp;</EM> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>Without the <STRONG>&#045;v </STRONG>or <STRONG>&#045;V </STRONG>options, <STRONG>command </STRONG>executes <EM>name </EM>with the arguments
2N/Agiven by <EM>arg</EM>.
2N/AThe <STRONG>&#045;p </STRONG>option causes a default path to be searched rather than the one
2N/Adefined by the value of <FONT SIZE=-1><STRONG>PATH</STRONG>.
2N/A</FONT>Functions will not be searched for when finding <EM>name</EM>.
2N/AIn addition, if <EM>name </EM>refers to a special built-in, none of the special
2N/Aproperties associated with the leading daggers will be honored.
2N/A(For example, the predefined alias <STRONG>redirect='command exec' </STRONG>prevents a script
2N/Afrom terminating when an invalid redirection is given.) With the <STRONG>&#045;v </STRONG>option,
2N/A<STRONG>command </STRONG>is equivalent to the built-in <STRONG>whence </STRONG>command described below.
2N/AThe <STRONG>&#045;V </STRONG>option causes <STRONG>command </STRONG>to act like <STRONG>whence &#045;v</STRONG>.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>continue</STRONG> [&nbsp; <EM>n&nbsp;</EM> &nbsp;]
2N/A<DD>Resume the next iteration of the enclosing <STRONG>for&nbsp;</STRONG>, <STRONG>while&nbsp;</STRONG>, <STRONG>until&nbsp;</STRONG>, or <STRONG>select
2N/A</STRONG>loop.
2N/AIf <EM>n </EM>is specified, then resume at the <EM>n</EM>-th enclosing loop.
2N/A<STRONG><P>
2N/A<DT>
2N/Adisown</STRONG> [&nbsp; <EM>job&nbsp;</EM>.&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>Causes the shell not to send a HUP signal to each given <EM>job</EM>, or all active
2N/Ajobs if <EM>job </EM>is omitted, when a login shell terminates.
2N/A<STRONG><P>
2N/A<DT>
2N/Aecho</STRONG> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>When the first <EM>arg </EM>does not begin with a &#045;, and none of the arguments contain
2N/Aa &#092;, then <STRONG>echo </STRONG>prints each of its arguments separated by a space and terminated
2N/Aby a new-line.
2N/AOtherwise, the behavior of <STRONG>echo </STRONG>is system dependent and <STRONG>print </STRONG>or <STRONG>printf
2N/A</STRONG>described below should be used.
2N/ASee <EM>echo</EM>(1) for usage and description.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>eval</STRONG> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>The arguments are read as input to the shell and the resulting command(s)
2N/Aexecuted.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>exec</STRONG> [&nbsp; <STRONG>&#045;c</STRONG> &nbsp;] [&nbsp; <STRONG>&#045;a</STRONG> <EM>name&nbsp;</EM>&nbsp;][&nbsp;<EM>arg&nbsp;</EM>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>If <EM>arg </EM>is given, the command specified by the arguments is executed in
2N/Aplace of this shell without creating a new process.
2N/AThe <STRONG>&#045;c </STRONG>option causes the environment to be cleared before applying variable
2N/Aassignments associated with the <STRONG>exec </STRONG>invocation.
2N/AThe <STRONG>&#045;a </STRONG>option causes <EM>name </EM>rather than the first <EM>arg</EM>, to become <STRONG>argv[0]
2N/A</STRONG>for the new process.
2N/AInput/output arguments may appear and affect the current process.
2N/AIf <EM>arg </EM>is not given, the effect of this command is to modify file descriptors
2N/Aas prescribed by the input/output redirection list.
2N/AIn this case, any file descriptor numbers greater than 2 that are opened
2N/Awith this mechanism are closed when invoking another program.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG><A NAME="exit">exit</A></STRONG>[&nbsp; <EM>n&nbsp;</EM> &nbsp;]
2N/A<DD>Causes the shell to exit with the exit status specified by <EM>n</EM>.
2N/AThe value will be the least significant 8 bits of the specified status.
2N/AIf <EM>n </EM>is omitted, then the exit status is that of the last command executed.
2N/AAn end-of-file will also cause the shell to exit except for a shell which
2N/Ahas the <STRONG>ignoreeof </STRONG>option (see <A HREF="#set"><STRONG>set </STRONG></A>below) turned on.
2N/A<P>
2N/A<DT>
2N/A&#167;&#167; <STRONG>export</STRONG> [&nbsp; <STRONG>&#045;p</STRONG> &nbsp;] [&nbsp; <EM>name&nbsp;</EM>[&nbsp;<STRONG>=</STRONG><EM>value&nbsp;</EM>&nbsp;] &nbsp;].&nbsp;.&nbsp;.
2N/A<DD>If <EM>name </EM>is not given, the names and values of each variable with the export
2N/Aattribute are printed with the values quoted in a manner that allows them
2N/Ato be re-input.
2N/AThe <STRONG>&#045;p </STRONG>option causes the word <STRONG>export </STRONG>to be inserted before each one.
2N/AOtherwise, the given <EM>name</EM>s are marked for automatic export to the <EM>environment
2N/A</EM>of subsequently-executed commands.
2N/A<STRONG><P>
2N/A<DT>
2N/Afalse</STRONG>
2N/A<DD>Does nothing, and exits 1.
2N/AUsed with <STRONG>until </STRONG>for infinite loops.
2N/A<STRONG><P>
2N/A<DT>
2N/Afg</STRONG> [&nbsp; <EM>job&nbsp;</EM>.&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>This command is only on systems that support job control.
2N/AEach <EM>job </EM>specified is brought to the foreground and waited for in the specified
2N/Aorder.
2N/AOtherwise, the current job is brought into the foreground.
2N/ASee <EM>Jobs </EM>for a description of the format of <EM>job</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Agetconf</STRONG> [&nbsp; <EM>name&nbsp;</EM> [&nbsp; <EM>pathname&nbsp;</EM> &nbsp;] &nbsp;]
2N/A<DD>Prints the current value of the configuration parameter given by <EM>name</EM>.
2N/AThe configuration parameters are defined by the IEEE POSIX 1003.1 and IEEE
2N/APOSIX 1003.2 standards.
2N/A(See <EM>pathconf</EM>(2) and <EM>sysconf</EM>(2).) The <EM>pathname </EM>argument is required for
2N/Aparameters whose value depends on the location in the file system.
2N/AIf no arguments are given, <STRONG>getconf </STRONG>prints the names and values of the current
2N/Aconfiguration parameters.
2N/AThe pathname <STRONG>/ </STRONG>is used for each of the parameters that requires <EM>pathname</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Agetopts</STRONG> [&nbsp; <STRONG>&nbsp;-a</STRONG> <EM>name&nbsp;</EM> &nbsp;] <EM>optstring vname&nbsp;</EM> [&nbsp;<EM>arg&nbsp;</EM>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>Checks <EM>arg </EM>for legal options.
2N/AIf <EM>arg </EM>is omitted, the positional parameters are used.
2N/AAn option argument begins with a <STRONG>+ </STRONG>or a <STRONG>&#045;</STRONG>.
2N/AAn option not beginning with <STRONG>+ </STRONG>or <STRONG>&#045; </STRONG>or the argument <STRONG>&#045;&nbsp;&#045; </STRONG>ends the options.
2N/A<EM>optstring </EM>contains the letters that <STRONG>getopts </STRONG>recognizes.
2N/AIf a letter is followed by a <STRONG>:</STRONG>, that option is expected to have an argument.
2N/AThe options can be separated from the argument by blanks.
2N/AThe option <STRONG>&#045;? </STRONG>causes <STRONG>getopts </STRONG>to generate a usage message on standard error.
2N/AThe <STRONG>&#045;a </STRONG>argument can be used to specify the name to use for the usage message,
2N/Awhich defaults to <STRONG>$0</STRONG>.
2N/A<STRONG><P>
2N/Agetopts </STRONG>places the next option letter it finds inside variable <EM>vname </EM>each
2N/Atime it is invoked.
2N/AThe option letter will be prepended with a <STRONG>+ </STRONG>when <EM>arg </EM>begins with a <STRONG>+</STRONG>.
2N/AThe index of the next <EM>arg </EM>is stored in <FONT SIZE=-1><STRONG>OPTIND</STRONG>.
2N/A</FONT>The option argument, if any, gets stored in <FONT SIZE=-1><STRONG>OPTARG</STRONG>.
2N/A</FONT><P>
2N/AA leading <STRONG>: </STRONG>in <EM>optstring </EM>causes <STRONG>getopts </STRONG>to store the letter of an invalid
2N/Aoption in <FONT SIZE=-1><STRONG>OPTARG</STRONG>, </FONT>and to set <EM>vname </EM>to <STRONG>? </STRONG>for an unknown option and to <STRONG>:
2N/A</STRONG>when a required option is missing.
2N/AOtherwise, <STRONG>getopts </STRONG>prints an error message.
2N/AThe exit status is non-zero when there are no more options.
2N/A<P>
2N/AThere is no way to specify any of the options <STRONG>:</STRONG>, <STRONG>+</STRONG>, <STRONG>&#045;</STRONG>, <STRONG>?</STRONG>, <STRONG>[</STRONG>, and <STRONG>]</STRONG>.
2N/AThe option <STRONG># </STRONG>can only be specified as the first option.
2N/A<STRONG><P>
2N/A<DT>
2N/Ahist</STRONG> [&nbsp; <STRONG>&#045;e</STRONG> <EM>ename&nbsp;</EM> &nbsp;&nbsp;] [&nbsp; <STRONG>&#045;nlr&nbsp;</STRONG> &nbsp;][&nbsp;<EM>first&nbsp;</EM>[&nbsp;<EM>last&nbsp;</EM>&nbsp;]&nbsp;]
2N/A<DD><STRONG><DT>
2N/Ahist &#045;s </STRONG> [&nbsp; <EM>old</EM><STRONG>=</STRONG><EM>new&nbsp;</EM> &nbsp;] [&nbsp; <EM>command&nbsp;</EM>&nbsp;]
2N/A<DD>In the first form, a range of commands from <EM>first </EM>to <EM>last </EM>is selected from
2N/Athe last <FONT SIZE=-1><STRONG>HISTSIZE </STRONG></FONT>commands that were typed at the terminal.
2N/AThe arguments <EM>first </EM>and <EM>last </EM>may be specified as a number or as a string.
2N/AA string is used to locate the most recent command starting with the given
2N/Astring.
2N/AA negative number is used as an offset to the current command number.
2N/AIf the <STRONG>&#045;l </STRONG>option is selected, the commands are listed on standard output.
2N/AOtherwise, the editor program <EM>ename </EM>is invoked on a file containing these
2N/Akeyboard commands.
2N/AIf <EM>ename </EM>is not supplied, then the value of the variable <FONT SIZE=-1><STRONG>HISTEDIT </STRONG></FONT>is used.
2N/AIf <FONT SIZE=-1><STRONG>HISTEDIT </STRONG></FONT>is not set, then <FONT SIZE=-1><STRONG>FCEDIT </STRONG></FONT>(default <STRONG>/bin/ed&nbsp;</STRONG>) is used as the editor.
2N/AWhen editing is complete, the edited command(s) is executed if the changes
2N/Ahave been saved.
2N/AIf <EM>last </EM>is not specified, then it will be set to <EM>first</EM>.
2N/AIf <EM>first </EM>is not specified, the default is the previous command for editing
2N/Aand &#045;16 for listing.
2N/AThe option <STRONG>&#045;r </STRONG>reverses the order of the commands and the option <STRONG>&#045;n </STRONG>suppresses
2N/Acommand numbers when listing.
2N/AIn the second form, <EM>command </EM>is interpreted as <EM>first </EM>described above and
2N/Adefaults to the last command executed.
2N/AThe resulting command is executed after the optional substitution <EM>old&nbsp;</EM><STRONG>=</STRONG><EM>new&nbsp;</EM>
2N/Ais performed.
2N/A<STRONG><P>
2N/A<DT>
2N/Ajobs</STRONG> [&nbsp; <STRONG>&#045;lnp&nbsp;</STRONG> &nbsp;] [&nbsp; <EM>job&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>Lists information about each given job; or all active jobs if <EM>job </EM>is omitted.
2N/AThe <STRONG>&#045;l </STRONG>option lists process ids in addition to the normal information.
2N/AThe <STRONG>&#045;n </STRONG>option only displays jobs that have stopped or exited since last
2N/Anotified.
2N/AThe <STRONG>&#045;p </STRONG>option causes only the process group to be listed.
2N/ASee <EM>Jobs </EM>for a description of the format of <EM>job</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Akill</STRONG> [&nbsp; <STRONG>&#045;s</STRONG> <EM>signame&nbsp;</EM> &nbsp;] <EM>job&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD><STRONG><DT>
2N/Akill</STRONG> [&nbsp; <STRONG>&#045;n</STRONG> <EM>signum&nbsp;</EM> &nbsp;] <EM>job&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD><STRONG><DT>
2N/Akill</STRONG> <STRONG>&#045;l</STRONG> [&nbsp; <EM>sig&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>Sends either the TERM (terminate) signal or the specified signal to the
2N/Aspecified jobs or processes.
2N/ASignals are either given by number with the <STRONG>&#045;n </STRONG>option or by name with the
2N/A<STRONG>&#045;s </STRONG>option (as given in <STRONG>&lt;signal.h&gt;</STRONG>, stripped of the prefix ``SIG'' with
2N/Athe exception that SIGCLD is named CHLD).
2N/AFor backward compatibility, the <STRONG>n </STRONG>and <STRONG>s </STRONG>can be omitted and the number or
2N/Aname placed immediately after the <STRONG>&#045;</STRONG>.
2N/AIf the signal being sent is TERM (terminate) or HUP (hangup), then the
2N/Ajob or process will be sent a CONT (continue) signal if it is stopped.
2N/AThe argument <EM>job </EM>can be the process id of a process that is not a member
2N/Aof one of the active jobs.
2N/ASee <EM>Jobs </EM>for a description of the format of <EM>job</EM>.
2N/AIn the third form, <STRONG>kill &#045;l</STRONG>, if <EM>sig </EM>is not specified, the signal names are
2N/Alisted.
2N/AOtherwise, for each <EM>sig </EM>that is a name, the corresponding signal number
2N/Ais listed.
2N/AFor each <EM>sig </EM>that is a number, the signal name corresponding to the least
2N/Asignificant 8 bits of <EM>sig </EM>is listed.
2N/A<STRONG><P>
2N/A<DT>
2N/Alet</STRONG> <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>Each <EM>arg </EM>is a separate <EM>arithmetic expression </EM>to be evaluated.
2N/ASee <EM>Arithmetic Evaluation </EM>above, for a description of arithmetic expression
2N/Aevaluation.
2N/A<P>
2N/AThe exit status is 0 if the value of the last expression is non-zero, and
2N/A1 otherwise.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>newgrp</STRONG> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>Equivalent to <STRONG>exec /bin/newgrp</STRONG><EM> arg&nbsp; </EM>.&nbsp;.&nbsp;.&nbsp;.
2N/A<STRONG><P>
2N/A<DT>
2N/Aprint</STRONG> [&nbsp; <STRONG>&#045;Rnprs&nbsp;</STRONG> &nbsp;] [&nbsp; <STRONG>&#045;u</STRONG> <EM>unit&nbsp;</EM>&nbsp;] [&nbsp;<STRONG>&#045;f</STRONG><EM>format&nbsp;</EM>&nbsp;][&nbsp;<EM>arg&nbsp;</EM>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>With no options or with option <STRONG>&#045; </STRONG>or <STRONG>&#045;&nbsp;&#045;</STRONG>, each <EM>arg </EM>is printed on standard
2N/Aoutput.
2N/AThe <STRONG>&#045;f </STRONG>option causes the arguments to be printed as described by <STRONG>printf</STRONG>.
2N/AIn this case, any <STRONG>n</STRONG>, <STRONG>r</STRONG>, <STRONG>R </STRONG>options are ignored.
2N/AOtherwise, unless the <STRONG>&#045;R </STRONG>or <STRONG>&#045;r</STRONG>, are specified, the following escape conventions
2N/Awill be applied: <DL COMPACT><STRONG>
2N/A<DT>
2N/A&#092;a </STRONG>
2N/A<DD>The alert character (ascii <STRONG>07</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;b </STRONG>
2N/A<DD>The backspace character (ascii <STRONG>010</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;c </STRONG>
2N/A<DD>Causes <STRONG>print </STRONG>to end without processing more arguments and not adding a
2N/Anew-line.
2N/A<STRONG><DT>
2N/A&#092;f </STRONG>
2N/A<DD>The formfeed character (ascii <STRONG>014</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;n </STRONG>
2N/A<DD>The new-line character (ascii <STRONG>012</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;r </STRONG>
2N/A<DD>The carriage return character (ascii <STRONG>015</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;t </STRONG>
2N/A<DD>The tab character (ascii <STRONG>011</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;v </STRONG>
2N/A<DD>The vertical tab character (ascii <STRONG>013</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;E </STRONG>
2N/A<DD>The escape character (ascii <STRONG>033</STRONG>).
2N/A<STRONG><DT>
2N/A&#092;&#092; </STRONG>
2N/A<DD>The backslash character &#092;.
2N/A<DT>
2N/A<STRONG>&#092;0</STRONG><EM>x </EM>
2N/A<DD>The character defined by the 1, 2, or 3-digit octal string given by <EM>x</EM>.
2N/A</DL>
2N/A<P>
2N/AThe <STRONG>&#045;R </STRONG>option will print all subsequent arguments and options other than
2N/A<STRONG>&#045;n</STRONG>.
2N/AThe <STRONG>&#045;p </STRONG>option causes the arguments to be written onto the pipe of the process
2N/Aspawned with <STRONG>|&amp; </STRONG>instead of standard output.
2N/AThe <STRONG>&#045;s </STRONG>option causes the arguments to be written onto the history file
2N/Ainstead of standard output.
2N/AThe <STRONG>&#045;u </STRONG>option can be used to specify a one digit file descriptor unit number
2N/A<EM>unit </EM>on which the output will be placed.
2N/AThe default is 1.
2N/AIf the option <STRONG>&#045;n </STRONG>is used, no <STRONG>new-line </STRONG>is added to the output.
2N/A<STRONG><P>
2N/A<DT>
2N/Aprintf</STRONG> <EM>format&nbsp;</EM> [&nbsp; <EM>arg&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>The arguments <EM>arg </EM>are printed on standard output in accordance with the
2N/AANSI-C formatting rules associated with the format string <EM>format</EM>.
2N/AIf the number of arguments exceeds the number of format specifications,
2N/Athe <STRONG>format </STRONG>string is reused to format remaining arguments.
2N/AThe following extensions can also be used:
2N/A<DL COMPACT>
2N/A<P>
2N/A<DT>
2N/A&#183;
2N/A<DD>A <STRONG>%b </STRONG>format can be used instead of <STRONG>%s </STRONG>to cause escape sequences in the
2N/Acorresponding <EM>arg </EM>to be expanded as described in <STRONG>print.
2N/A</STRONG><P>
2N/A<DT>
2N/A&#183;
2N/A<DD>A <STRONG>%P </STRONG>format can be used instead of <STRONG>%s </STRONG>to cause <EM>arg </EM>to be interpreted as
2N/Aan extended regular expression and be printed as a shell pattern.
2N/A<P>
2N/A<DT>
2N/A&#183;
2N/A<DD>A <STRONG>%q </STRONG>format can be used instead of <STRONG>%s </STRONG>to cause the resulting string to
2N/Abe quoted in a manner than can be reinput to the shell.
2N/A<P>
2N/A<DT>
2N/A&#183;
2N/A<DD>The precision field of the <STRONG>%d </STRONG>format can be followed by a <STRONG>.
2N/A</STRONG>and the output base.
2N/A</DL>
2N/A<STRONG><P>
2N/A<DT>
2N/Apwd</STRONG> [&nbsp; <STRONG>&#045;LP</STRONG> &nbsp;]
2N/A<DD>Outputs the value of the current working directory.
2N/AThe <STRONG>&#045;L </STRONG>option is the default; it prints the logical name of the current
2N/Adirectory.
2N/AIf the <STRONG>&#045;P </STRONG>option is given, all symbolic links are resolved from the name.
2N/AThe last instance of <STRONG>&#045;L </STRONG>or <STRONG>&#045;P </STRONG>on the command line determines which method
2N/Ais used.
2N/A<STRONG><P>
2N/A<DT>
2N/Aread</STRONG> [&nbsp; <STRONG>&#045;Aprs&nbsp;</STRONG> &nbsp;] [&nbsp; <STRONG>&#045;d</STRONG> <EM>delim&nbsp;</EM>&nbsp;] [&nbsp;<STRONG>&#045;t</STRONG><EM>timeout&nbsp;</EM>&nbsp;][&nbsp;<STRONG>&#045;u</STRONG><EM>unit&nbsp;</EM>&nbsp;][&nbsp;<EM>vname</EM><STRONG>?</STRONG><EM>prompt&nbsp;</EM><STRONG>&nbsp;][&nbsp;</STRONG><EM>vname&nbsp;</EM><STRONG>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD></STRONG>The shell input mechanism.
2N/AOne line is read and is broken up into fields using the characters in <STRONG><FONT SIZE=-1>IFS
2N/A</FONT></STRONG>as separators.
2N/AThe escape character, <STRONG>&#092;</STRONG>, is used to remove any special meaning for the
2N/Anext character and for line continuation.
2N/AThe <STRONG>&#045;d </STRONG>option causes the read to continue to the first character of <EM>delim
2N/A</EM>rather than new-line.
2N/AIn raw mode, <STRONG>&#045;r, </STRONG>the <STRONG>&#092; </STRONG>character is not treated specially.
2N/AThe first field is assigned to the first <EM>vname</EM>, the second field to the
2N/Asecond <EM>vname</EM>, etc., with leftover fields assigned to the last <EM>vname</EM>.
2N/AThe <STRONG>&#045;A </STRONG>option causes the variable <EM>vname </EM>to be unset and each field that
2N/Ais read to be stored in successive elements of the indexed array <EM>vname.
2N/A</EM>The <STRONG>&#045;p </STRONG>option causes the input line to be taken from the input pipe of
2N/Aa process spawned by the shell using <STRONG>|&amp;</STRONG>.
2N/AIf the <STRONG>&#045;s </STRONG>option is present, the input will be saved as a command in the
2N/Ahistory file.
2N/AThe option <STRONG>&#045;u </STRONG>can be used to specify a one digit file descriptor unit <EM>unit
2N/A</EM>to read from.
2N/AThe file descriptor can be opened with the <STRONG>exec </STRONG>special built-in command.
2N/AThe default value of unit <EM>n </EM>is 0.
2N/AThe option <STRONG>&#045;t </STRONG>is used to specify a timeout in seconds when reading from
2N/Aa terminal or pipe.
2N/AIf <EM>vname </EM>is omitted, then <FONT SIZE=-1><STRONG>REPLY </STRONG></FONT>is used as the default <EM>vname</EM>.
2N/AAn end-of-file with the <STRONG>&#045;p </STRONG>option causes cleanup for this process so that
2N/Aanother can be spawned.
2N/AIf the first argument contains a <STRONG>?</STRONG>, the remainder of this word is used
2N/Aas a <EM>prompt </EM>on standard error when the shell is interactive.
2N/AThe exit status is 0 unless an end-of-file is encountered or <STRONG>read </STRONG>has timed
2N/Aout.
2N/A<P>
2N/A<DT>
2N/A&#167;&#167; <STRONG>readonly</STRONG> [&nbsp; <STRONG>&#045;p</STRONG> &nbsp;] [&nbsp; <EM>vname</EM>[&nbsp;<STRONG>=</STRONG><EM>value&nbsp;</EM>&nbsp;] &nbsp;].&nbsp;.&nbsp;.
2N/A<DD>If <EM>vname </EM>is not given, the names and values of each variable with the readonly
2N/Aattribute is printed with the values quoted in a manner that allows them
2N/Ato be re-inputted.
2N/AThe <STRONG>&#045;p </STRONG>option causes the word <STRONG>readonly </STRONG>to be inserted before each one.
2N/AOtherwise, the given <EM>vname</EM>s are marked readonly and these names cannot
2N/Abe changed by subsequent assignment.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>return</STRONG> [&nbsp; <EM>n&nbsp;</EM> &nbsp;]
2N/A<DD>Causes a shell <EM>function </EM>or <STRONG>&nbsp;.</STRONG> script to return to the invoking script with
2N/Athe exit status specified by <EM>n</EM>.
2N/AThe value will be the least significant 8 bits of the specified status.
2N/AIf <EM>n </EM>is omitted, then the return status is that of the last command executed.
2N/AIf <STRONG>return </STRONG>is invoked while not in a <EM>function </EM>or a <STRONG>&nbsp;.</STRONG> script, then it behaves
2N/Athe same as <STRONG>exit</STRONG>.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG><A NAME="set">set</A></STRONG>[&nbsp; <STRONG>&#177;Cabefhkmnopstuvx</STRONG> &nbsp;] [&nbsp; <STRONG>&#177;o</STRONG> [&nbsp;<EM>option&nbsp;</EM>&nbsp;]&nbsp;].&nbsp;.&nbsp;.[&nbsp;<STRONG>&#177;A</STRONG><EM>vname&nbsp;</EM>&nbsp;][&nbsp;<EM>arg&nbsp;</EM>.&nbsp;.&nbsp;.&nbsp;]
2N/A<DD>The options for this command have meaning as follows: <DL COMPACT><STRONG>
2N/A<DT>
2N/A&#045;A </STRONG>
2N/A<DD>Array assignment.
2N/AUnset the variable <EM>vname </EM>and assign values sequentially from the <EM>arg </EM>list.
2N/AIf <STRONG>+A </STRONG>is used, the variable <EM>vname </EM>is not unset first.
2N/A<STRONG><DT>
2N/A&#045;C </STRONG>
2N/A<DD>Prevents redirection <STRONG>&gt; </STRONG>from truncating existing files.
2N/AFiles that are created are opened with the O_EXCL mode.
2N/ARequires <STRONG>&gt;| </STRONG>to truncate a file when turned on.
2N/A<STRONG><DT>
2N/A&#045;a </STRONG>
2N/A<DD>All subsequent variables that are defined are automatically exported.
2N/A<STRONG><DT>
2N/A&#045;b </STRONG>
2N/A<DD>Prints job completion messages as soon as a background job changes state
2N/Arather than waiting for the next prompt.
2N/A<STRONG><DT>
2N/A&#045;e </STRONG>
2N/A<DD>If a command has a non-zero exit status, execute the <FONT SIZE=-1><STRONG>ERR </STRONG></FONT>trap, if set,
2N/Aand exit.
2N/AThis mode is disabled while reading profiles.
2N/A<STRONG><DT>
2N/A&#045;f </STRONG>
2N/A<DD>Disables file name generation.
2N/A<STRONG><DT>
2N/A&#045;h </STRONG>
2N/A<DD>Each command becomes a tracked alias when first encountered.
2N/A<STRONG><DT>
2N/A&#045;k </STRONG>
2N/A<DD>(Obsolete).
2N/AAll variable assignment arguments are placed in the environment for a command,
2N/Anot just those that precede the command name.
2N/A<STRONG><DT>
2N/A&#045;m </STRONG>
2N/A<DD>Background jobs will run in a separate process group and a line will print
2N/Aupon completion.
2N/AThe exit status of background jobs is reported in a completion message.
2N/AOn systems with job control, this option is turned on automatically for
2N/Ainteractive shells.
2N/A<STRONG><DT>
2N/A&#045;n </STRONG>
2N/A<DD>Read commands and check them for syntax errors, but do not execute them.
2N/AIgnored for interactive shells.
2N/A<STRONG><DT>
2N/A&#045;o </STRONG>
2N/A<DD>The following argument can be one of the following option names: <DL COMPACT><STRONG>
2N/A<DT>
2N/Aallexport </STRONG>
2N/A<DD>Same as <STRONG>&#045;a</STRONG>.
2N/A<STRONG><DT>
2N/Aerrexit </STRONG>
2N/A<DD>Same as <STRONG>&#045;e</STRONG>.
2N/A<STRONG><DT>
2N/Abgnice </STRONG>
2N/A<DD>All background jobs are run at a lower priority.
2N/AThis is the default mode.
2N/A<STRONG><DT>
2N/Aemacs </STRONG>
2N/A<DD>Puts you in an <EM>emacs </EM>style in-line editor for command entry.
2N/A<STRONG><DT>
2N/Agmacs </STRONG>
2N/A<DD>Puts you in a <EM>gmacs </EM>style in-line editor for command entry.
2N/A<STRONG><DT>
2N/Aignoreeof </STRONG>
2N/A<DD>The shell will not exit on end-of-file.
2N/AThe command <STRONG>exit </STRONG>must be used.
2N/A<STRONG><DT>
2N/Akeyword </STRONG>
2N/A<DD>Same as <STRONG>&#045;k</STRONG>.
2N/A<STRONG><DT>
2N/Amarkdirs </STRONG>
2N/A<DD>All directory names resulting from file name generation have a trailing
2N/A<STRONG>/ </STRONG>appended.
2N/A<STRONG><DT>
2N/Amonitor </STRONG>
2N/A<DD>Same as <STRONG>&#045;m</STRONG>.
2N/A<STRONG><DT>
2N/Anoclobber </STRONG>
2N/A<DD>Same as <STRONG>&#045;C</STRONG>.
2N/A<STRONG><DT>
2N/Anoexec </STRONG>
2N/A<DD>Same as <STRONG>&#045;n</STRONG>.
2N/A<STRONG><DT>
2N/Anoglob </STRONG>
2N/A<DD>Same as <STRONG>&#045;f</STRONG>.
2N/A<STRONG><DT>
2N/Anolog </STRONG>
2N/A<DD>Do not save function definitions in the history file.
2N/A<STRONG><DT>
2N/Anotify </STRONG>
2N/A<DD>Same as <STRONG>&#045;b</STRONG>.
2N/A<STRONG><DT>
2N/Anounset </STRONG>
2N/A<DD>Same as <STRONG>&#045;u</STRONG>.
2N/A<STRONG><DT>
2N/Aprivileged </STRONG>
2N/A<DD>Same as <STRONG>&#045;p</STRONG>.
2N/A<STRONG><DT>
2N/Averbose </STRONG>
2N/A<DD>Same as <STRONG>&#045;v</STRONG>.
2N/A<STRONG><DT>
2N/Atrackall </STRONG>
2N/A<DD>Same as <STRONG>&#045;h</STRONG>.
2N/A<STRONG><DT>
2N/Avi </STRONG>
2N/A<DD>Puts you in insert mode of a <EM>vi </EM>style in-line editor until you hit the
2N/Aescape character <STRONG>033</STRONG>.
2N/AThis puts you in control mode.
2N/AA return sends the line.
2N/A<STRONG><DT>
2N/Aviraw </STRONG>
2N/A<DD>Each character is processed as it is typed in <EM>vi </EM>mode.
2N/A<STRONG><DT>
2N/Axtrace </STRONG>
2N/A<DD>Same as <STRONG>&#045;x</STRONG>.
2N/A<DT>
2N/AIf no option name is supplied, then thecurrentoptionsettingsareprinted.
2N/A<DD></DL>
2N/A<STRONG><DT>
2N/A&#045;p </STRONG>
2N/A<DD>Disables processing of the <STRONG><FONT SIZE=-1>$HOME</FONT>/.profile </STRONG>file and uses the file <STRONG>/etc/suid_profile
2N/A</STRONG>instead of the <FONT SIZE=-1><STRONG>ENV </STRONG></FONT>file.
2N/AThis mode is on whenever the effective uid (gid) is not equal to the real
2N/Auid (gid).
2N/ATurning this off causes the effective uid and gid to be set to the real
2N/Auid and gid.
2N/A<STRONG><DT>
2N/A&#045;s </STRONG>
2N/A<DD>Sort the positional parameters lexicographically.
2N/A<STRONG><DT>
2N/A&#045;t </STRONG>
2N/A<DD>(Obsolete).
2N/AExit after reading and executing one command.
2N/A<STRONG><DT>
2N/A&#045;u </STRONG>
2N/A<DD>Treat unset parameters as an error when substituting.
2N/A<STRONG><DT>
2N/A&#045;v </STRONG>
2N/A<DD>Print shell input lines as they are read.
2N/A<STRONG><DT>
2N/A&#045;x </STRONG>
2N/A<DD>Print commands and their arguments as they are executed.
2N/A<STRONG><DT>
2N/A&#045;&nbsp;&#045; </STRONG>
2N/A<DD>Do not change any of the options; useful in setting <STRONG>$1 </STRONG>to a value beginning
2N/Awith <STRONG>&#045;</STRONG>.
2N/AIf no arguments follow this option then the positional parameters are unset.
2N/A</DL><P>
2N/AAs an obsolete feature, if the first <EM>arg </EM>is <STRONG>&#045; </STRONG>then the <STRONG>&#045;x </STRONG>and <STRONG>&#045;v </STRONG>options
2N/Aare turned off and the next <EM>arg </EM>is treated as the first argument.
2N/AUsing <STRONG>+ </STRONG>rather than <STRONG>&#045; </STRONG>causes these options to be turned off.
2N/AThese options can also be used upon invocation of the shell.
2N/AThe current set of options may be found in <STRONG>$&#045;</STRONG>.
2N/AUnless <STRONG>&#045;A </STRONG>is specified, the remaining arguments are positional parameters
2N/Aand are assigned, in order, to <STRONG>$1 </STRONG><STRONG>$2 </STRONG>.&nbsp;.&nbsp;.&nbsp;.
2N/AIf no arguments are given, then the names and values of all variables are
2N/Aprinted on the standard output.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>shift</STRONG> [&nbsp; <EM>n&nbsp;</EM> &nbsp;]
2N/A<DD>The positional parameters from <STRONG>$</STRONG><EM>n</EM><STRONG>+1</STRONG> .&nbsp;.&nbsp;.
2N/Aare renamed <STRONG>$1 </STRONG>.&nbsp;.&nbsp;.&nbsp; , default <EM>n </EM>is 1.
2N/AThe parameter <EM>n </EM>can be any arithmetic expression that evaluates to a non-negative
2N/Anumber less than or equal to <STRONG>$#</STRONG>.
2N/A<STRONG><P>
2N/A<DT>
2N/Asleep</STRONG> <EM>seconds&nbsp;</EM>
2N/A<DD>Suspends execution for the number of decimal seconds or fractions of a
2N/Asecond given by <EM>seconds</EM>.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>trap'</STRONG> [&nbsp; <STRONG>&#045;p</STRONG> &nbsp;] [&nbsp; <EM>action&nbsp;</EM> &nbsp;][&nbsp;<EM>sig&nbsp;</EM>&nbsp;].&nbsp;.&nbsp;.
2N/A<DD>The <STRONG>&#045;p </STRONG>option causes the trap action associated with each trap as specified
2N/Aby the arguments to be printed with appropriate quoting.
2N/AOtherwise, <EM>action </EM>will be processed as if it were an argument to <STRONG>eval </STRONG>when
2N/Athe shell receives signal(s) <EM>sig</EM>.
2N/AEach <EM>sig </EM>can be given as a number or as the name of the signal.
2N/ATrap commands are executed in order of signal number.
2N/AAny attempt to set a trap on a signal that was ignored on entry to the
2N/Acurrent shell is ineffective.
2N/AIf <EM>action </EM>is omitted and the first <EM>sig </EM>is a number, or if <EM>action </EM>is <STRONG>&#045;</STRONG>,
2N/Athen the trap(s) for each <EM>sig </EM>are reset to their original values.
2N/AIf <EM>action </EM>is the null string then this signal is ignored by the shell and
2N/Aby the commands it invokes.
2N/AIf <EM>sig </EM>is <FONT SIZE=-1><STRONG>ERR </STRONG></FONT>then <EM>action </EM>will be executed whenever a command has a non-zero
2N/Aexit status.
2N/AIf <EM>sig </EM>is <FONT SIZE=-1><STRONG>DEBUG </STRONG></FONT>then <EM>action </EM>will be executed before each command.
2N/AIf <EM>sig </EM>is <STRONG>0 </STRONG>or <FONT SIZE=-1><STRONG>EXIT </STRONG></FONT>and the <STRONG>trap </STRONG>statement is executed inside the body
2N/Aof a function, then the command <EM>action </EM>is executed after the function completes.
2N/AIf <EM>sig </EM>is <STRONG>0 </STRONG>or <FONT SIZE=-1><STRONG>EXIT </STRONG></FONT>for a <STRONG>trap </STRONG>set outside any function then the command
2N/A<EM>action </EM>is executed on exit from the shell.
2N/AIf <EM>sig </EM>is <FONT SIZE=-1><STRONG>KEYBD</STRONG>, </FONT>then <EM>action </EM>will be executed whenever a key is read while
2N/Ain <STRONG>emacs</STRONG>, <STRONG>gmacs</STRONG>, or <STRONG>vi </STRONG>mode.
2N/AThe <STRONG>trap </STRONG>command with no arguments prints a list of commands associated
2N/Awith each signal number.
2N/A<STRONG><P>
2N/A<DT>
2N/Atrue</STRONG>
2N/A<DD>Does nothing, and exits 0.
2N/AUsed with <STRONG>while </STRONG>for infinite loops.
2N/A<P>
2N/A<DT>
2N/A&#167;&#167; <STRONG>typeset</STRONG> [&nbsp; <STRONG>&#177;AHflnprtux&nbsp;</STRONG> &nbsp;] [&nbsp; <STRONG>&#177;EFLRZi[&nbsp;</STRONG><EM>n&nbsp;</EM><STRONG>&nbsp;] &nbsp;][&nbsp;</STRONG><EM>vname&nbsp;</EM><STRONG>[&nbsp;=</STRONG><EM>value&nbsp;</EM><STRONG>&nbsp;]&nbsp;&nbsp;].&nbsp;.&nbsp;.
2N/A<DD></STRONG>Sets attributes and values for shell variables and functions.
2N/AWhen invoked inside a function, a new instance of the variable <EM>vname </EM>is
2N/Acreated.
2N/AThe variable's value and type are restored when the function completes.
2N/AThe following list of attributes may be specified: <DL COMPACT><STRONG>
2N/A<DT>
2N/A&#045;A </STRONG>
2N/A<DD>Declares <EM>vname </EM>to be an associative array.
2N/ASubscripts are strings rather than arithmetic expressions.
2N/A<STRONG><DT>
2N/A&#045;E </STRONG>
2N/A<DD>Declares <EM>vname </EM>to be a double precision floating point number.
2N/AIf <EM>n </EM>is non-zero, it defines the number of significant figures that are
2N/Aused when expanding <EM>vname</EM>.
2N/AOtherwise, ten significant figures will be used.
2N/A<STRONG><DT>
2N/A&#045;F </STRONG>
2N/A<DD>Declares <EM>vname </EM>to be a double precision floating point number.
2N/AIf <EM>n </EM>is non-zero, it defines the number of places after the decimal point
2N/Athat are used when expanding <EM>vname</EM>.
2N/AOtherwise ten places after the decimal point will be used.
2N/A<STRONG><DT>
2N/A&#045;H </STRONG>
2N/A<DD>This option provides UNIX to host-name file mapping on non-UNIX machines.
2N/A<STRONG><DT>
2N/A&#045;L </STRONG>
2N/A<DD>Left justify and remove leading blanks from <EM>value</EM>.
2N/AIf <EM>n </EM>is non-zero, it defines the width of the field, otherwise it is determined
2N/Aby the width of the value of first assignment.
2N/AWhen the variable is assigned to, it is filled on the right with blanks
2N/Aor truncated, if necessary, to fit into the field.
2N/AThe <STRONG>&#045;R </STRONG>option is turned off.
2N/A<STRONG><DT>
2N/A&#045;R </STRONG>
2N/A<DD>Right justify and fill with leading blanks.
2N/AIf <EM>n </EM>is non-zero, it defines the width of the field, otherwise it is determined
2N/Aby the width of the value of first assignment.
2N/AThe field is left filled with blanks or truncated from the end if the variable
2N/Ais reassigned.
2N/AThe <STRONG>&#045;L </STRONG>option is turned off.
2N/A<STRONG><DT>
2N/A&#045;Z </STRONG>
2N/A<DD>Right justify and fill with leading zeros if the first non-blank character
2N/Ais a digit and the <STRONG>&#045;L </STRONG>option has not been set.
2N/ARemove leading zeros if the <STRONG>&#045;L </STRONG>option is also set.
2N/AIf <EM>n </EM>is non-zero, it defines the width of the field, otherwise it is determined
2N/Aby the width of the value of first assignment.
2N/A<STRONG><DT>
2N/A&#045;f </STRONG>
2N/A<DD>The names refer to function names rather than variable names.
2N/ANo assignments can be made and the only other valid options are <STRONG>&#045;t</STRONG>, <STRONG>&#045;u
2N/A</STRONG>and <STRONG>&#045;x</STRONG>.
2N/AThe <STRONG>&#045;t </STRONG>option turns on execution tracing for this function.
2N/AThe <STRONG>&#045;u </STRONG>option causes this function to be marked undefined.
2N/AThe <FONT SIZE=-1><STRONG>FPATH </STRONG></FONT>variable will be searched to find the function definition when
2N/Athe function is referenced.
2N/A<STRONG><DT>
2N/A&#045;i </STRONG>
2N/A<DD>Declares <EM>vname </EM>to be represented internally as integer.
2N/AThe right hand side of an assignment is evaluated as an arithmetic expression
2N/Awhen assigning to an integer.
2N/AIf <EM>n </EM>is non-zero, it defines the output arithmetic base, otherwise the
2N/Aoutput base will be ten.
2N/A<STRONG><DT>
2N/A&#045;l </STRONG>
2N/A<DD>All upper-case characters are converted to lower-case.
2N/AThe upper-case option, <STRONG>&#045;u</STRONG>, is turned off.
2N/A<STRONG><DT>
2N/A&#045;n </STRONG>
2N/A<DD>Declares <EM>vname </EM>to be a reference to the variable whose name is defined
2N/Aby the value of variable <EM>vname</EM>.
2N/AThis is usually used to reference a variable inside a function whose name
2N/Ahas been passed as an argument.
2N/A<STRONG><DT>
2N/A&#045;r </STRONG>
2N/A<DD>The given <EM>vname</EM>s are marked readonly and these names cannot be changed
2N/Aby subsequent assignment.
2N/A<STRONG><DT>
2N/A&#045;t </STRONG>
2N/A<DD>Tags the variables.
2N/ATags are user definable and have no special meaning to the shell.
2N/A<STRONG><DT>
2N/A&#045;u </STRONG>
2N/A<DD>All lower-case characters are converted to upper-case.
2N/AThe lower-case option, <STRONG>&#045;l</STRONG>, is turned off.
2N/A<STRONG><DT>
2N/A&#045;x </STRONG>
2N/A<DD>The given <EM>vname</EM>s are marked for automatic export to the <EM>environment </EM>of
2N/Asubsequently-executed commands.
2N/AVariables whose names contain a <STRONG><FONT SIZE=+1>.</FONT></STRONG> cannot be exported.
2N/A</DL><P>
2N/AThe <STRONG>&#045;i </STRONG>attribute cannot be specified along with <STRONG>&#045;R</STRONG>, <STRONG>&#045;L</STRONG>, <STRONG>&#045;Z</STRONG>, or <STRONG>&#045;f</STRONG>.
2N/A<P>
2N/AUsing <STRONG>+ </STRONG>rather than <STRONG>&#045; </STRONG>causes these options to be turned off.
2N/AIf no <EM>vname </EM>arguments are given, a list of <EM>vnames </EM>(and optionally the <EM>values&nbsp;</EM>)
2N/Aof the <EM>variables </EM>is printed.
2N/A(Using <STRONG>+ </STRONG>rather than <STRONG>&#045; </STRONG>keeps the values from being printed.) The <STRONG>&#045;p </STRONG>option
2N/Acauses <STRONG>typeset </STRONG>followed by the option letters to be printed before each
2N/Aname rather than the names of the options.
2N/AIf any option other than <STRONG>&#045;p </STRONG>is given, only those variables which have all
2N/Aof the given options are printed.
2N/AOtherwise, the <EM>vname</EM>s and <EM>attributes </EM>of all <EM>variables </EM>are printed.
2N/A<STRONG><P>
2N/A<DT>
2N/Aulimit</STRONG> [&nbsp; <STRONG>&#045;HSacdfmnpstv</STRONG> &nbsp;] [&nbsp; <EM>limit&nbsp;</EM> &nbsp;]
2N/A<DD>Set or display a resource limit.
2N/AThe available resource limits are listed below.
2N/AMany systems do not support one or more of these limits.
2N/AThe limit for a specified resource is set when <EM>limit </EM>is specified.
2N/AThe value of <EM>limit </EM>can be a number in the unit specified below with each
2N/Aresource, or the value <STRONG>unlimited</STRONG>.
2N/AThe <STRONG>&#045;H </STRONG>and <STRONG>&#045;S </STRONG>options specify whether the hard limit or the soft limit
2N/Afor the given resource is set.
2N/AA hard limit cannot be increased once it is set.
2N/AA soft limit can be increased up to the value of the hard limit.
2N/AIf neither the <STRONG>H </STRONG>nor <STRONG>S </STRONG>options is specified, the limit applies to both.
2N/AThe current resource limit is printed when <EM>limit </EM>is omitted.
2N/AIn this case, the soft limit is printed unless <STRONG>H </STRONG>is specified.
2N/AWhen more than one resource is specified, then the limit name and unit
2N/Ais printed before the value.
2N/A<DL COMPACT><STRONG><DT>
2N/A&#045;a </STRONG>
2N/A<DD>Lists all of the current resource limits.
2N/A<STRONG><DT>
2N/A&#045;c </STRONG>
2N/A<DD>The number of 512-byte blocks on the size of core dumps.
2N/A<STRONG><DT>
2N/A&#045;d </STRONG>
2N/A<DD>The number of K-bytes on the size of the data area.
2N/A<STRONG><DT>
2N/A&#045;f </STRONG>
2N/A<DD>The number of 512-byte blocks on files that can be written by the current
2N/Aprocess or by child processes (files of any size may be read).
2N/A<STRONG><DT>
2N/A&#045;m </STRONG>
2N/A<DD>The number of K-bytes on the size of physical memory.
2N/A<STRONG><DT>
2N/A&#045;n </STRONG>
2N/A<DD>The number of file descriptors plus 1.
2N/A<STRONG><DT>
2N/A&#045;p </STRONG>
2N/A<DD>The number of 512-byte blocks for pipe buffering.
2N/A<STRONG><DT>
2N/A&#045;s </STRONG>
2N/A<DD>The number of K-bytes on the size of the stack area.
2N/A<STRONG><DT>
2N/A&#045;t </STRONG>
2N/A<DD>The number of CPU seconds to be used by each process.
2N/A<STRONG><DT>
2N/A&#045;v </STRONG>
2N/A<DD>The number of K-bytes for virtual memory.
2N/A</DL>
2N/A<P>
2N/AIf no option is given, <STRONG>&#045;f </STRONG>is assumed.
2N/A<STRONG><P>
2N/A<DT>
2N/Aumask</STRONG> [&nbsp; <STRONG>&#045;S</STRONG> &nbsp;] [&nbsp; <EM>mask&nbsp;</EM> &nbsp;]
2N/A<DD>The user file-creation mask is set to <EM>mask </EM>(see <A HREF="umask(2)"><EM>umask</EM>(2)</A>).
2N/A<EM>mask </EM>can either be an octal number or a symbolic value as described in
2N/A<EM>chmod</EM>(1).
2N/AIf a symbolic value is given, the new umask value is the complement of
2N/Athe result of applying <EM>mask </EM>to the complement of the previous umask value.
2N/AIf <EM>mask </EM>is omitted, the current value of the mask is printed.
2N/AThe <STRONG>&#045;S </STRONG>option causes the mode to be printed as a symbolic value.
2N/AOtherwise, the mask is printed in octal.
2N/A<P>
2N/A<DT>
2N/A&#167; <STRONG>unalias</STRONG> [&nbsp; <STRONG>&#045;a</STRONG> &nbsp;] <EM>name&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>The aliases given by the list of <EM>name</EM>s are removed from the alias list.
2N/AThe <STRONG>&#045;a </STRONG>option causes all the aliases to be unset.
2N/A<P>
2N/A<DT>
2N/A&#167;<STRONG>unset</STRONG> [&nbsp; <STRONG>&#045;fnv</STRONG> &nbsp;] <EM>vname&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>The variables given by the list of <EM>vname</EM>s are unassigned, i.e., their values
2N/Aand attributes are erased.
2N/AReadonly variables cannot be unset.
2N/AIf the <STRONG>&#045;f </STRONG>option is set, then the names refer to <EM>function </EM>names.
2N/AIf the <STRONG>&#045;v </STRONG>option is set, then the names refer to <EM>variable </EM>names.
2N/AThe <STRONG>&#045;f </STRONG>option overrides <STRONG>&#045;v</STRONG>.
2N/AIf <STRONG>&#045;n </STRONG>is set and <EM>name </EM>is a name reference, then <EM>name </EM>will be unset rather
2N/Athan the variable that it references.
2N/AThe default is equivalent to <STRONG>&#045;v</STRONG>.
2N/AUnsetting <FONT SIZE=-1><STRONG>LINENO</STRONG>, </FONT><FONT SIZE=-1><STRONG>MAILCHECK</STRONG>, </FONT><FONT SIZE=-1><STRONG>OPTARG</STRONG>, </FONT><FONT SIZE=-1><STRONG>OPTIND</STRONG>, </FONT><FONT SIZE=-1><STRONG>RANDOM</STRONG>, </FONT><FONT SIZE=-1><STRONG>SECONDS</STRONG>, </FONT><FONT SIZE=-1><STRONG>TMOUT</STRONG>, </FONT>and
2N/A<FONT SIZE=-1><STRONG>_ </STRONG></FONT>removes their special meaning even if they are subsequently assigned
2N/Ato.
2N/A<STRONG><P>
2N/A<DT>
2N/Await</STRONG> [&nbsp; <EM>job&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A&nbsp;]
2N/A<DD>Wait for the specified <EM>job </EM>and report its termination status.
2N/AIf <EM>job </EM>is not given, then all currently active child processes are waited
2N/Afor.
2N/AThe exit status from this command is that of the last process waited for.
2N/ASee <EM>Jobs </EM>for a description of the format of <EM>job</EM>.
2N/A<STRONG><P>
2N/A<DT>
2N/Awhence</STRONG> [&nbsp; <STRONG>&#045;afpv</STRONG> &nbsp;] <EM>name&nbsp;</EM> .&nbsp;.&nbsp;.
2N/A<DD>For each <EM>name</EM>, indicate how it would be interpreted if used as a command
2N/Aname.
2N/A<P>
2N/AThe <STRONG>&#045;v </STRONG>option produces a more verbose report.
2N/AThe <STRONG>&#045;f </STRONG>options skips the search for functions.
2N/AThe <STRONG>&#045;p </STRONG>option does a path search for <EM>name </EM>even if name is an alias, a function,
2N/Aor a reserved word.
2N/AThe <STRONG>&#045;a </STRONG>option is similar to the <STRONG>&#045;v </STRONG>option but causes all interpretations
2N/Aof the given name to be reported.
2N/A</DL><FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Invocation">Invocation.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>If the shell is invoked by <EM>exec</EM>(2), and the first character of argument
2N/Azero (<STRONG>$0</STRONG>) is <STRONG>&#045;</STRONG>, then the shell is assumed to be a <EM>login </EM>shell and commands
2N/Aare read from <STRONG>/etc/profile </STRONG>and then from either <STRONG>.profile </STRONG>in the current
2N/Adirectory or <STRONG><FONT SIZE=-1>$HOME</FONT>/.profile</STRONG>, if either file exists.
2N/ANext, for interactive shells, commands are read from the file named by
2N/Aperforming parameter expansion, command substitution, and arithmetic substitution
2N/Aon the value of the environment variable <FONT SIZE=-1><STRONG>ENV </STRONG></FONT>if the file exists.
2N/AIf the <STRONG>&#045;s </STRONG>option is not present and <EM>arg </EM>is, then a path search is performed
2N/Aon the first <EM>arg </EM>to determine the name of the script to execute.
2N/AThe script <EM>arg </EM>must have read permission and any <EM>setuid </EM>and <EM>setgid </EM>settings
2N/Awill be ignored.
2N/AIf the script is not found on the path, <EM>arg </EM>is processed as if it named
2N/Aa built-in command or function.
2N/ACommands are then read as described below; the following options are interpreted
2N/Aby the shell when it is invoked:
2N/A<DL COMPACT>
2N/A<P>
2N/A<DT>
2N/A<STRONG>&#045;c </STRONG>
2N/A<DD>If the <STRONG>&#045;c </STRONG>option is present, then commands are read from the first <EM>arg</EM>.
2N/AAny remaining arguments become positional parameters starting at <STRONG>0</STRONG>.
2N/A<STRONG><DT>
2N/A&#045;s </STRONG>
2N/A<DD>If the <STRONG>&#045;s </STRONG>option is present or if no arguments remain, then commands are
2N/Aread from the standard input.
2N/AShell output, except for the output of the <EM>special builtin-in commands
2N/A</EM>listed above, is written to file descriptor 2.
2N/A<STRONG><DT>
2N/A&#045;i </STRONG>
2N/A<DD>If the <STRONG>&#045;i </STRONG>option is present or if the shell input and output are attached
2N/Ato a terminal (as told by <EM>tcgetattr</EM>(2)), then this shell is <EM>interactive</EM>.
2N/AIn this case <FONT SIZE=-1>TERM</FONT> is ignored (so that <STRONG>kill 0</STRONG> does not kill an interactive
2N/Ashell) and <FONT SIZE=-1>INTR</FONT> is caught and ignored (so that <STRONG>wait </STRONG>is interruptible).
2N/AIn all cases, <FONT SIZE=-1>QUIT</FONT> is ignored by the shell.
2N/A<STRONG><DT>
2N/A&#045;r </STRONG>
2N/A<DD>If the <STRONG>&#045;r </STRONG>option is present, the shell is a restricted shell.
2N/A<STRONG><DT>
2N/A&#045;D </STRONG>
2N/A<DD>A list of all double quoted strings that are preceded by a <STRONG>$ </STRONG>will be printed
2N/Aon standard output and the shell will exit.
2N/AThis set of strings will be subject to language translation when the locale
2N/Ais not C or POSIX.
2N/ANo commands will be executed.
2N/A<P>
2N/A<DT>
2N/A<STRONG>&#045;I</STRONG><EM> filename&nbsp; </EM>
2N/A<DD>The <STRONG>&#045;R </STRONG><EM>filename </EM>option is used to generate a cross reference database that
2N/Acan be used by a separate utility to find definitions and references for
2N/Avariables and commands.
2N/A</DL>
2N/A<P>
2N/AThe remaining options and arguments are described under the <STRONG>set </STRONG>command
2N/Aabove.
2N/AAn optional <STRONG>&#045; </STRONG>as the first argument is ignored.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="Rsh Only">Rsh &nbsp;Only.
2N/A&nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT><EM>Rsh </EM>is used to set up login names and execution environments whose capabilities
2N/Aare more controlled than those of the standard shell.
2N/AThe actions of <STRONG>rsh </STRONG>are identical to those of <STRONG>sh&nbsp;</STRONG>, except that the following
2N/Aare disallowed:
2N/A<DL COMPACT>
2N/A<BR>
2N/Achanging directory (see <A HREF="cd(1)"><EM>cd</EM>(1)</A>), <BR>
2N/Asetting or unsetting the value or attributes of <FONT SIZE=-1><STRONG>SHELL</STRONG>, </FONT><FONT SIZE=-1><STRONG>ENV</STRONG>, </FONT>or <FONT SIZE=-1><STRONG>PATH</STRONG></FONT><FONT SIZE=-2>0, </FONT><BR>
2N/Aspecifying path or command names containing <STRONG>/</STRONG>, <BR>
2N/Aredirecting output (<STRONG>&gt;</STRONG>, <STRONG>&gt;|</STRONG>, <STRONG>&lt;&gt;</STRONG>, and <STRONG>&gt;&gt;</STRONG>).
2N/A<BR>
2N/Aadding or deleting built-in commands.
2N/A</DL><P>
2N/AThe restrictions above are enforced after <STRONG>.profile</STRONG> and the <FONT SIZE=-1><STRONG>ENV </STRONG></FONT>files are
2N/Ainterpreted.
2N/A<P>
2N/AWhen a command to be executed is found to be a shell procedure, <STRONG>rsh </STRONG>invokes
2N/A<EM>sh&nbsp; </EM>to execute it.
2N/AThus, it is possible to provide to the end-user shell procedures that have
2N/Aaccess to the full power of the standard shell, while imposing a limited
2N/Amenu of commands; this scheme assumes that the end-user does not have write
2N/Aand execute permissions in the same directory.
2N/A<P>
2N/AThe net effect of these rules is that the writer of the <STRONG>.profile </STRONG>has complete
2N/Acontrol over user actions, by performing guaranteed setup actions and leaving
2N/Athe user in an appropriate directory (probably <EM>not </EM>the login directory).
2N/A<P>
2N/AThe system administrator often sets up a directory of commands (e.g., <STRONG>/usr/rbin</STRONG>)
2N/Athat can be safely invoked by <STRONG>rsh</STRONG>.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="EXIT STATUS">EXIT &nbsp;STATUS &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>Errors detected by the shell, such as syntax errors, cause the shell to
2N/Areturn a non-zero exit status.
2N/AOtherwise, the shell returns the exit status of the last command executed
2N/A(see also the <A HREF="#exit"><STRONG>exit </STRONG></A>command above).
2N/AIf the shell is being used non-interactively, then execution of the shell
2N/Afile is abandoned.
2N/ARun time errors detected by the shell are reported by printing the command
2N/Aor function name and the error condition.
2N/AIf the line number that the error occurred on is greater than one, then
2N/Athe line number is also printed in square brackets (<STRONG>[]</STRONG>) after the command
2N/Aor function name.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="FILES">FILES &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>/etc/passwd <BR>
2N/A/etc/profile <BR>
2N/A/etc/suid_profile <FONT SIZE=-1><BR>
2N/A$HOME</FONT>/<STRONG>.</STRONG>profile <BR>
2N/A/tmp/sh* <BR>
2N/A/dev/null <FONT SIZE=-1><STRONG>
2N/A<P>
2N/A<DT>
2N/A<H3><A NAME="SEE ALSO">SEE &nbsp;ALSO &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>cat(1), cd(1), chmod(1), cut(1), echo(1), emacs(1), env(1), gmacs(1), newgrp(1),
2N/Astty(1), test(1), umask(1), vi(1), dup(2), exec(2), fork(2), ioctl(2),
2N/Alseek(2), paste(1), pathconf(2), pipe(2), sysconf(2), umask(2), ulimit(2),
2N/Await(2), rand(3), a.out(5), profile(5), environ(7).
2N/A<P>
2N/AMorris I.
2N/ABolsky and David G.
2N/AKorn, <EM>The New KornShell Command and Programming Language</EM>, Prentice Hall,
2N/A1995.
2N/A<EM><P>
2N/APOSIX &#045; Part 2: Shell and Utilities, </EM>IEEE Std 1003.2-1992, ISO/IEC 9945-2,
2N/AIEEE, 1993.
2N/A<FONT SIZE=-1><STRONG><P>
2N/A<DT>
2N/A<H3><A NAME="CAVEATS">CAVEATS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </A></H3>
2N/A<DD></STRONG></FONT>If a command is executed, and then a command with the same name is installed
2N/Ain a directory in the search path before the directory where the original
2N/Acommand was found, the shell will continue to <EM>exec </EM>the original command.
2N/AUse the <STRONG>&#045;t </STRONG>option of the <STRONG>alias </STRONG>command to correct this situation.
2N/A<P>
2N/ASome very old shell scripts contain a <STRONG>^ </STRONG>as a synonym for the pipe character
2N/A<STRONG>|</STRONG>.
2N/A<P>
2N/AUsing the <STRONG>hist </STRONG>built-in command within a compound command will cause the
2N/Awhole command to disappear from the history file.
2N/A<P>
2N/AThe built-in command <STRONG>&nbsp;.</STRONG> <EM>file&nbsp;</EM> reads the whole file before any commands
2N/Aare executed.
2N/ATherefore, <STRONG>alias </STRONG>and <STRONG>unalias </STRONG>commands in the file will not apply to any
2N/Acommands defined in the file.
2N/A<P>
2N/ATraps are not processed while a job is waiting for a foreground process.
2N/AThus, a trap on <STRONG>CHLD </STRONG>won't be executed until the foreground job terminates.
2N/A<P>
2N/AIt is a good idea to leave a space after the comma operator in arithmetic
2N/Aexpressions to prevent the comma from being interpreted as the decimal
2N/Apoint character in certain locales.
2N/A</DL><HR>
2N/A<H3><TABLE WIDTH=100%><TR><TH ALIGN=LEFT>&nbsp;Sun Release 4.0&nbsp;<TH ALIGN=CENTER>Last change:<TH ALIGN=RIGHT>1b</TABLE>
2N/A</H3>
2N/A</BODY></HTML>
2N/A