'\" t .\" Title: POSH .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: 01/24/2011 .\" Manual: User commands .\" Source: User commands .\" Language: English .\" .TH "POSH" "1" "01/24/2011" "User commands" "User commands" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" posh \- Policy\-compliant Ordinary SHell .SH "SYNOPSIS" .HP \w'\fBposh\fR\ 'u \fBposh\fR [+\-aCefilnuvx] [+\-o\ \fIoption\fR] [[\-c\ \fIcommand\-string\fR\ [\fIcommand\-name\fR]\ |\ \-s\ |\ \fIfile\fR\ ]\ [\fIargument\fR...]] .SH "DESCRIPTION" .PP \fBposh\fR is a reimplementation of the Bourne shell, a command interpreter for both interactive and script use\&. .SS "Shell Startup" .PP The following options can be specified only on the command line: .PP \fB\-c\fR \fIcommand\-string\fR .RS 4 the shell executes the command(s) contained in \fIcommand\-string\fR .RE .PP \fB\-i\fR .RS 4 interactive mode \(em see below .RE .PP \fB\-l\fR .RS 4 login shell \(em see below interactive mode \(em see below .RE .PP \fB\-s\fR .RS 4 the shell reads commands from standard input; all non\-option arguments are positional parameters .RE .PP In addition to the above, the options described in the \fBset\fR builtin command can also be used on the command line\&. .PP If neither the \fB\-c\fR nor the \fB\-s\fR options are specified, the first non\-option argument specifies the name of a file the shell reads commands from; if there are no non\-option arguments, the shell reads commands from standard input\&. The name of the shell (\fIi\&.e\&.\fR, the contents of the \fB$0\fR) parameter is determined as follows: if the \fB\-c\fR option is used and there is a non\-option argument, it is used as the name; if commands are being read from a file, the file is used as the name; otherwise the name the shell was called with (\fIi\&.e\&.\fR, argv[0]) is used\&. .PP A shell is \fBinteractive\fR if the \fB\-i\fR option is used or if both standard input and standard error are attached to a tty\&. An interactive shell has job control enabled (if available), ignores the INT, QUIT and TERM signals, and prints prompts before reading input (see \fBPS1\fR and \fBPS2\fR parameters)\&. .PP A shell is \fBprivileged\fR if the \fB\-p\fR option is used or if the real user\-id or group\-id does not match the effective user\-id or group\-id (see \fBgetuid\fR(2), \fBgetgid\fR(2))\&. A privileged shell does not process $HOME/\&.profile\&. Instead the file /etc/suid_profile is processed\&. Clearing the privileged option causes the shell to set its effective user\-id (group\-id) to its real user\-id (group\-id)\&. .PP If the basename of the name the shell is called with (\fIi\&.e\&.\fR, argv[0]) starts with \fB\-\fR or if the \fB\-l\fR option is used, the shell is assumed to be a login shell and the shell reads and executes the contents of /etc/profile and $HOME/\&.profile if they exist and are readable\&. .PP The exit status of the shell is 127 if the command file specified on the command line could not be opened, or non\-zero if a fatal syntax error occurred during the execution of a script\&. In the absence of fatal errors, the exit status is that of the last command executed, or zero, if no command is executed\&. .SS "Command Syntax" .PP The shell begins parsing its input by breaking it into words\&. Words, which are sequences of characters, are delimited by unquoted white\-space characters (space, tab and newline) or meta\-characters (<, >, |, ;, &, ( and ))\&. Aside from delimiting words, spaces and tabs are ignored, while newlines usually delimit commands\&. The meta\-characters are used in building the following tokens: <, <&, <<, >, >&, >>, etc\&. are used to specify redirections (see Input/Output Redirection below); | is used to create pipelines; ; is used to separate commands; & is used to create asynchronous pipelines; && and || are used to specify conditional execution; ;; is used in case statements; and lastly, ( \&.\&.\&. ) are used to create subshells\&. .PP White\-space and meta\-characters can be quoted individually using backslash (\fB\e\fR), or in groups using double (\fB"\fR) or single (\fB\*(Aq\fR) quotes\&. Note that the following characters are also treated specially by the shell and must be quoted if they are to represent themselves: \fB\e\fR, \fB"\fR, \fB\*(Aq\fR, \fB#\fR, \fB$\fR, \fB`\fR, \fB~\fR, \fB{\fR, \fB}\fR, \fB*\fR, \fB?\fR and \fB[\fR\&. The first three of these are the above mentioned quoting characters (see Quoting below); \fB#\fR, if used at the beginning of a word, introduces a comment \(em everything after the \fB#\fR up to the nearest newline is ignored; \fB$\fR is used to introduce parameter, command and arithmetic substitutions (see Substitution below); \fB`\fR introduces an old\-style command substitution (see Substitution below); \fB~\fR begins a directory expansion (see Tilde Expansion below); \fB{\fR and \fB}\fR delimit \fBcsh\fR(1) style alternations (see Brace Expansion below); and, finally, \fB*\fR, \fB?\fR and \fB[\fR are used in file name generation (see File Name Patterns below)\&. .PP As words and tokens are parsed, the shell builds commands, of which there are two basic types: \fIsimple\-commands\fR, typically programs that are executed, and \fIcompound\-commands\fR, such as \fBfor\fR and \fBif\fR statements, grouping constructs and function definitions\&. .PP A simple\-command consists of some combination of parameter assignments (see Parameters below), input/output redirections (see Input/Output Redirections below), and command words; the only restriction is that parameter assignments come before any command words\&. The command words, if any, define the command that is to be executed and its arguments\&. The command may be a shell built\-in command, a function or an \fIexternal command\fR, \fIi\&.e\&.\fR, a separate executable file that is located using the \fBPATH\fR parameter (see Command Execution below)\&. Note that all command constructs have an \fIexit status\fR: for external commands, this is related to the status returned by \fBwait\fR(2) (if the command could not be found, the exit status is 127, if it could not be executed, the exit status is 126); the exit status of other command constructs (built\-in commands, functions, compound\-commands, pipelines, lists, \fIetc\&.\fR) are all well defined and are described where the construct is described\&. The exit status of a command consisting only of parameter assignments is that of the last command substitution performed during the parameter assignment or zero if there were no command substitutions\&. .PP Commands can be chained together using the \fB|\fR token to form \fIpipelines\fR, in which the standard output of each command but the last is piped (see \fBpipe\fR(2)) to the standard input of the following command\&. The exit status of a pipeline is that of its last command\&. A pipeline may be prefixed by the \fB!\fR reserved word which causes the exit status of the pipeline to be logically complemented: if the original status was 0 the complemented status will be 1, and if the original status was not 0, then the complemented status will be 0\&. .PP \fILists\fR of commands can be created by separating pipelines by any of the following tokens: \fB&&\fR, \fB||\fR, \fB&\fR, \fB|&\fR and \fB;\fR\&. The first two are for conditional execution: \fIcmd1\fR \fB&&\fR \fIcmd2\fR executes \fIcmd2\fR only if the exit status of \fIcmd1\fR is zero; \fB||\fR is the opposite \(em \fIcmd2\fR is executed only if the exit status of \fIcmd1\fR is non\-zero\&. \fB&&\fR and \fB||\fR have equal precedence which is higher than that of \fB&\fR, \fB|&\fR and \fB;\fR, which also have equal precedence\&. The \fB&\fR token causes the preceding command to be executed asynchronously, that is, the shell starts the command, but does not wait for it to complete (the shell does keep track of the status of asynchronous commands \(em see Job Control below)\&. When an asynchronous command is started when job control is disabled (\fIi\&.e\&.\fR, in most scripts), the command is started with signals INT and QUIT ignored and with input redirected from /dev/null (however, redirections specified in the asynchronous command have precedence)\&. Note that a command must follow the \fB&&\fR and \fB||\fR operators, while a command need not follow \fB&\fR, \fB|&\fR and \fB;\fR\&. The exit status of a list is that of the last command executed, with the exception of asynchronous lists, for which the exit status is 0\&. .PP Compound commands are created using the following reserved words \(em these words are only recognized if they are unquoted and if they are used as the first word of a command (\fIi\&.e\&.\fR, they can\*(Aqt be preceded by parameter assignments or redirections): .TS center tab(:); cB rB l l l. T{ case T}:T{ else T}:T{ \ \& T}:T{ \ \& T}:T{ \ \& T} .T& l l l l l l l l l l l l l l l. T{ do T}:T{ esac T}:T{ if T}:T{ time T}:T{ [[ T} T{ done T}:T{ fi T}:T{ in T}:T{ until T}:T{ { T} T{ elif T}:T{ for T}:T{ select T}:T{ while T}:T{ } T} .TE .sp 1 .PP \fBNote:\fR Some shells (but not this one) execute control structure commands in a subshell when one or more of their file descriptors are redirected, so any environment changes inside them may fail\&. To be portable, the \fBexec\fR statement should be used instead to redirect file descriptors before the control structure\&. .PP In the following compound command descriptions, command lists (denoted as \fIlist\fR) that are followed by reserved words must end with a semi\-colon, a newline or a (syntactically correct) reserved word\&. For example, \fB{ echo foo; echo bar; }\fR \fB{ echo foo; echo bar}\fR \fB{ { echo foo; echo bar; } }\fR are all valid, but \fB{ echo foo; echo bar }\fR is not\&. .PP \fB(\fR \fIlist\fR \fB)\fR .RS 4 Execute \fIlist\fR in a subshell\&. There is no implicit way to pass environment changes from a subshell back to its parent\&. .RE .PP \fB{\fR \fIlist\fR \fB}\fR .RS 4 Compound construct; \fIlist\fR is executed, but not in a subshell\&. Note that \fB{\fR and \fB}\fR are reserved words, not meta\-characters\&. .RE .PP \fBcase\fR \fIword\fR \fBin\fR [ [\fB(\fR] \fIpattern\fR [\fB|\fR \fIpattern\fR] \&.\&.\&. \fB)\fR \fIlist\fR \fB;;\fR ] \&.\&.\&. \fBesac\fR .RS 4 The \fBcase\fR statement attempts to match \fIword\fR against the specified \fIpattern\fRs; the \fIlist\fR associated with the first successfully matched pattern is executed\&. Patterns used in \fBcase\fR statements are the same as those used for file name patterns except that the restrictions regarding \fB\&.\fR and \fB/\fR are dropped\&. Note that any unquoted space before and after a pattern is stripped; any space with a pattern must be quoted\&. Both the word and the patterns are subject to parameter, command, and arithmetic substitution as well as tilde substitution\&. For historical reasons, open and close braces may be used instead of \fBin\fR and \fBesac\fR (\fIe\&.g\&.\fR, \fBcase $foo { *) echo bar; }\fR)\&. The exit status of a \fBcase\fR statement is that of the executed \fIlist\fR; if no \fIlist\fR is executed, the exit status is zero\&. .RE .PP \fBfor\fR \fIname\fR [ \fBin\fR \fIword\fR \&.\&.\&. \fIterm\fR ] \fBdo\fR \fIlist\fR \fBdone\fR .RS 4 where \fIterm\fR is either a newline or a \fB;\fR\&. For each \fIword\fR in the specified word list, the parameter \fIname\fR is set to the word and \fIlist\fR is executed\&. If \fBin\fR is not used to specify a word list, the positional parameters (\fB"$1"\fR, \fB"$2"\fR, \fIetc\&.\fR) are used instead\&. For historical reasons, open and close braces may be used instead of \fBdo\fR and \fBdone\fR (\fIe\&.g\&.\fR, \fBfor i; { echo $i; }\fR)\&. The exit status of a \fBfor\fR statement is the last exit status of \fIlist\fR; if \fIlist\fR is never executed, the exit status is zero\&. .RE .PP \fBif\fR \fIlist\fR \fBthen\fR \fIlist\fR [\fBelif\fR \fIlist\fR \fBthen\fR \fIlist\fR] \&.\&.\&. [\fBelse\fR \fIlist\fR] \fBfi\fR .RS 4 If the exit status of the first \fIlist\fR is zero, the second \fIlist\fR is executed; otherwise the \fIlist\fR following the \fBelif\fR, if any, is executed with similar consequences\&. If all the lists following the \fBif\fR and \fBelif\fRs fail (\fIi\&.e\&.\fR, exit with non\-zero status), the \fIlist\fR following the \fBelse\fR is executed\&. The exit status of an \fBif\fR statement is that of non\-conditional \fIlist\fR that is executed; if no non\-conditional \fIlist\fR is executed, the exit status is zero\&. .RE .PP \fBuntil\fR \fIlist\fR \fBdo\fR \fIlist\fR \fBdone\fR .RS 4 This works like \fBwhile\fR, except that the body is executed only while the exit status of the first \fIlist\fR is non\-zero\&. .RE .PP \fBwhile\fR \fIlist\fR \fBdo\fR \fIlist\fR \fBdone\fR .RS 4 A \fBwhile\fR is a prechecked loop\&. Its body is executed as often as the exit status of the first \fIlist\fR is zero\&. The exit status of a \fBwhile\fR statement is the last exit status of the \fIlist\fR in the body of the loop; if the body is not executed, the exit status is zero\&. .RE .PP \fIname\fR \fB()\fR \fIcommand\fR .RS 4 Defines the function \fIname\fR\&. See Functions below\&. Note that redirections specified after a function definition are performed whenever the function is executed, not when the function definition is executed\&. .RE .PP \fBtime\fR [ \fB\-p\fR ] [ \fIpipeline\fR ] .RS 4 The \fBtime\fR reserved word is described in the Command Execution section\&. .RE .SS "Quoting" .PP Quoting is used to prevent the shell from treating characters or words specially\&. There are three methods of quoting: First, \fB\e\fR quotes the following character, unless it is at the end of a line, in which case both the \fB\e\fR and the newline are stripped\&. Second, a single quote (\fB\*(Aq\fR) quotes everything up to the next single quote (this may span lines)\&. Third, a double quote (\fB"\fR) quotes all characters, except \fB$\fR, \fB`\fR and \fB\e\fR, up to the next unquoted double quote\&. \fB$\fR and \fB`\fR inside double quotes have their usual meaning (\fIi\&.e\&.\fR, parameter, command or arithmetic substitution) except no field splitting is carried out on the results of double\-quoted substitutions\&. If a \fB\e\fR inside a double\-quoted string is followed by \fB\e\fR, \fB$\fR, \fB`\fR or \fB"\fR, it is replaced by the second character; if it is followed by a newline, both the \fB\e\fR and the newline are stripped; otherwise, both the \fB\e\fR and the character following are unchanged\&. .PP Note: see POSIX Mode below for a special rule regarding sequences of the form \fB"\fR\&.\&.\&.\fB`\fR\&.\&.\&.\fB\e"\fR\&.\&.\&.\fB`\fR\&.\&.\fB"\fR\&. .SS "Substitution" .PP The first step the shell takes in executing a simple\-command is to perform substitutions on the words of the command\&. There are three kinds of substitution: parameter, command and arithmetic\&. Parameter substitutions, which are described in detail in the next section, take the form \fB$name\fR or \fB${\fR\&.\&.\&.\fB}\fR; command substitutions take the form \fB$(\fR\fIcommand\fR\fB)\fR or \fB`\fR\fIcommand\fR\fB`\fR; and arithmetic substitutions take the form \fB$((\fR\fIexpression\fR\fB))\fR\&. .PP If a substitution appears outside of double quotes, the results of the substitution are generally subject to word or field splitting according to the current value of the \fBIFS\fR parameter\&. The \fBIFS\fR parameter specifies a list of characters which are used to break a string up into several words; any characters from the set space, tab and newline that appear in the IFS characters are called \fIIFS white space\fR\&. Sequences of one or more IFS white space characters, in combination with zero or one non\-IFS white space characters delimit a field\&. As a special case, leading and trailing IFS white space is stripped (\fIi\&.e\&.\fR, no leading or trailing empty field is created by it); leading or trailing non\-IFS white space does create an empty field\&. Example: if \fBIFS\fR is set to `:\*(Aq, the sequence of characters `A:B::D\*(Aq contains four fields: `A\*(Aq, `B\*(Aq, `\*(Aq and `D\*(Aq\&. Note that if the \fBIFS\fR parameter is set to the null string, no field splitting is done; if the parameter is unset, the default value of space, tab and newline is used\&. .PP The results of substitution are, unless otherwise specified, also subject to brace expansion and file name expansion (see the relevant sections below)\&. .PP A command substitution is replaced by the output generated by the specified command, which is run in a subshell\&. For \fB$(\fR\fIcommand\fR\fB)\fR substitutions, normal quoting rules are used when \fIcommand\fR is parsed, however, for the \fB`\fR\fIcommand\fR\fB`\fR form, a \fB\e\fR followed by any of \fB$\fR, \fB`\fR or \fB\e\fR is stripped (a \fB\e\fR followed by any other character is unchanged)\&. As a special case in command substitutions, a command of the form \fB<\fR \fIfile\fR is interpreted to mean substitute the contents of \fIfile\fR ($(< foo) has the same effect as $(cat foo), but it is carried out more efficiently because no process is started)\&. NOTE: \fB$(\fR\fIcommand\fR\fB)\fR expressions are currently parsed by finding the matching parenthesis, regardless of quoting\&. This will hopefully be fixed soon\&. .PP Arithmetic substitutions are replaced by the value of the specified expression\&. For example, the command \fBecho $((2+3*4))\fR prints 14\&. See Arithmetic Expressions for a description of an \fIexpression\fR\&. .SS "Parameters" .PP Parameters are shell variables; they can be assigned values and their values can be accessed using a parameter substitution\&. A parameter name is either one of the special single punctuation or digit character parameters described below, or a letter followed by zero or more letters or digits (`_\*(Aq counts as a letter)\&. The later form can be treated as arrays by appending an array index of the form: \fB[\fR\fIexpr\fR\fB]\fR where \fIexpr\fR is an arithmetic expression\&. Array indices are currently limited to the range 0 through 1023, inclusive\&. Parameter substitutions take the form \fB$\fR\fIname\fR, \fB${\fR\fIname\fR\fB}\fR or \fB${\fR\fIname\fR\fB[\fR\fIexpr\fR\fB]}\fR, where \fIname\fR is a parameter name\&. If substitution is performed on a parameter (or an array parameter element) that is not set, a null string is substituted unless the \fBnounset\fR option (\fBset \-o nounset\fR or \fBset \-u\fR) is set, in which case an error occurs\&. .PP Parameters can be assigned values in a number of ways\&. First, the shell implicitly sets some parameters like \fB#\fR, \fBPWD\fR, etc\&.; this is the only way the special single character parameters are set\&. Second, parameters are imported from the shell\*(Aqs environment at startup\&. Third, parameters can be assigned values on the command line, for example, `\fBFOO=bar\fR\*(Aq sets the parameter FOO to bar; multiple parameter assignments can be given on a single command line and they can be followed by a simple\-command, in which case the assignments are in effect only for the duration of the command (such assignments are also exported, see below for implications of this)\&. Note that both the parameter name and the \fB=\fR must be unquoted for the shell to recognize a parameter assignment\&. The fourth way of setting a parameter is with the \fBexport\fR and \fBreadonly\fR commands; see their descriptions in the Command Execution section\&. Fifth, \fBfor\fR and \fBselect\fR loops set parameters as well as the \fBgetopts\fR, \fBread\fR and \fBset \-A\fR commands\&. Lastly, parameters can be assigned values using assignment operators inside arithmetic expressions (see Arithmetic Expressions below) or using the \fB${\fR\fIname\fR\fB=\fR\fIvalue\fR\fB}\fR form of parameter substitution (see below)\&. .PP Parameters with the export attribute (set using the \fBexport\fR command, or by parameter assignments followed by simple commands) are put in the environment (see \fBenviron\fR(5)) of commands run by the shell as \fIname\fR\fB=\fR\fIvalue\fR pairs\&. The order in which parameters appear in the environment of a command is unspecified\&. When the shell starts up, it extracts parameters and their values from its environment and automatically sets the export attribute for those parameters\&. .PP Modifiers can be applied to the \fB${\fR\fIname\fR\fB}\fR form of parameter substitution: .PP \fB${\fR\fIname\fR\fB:\-\fR\fIword\fR\fB}\fR .RS 4 if \fIname\fR is set and not null, it is substituted, otherwise \fIword\fR is substituted\&. .RE .PP \fB${\fR\fIname\fR\fB:+\fR\fIword\fR\fB}\fR .RS 4 if \fIname\fR is set and not null, \fIword\fR is substituted, otherwise nothing is substituted\&. .RE .PP \fB${\fR\fIname\fR\fB:=\fR\fIword\fR\fB}\fR .RS 4 if \fIname\fR is set and not null, it is substituted, otherwise it is assigned \fIword\fR and the resulting value of \fIname\fR is substituted\&. .RE .PP \fB${\fR\fIname\fR\fB:?\fR\fIword\fR\fB}\fR .RS 4 if \fIname\fR is set and not null, it is substituted, otherwise \fIword\fR is printed on standard error (preceded by \fIname\fR:) and an error occurs (normally causing termination of a shell script, function or \&.\-script)\&. If word is omitted the string `parameter null or not set\*(Aq is used instead\&. .RE .PP In the above modifiers, the \fB:\fR can be omitted, in which case the conditions only depend on \fIname\fR being set (as opposed to set and not null)\&. If \fIword\fR is needed, parameter, command, arithmetic and tilde substitution are performed on it; if \fIword\fR is not needed, it is not evaluated\&. .PP The following forms of parameter substitution can also be used: .PP \fB${#\fR\fIname\fR\fB}\fR .RS 4 The number of positional parameters if \fIname\fR is \fB*\fR, \fB@\fR or is not specified, or the length of the string value of parameter \fIname\fR\&. .RE .PP \fB${#\fR\fIname\fR\fB[*]}\fR, \fB${#\fR\fIname\fR\fB[@]}\fR .RS 4 The number of elements in the array \fIname\fR\&. .RE .PP \fB${\fR\fIname\fR\fB#\fR\fIpattern\fR\fB}\fR, \fB${\fR\fIname\fR\fB##\fR\fIpattern\fR\fB}\fR .RS 4 If \fIpattern\fR matches the beginning of the value of parameter \fIname\fR, the matched text is deleted from the result of substitution\&. A single \fB#\fR results in the shortest match, two \fB#\fR\*(Aqs results in the longest match\&. .RE .PP \fB${\fR\fIname\fR\fB%\fR\fIpattern\fR\fB}\fR, \fB${\fR\fIname\fR\fB%%\fR\fIpattern\fR\fB}\fR .RS 4 Like \fB${\fR\&.\&.\fB#\fR\&.\&.\fB}\fR substitution, but it deletes from the end of the value\&. .RE .PP The following special parameters are implicitly set by the shell and cannot be set directly using assignments: .PP \fB!\fR .RS 4 Process id of the last background process started\&. If no background processes have been started, the parameter is not set\&. .RE .PP \fB#\fR .RS 4 The number of positional parameters (\fIi\&.e\&.\fR, \fB$1\fR, \fB$2\fR, \fIetc\&.\fR)\&. .RE .PP \fB$\fR .RS 4 The process ID of the shell, or the PID of the original shell if it is a subshell\&. .RE .PP \fB\-\fR .RS 4 The concatenation of the current single letter options (see \fBset\fR command below for list of options)\&. .RE .PP \fB?\fR .RS 4 The exit status of the last non\-asynchronous command executed\&. If the last command was killed by a signal, \fB$?\fR is set to 128 plus the signal number\&. .RE .PP \fI0\fR .RS 4 The name the shell was invoked with (that is, \fIargv[0]\fR), or the \fB\fIcommand\-name\fR\fR if it was invoked with the \fB\-c\fR option and the \fB\fIcommand\-name\fR\fR was supplied, or the \fIfile\fR argument, if it was supplied\&. If the \fBposix\fR option is not set, \fB$0\fR is the name of the current function or script\&. .RE .PP \fI1\fR \&.\&.\&. \fI9\fR .RS 4 The first nine positional parameters that were supplied to the shell, function or \fB\&.\fR\-script\&. Further positional parameters may be accessed using \fI${\fR\fI\fInumber\fR\fR\fI}\fR\&. .RE .PP \fI*\fR .RS 4 All positional parameters (except parameter 0), \fIi\&.e\&.\fR, \fB$1 $2 $3\fR\&.\&.\&.\&. If used outside of double quotes, parameters are separate words (which are subjected to word splitting); if used within double quotes, parameters are separated by the first character of the \fBIFS\fR parameter (or the empty string if \fBIFS\fR is null)\&. .RE .PP \fI@\fR .RS 4 Same as \fB$*\fR, unless it is used inside double quotes, in which case a separate word is generated for each positional parameter \- if there are no positional parameters, no word is generated ("$@" can be used to access arguments, verbatim, without loosing null arguments or splitting arguments with spaces)\&. .RE .PP The following parameters are set and/or used by the shell: .PP "\fBCDPATH\fR" .RS 4 Search path for the \fBcd\fR built\-in command\&. Works the same way as \fBPATH\fR for those directories not beginning with \fB/\fR in \fBcd\fR commands\&. Note that if CDPATH is set and does not contain \&. nor an empty path, the current directory is not searched\&. .RE .PP \fBCOLUMNS\fR .RS 4 Set to the number of columns on the terminal or window\&. Currently set to the \fBcols\fR value as reported by \fBstty\fR(1) if that value is non\-zero\&. This parameter is used by the interactive line editing modes, and by \fBselect\fR, \fBset \-o\fR and \fBkill \-l\fR commands to format information in columns\&. .RE .PP \fBERRNO\fR .RS 4 Integer value of the shell\*(Aqs errno variable \(em indicates the reason the last system call failed\&. .sp Not implemented yet\&. .RE .PP \fBEXECSHELL\fR .RS 4 If set, this parameter is assumed to contain the shell that is to be used to execute commands that \fBexecve\fR(2) fails to execute and which do not start with a `\fB#!\fR \fIshell\fR\*(Aq sequence\&. .RE .PP \fBFCEDIT\fR .RS 4 The editor used by the \fBfc\fR command (see below)\&. .RE .PP \fBFPATH\fR .RS 4 Like \fBPATH\fR, but used when an undefined function is executed to locate the file defining the function\&. It is also searched when a command can\*(Aqt be found using \fBPATH\fR\&. See Functions below for more information\&. .RE .PP \fBHOME\fR .RS 4 The default directory for the \fBcd\fR command and the value substituted for an unqualified \fB~\fR (see Tilde Expansion below)\&. .RE .PP \fBIFS\fR .RS 4 Internal field separator, used during substitution and by the \fBread\fR command, to split values into distinct arguments; normally set to space, tab and newline\&. See Substitution above for details\&. \fBNote:\fR this parameter is not imported from the environment when the shell is started\&. .RE .PP \fBPOSH_VERSION\fR .RS 4 The version of posh (readonly)\&. .RE .PP \fBLINENO\fR .RS 4 The line number of the function or shell script that is currently being executed\&. .RE .PP \fBLINES\fR .RS 4 Set to the number of lines on the terminal or window\&. .sp Not implemented yet\&. .RE .PP \fBOLDPWD\fR .RS 4 The previous working directory\&. Unset if \fBcd\fR has not successfully changed directories since the shell started, or if the shell doesn\*(Aqt know where it is\&. .RE .PP \fBOPTARG\fR .RS 4 When using \fBgetopts\fR, it contains the argument for a parsed option, if it requires one\&. .RE .PP \fBOPTIND\fR .RS 4 The index of the last argument processed when using \fBgetopts\fR\&. Assigning 1 to this parameter causes \fBgetopts\fR to process arguments from the beginning the next time it is invoked\&. .RE .PP \fBPATH\fR .RS 4 A colon separated list of directories that are searched when looking for commands and \&.\*(Aqd files\&. An empty string resulting from a leading or trailing colon, or two adjacent colons is treated as a `\&.\*(Aq, the current directory\&. .RE .PP \fBPPID\fR .RS 4 The process ID of the shell\*(Aqs parent (readonly)\&. .RE .PP \fBPS1\fR .RS 4 The primary prompt for interactive shells\&. The prompt is printed verbatim (\fIi\&.e\&.\fR, no substitutions are done)\&. Default is \(oq$\ \&\(cq for non\-root users, `\fB#\ \&\fR\*(Aq for root\&.\&. .RE .PP \fBPS2\fR .RS 4 Secondary prompt string, by default `\fB>\fR \*(Aq, used when more input is needed to complete a command\&. .RE .PP \fBPS4\fR .RS 4 Used to prefix commands that are printed during execution tracing (see \fBset \-x\fR command below)\&. The prompt is printed verbatim (\fIi\&.e\&.\fR, no substitutions are done)\&. Default is `\fB+\ \&\fR\*(Aq\&. .RE .PP \fBPWD\fR .RS 4 The current working directory\&. Maybe unset or null if shell doesn\*(Aqt know where it is\&. .RE .PP \fBREPLY\fR .RS 4 Default parameter for the \fBread\fR command if no names are given\&. Also used in \fBselect\fR loops to store the value that is read from standard input\&. .RE .PP \fBTMPDIR\fR .RS 4 The directory shell temporary files are created in\&. If this parameter is not set, or does not contain the absolute path of a writable directory, temporary files are created in /tmp\&. .RE .SS "Tilde Expansion" .PP Tilde expansion, which is done in parallel with parameter substitution, is done on words starting with an unquoted \fB~\fR\&. The characters following the tilde, up to the first \fB/\fR, if any, are assumed to be a login name\&. If the login name is empty, \fB+\fR or \fB\-\fR, the value of the \fBHOME\fR, \fBPWD\fR, or \fBOLDPWD\fR parameter is substituted, respectively\&. Otherwise, the password file is searched for the login name, and the tilde expression is substituted with the user\*(Aqs home directory\&. If the login name is not found in the password file or if any quoting or parameter substitution occurs in the login name, no substitution is performed\&. .PP In parameter assignments (those preceding a simple\-command or those occurring in the arguments of \fBalias\fR, \fBexport\fR, and \fBreadonly\fR, tilde expansion is done after any unquoted colon (\fB:\fR), and login names are also delimited by colons\&. .PP The home directory of previously expanded login names are cached and re\-used\&. The \fBalias \-d\fR command may be used to list, change and add to this cache (\fIe\&.g\&.\fR, `alias \-d fac=/usr/local/facilities; cd ~fac/bin\*(Aq)\&. .SS "File Name Patterns" .PP A file name pattern is a word containing one or more unquoted \fB?\fR or \fB*\fR characters or \fB[\fR\&.\&.\fB]\fR sequences\&. Once brace expansion has been performed, the shell replaces file name patterns with the sorted names of all the files that match the pattern (if no files match, the word is left unchanged)\&. The pattern elements have the following meaning: .PP "\fB?\fR" .RS 4 matches any single character\&. .RE .PP \fB*\fR .RS 4 matches any sequence of characters\&. .RE .PP \fB[\fR\&.\&.\fB]\fR .RS 4 matches any of the characters inside the brackets\&. Ranges of characters can be specified by separating two characters by a \fB\-\fR, \fIe\&.g\&.\fR, \fB[a0\-9]\fR matches the letter \fBa\fR or any digit\&. In order to represent itself, a \fB\-\fR must either be quoted or the first or last character in the character list\&. Similarly, a \fB]\fR must be quoted or the first character in the list if it is represent itself instead of the end of the list\&. Also, a \fB!\fR appearing at the start of the list has special meaning (see below), so to represent itself it must be quoted or appear later in the list\&. .RE .PP \fB[!\fR\&.\&.\fB]\fR .RS 4 like \fB[\fR\&.\&.\fB]\fR, except it matches any character not inside the brackets\&. .RE .PP Note that posh currently never matches \&. and \&.\&., but the original ksh, Bourne sh and bash do, so this may have to change (too bad)\&. .PP Note that none of the above pattern elements match either a period (\&.) at the start of a file name or a slash (\fB/\fR), even if they are explicitly used in a \fB[\fR\&.\&.\fB]\fR sequence; also, the names \&. and \&.\&. are never matched, even by the pattern \fB\&.*\fR\&. .PP The POSIX character classes (\fIi\&.e\&.\fR, \fB[:\fR\fIclass\-name\fR\fB:]\fR inside a \fB[\fR\&.\&.\fB]\fR expression) are not yet implemented\&. .SS "Input/Output Redirection" .PP When a command is executed, its standard input, standard output and standard error (file descriptors 0, 1 and 2, respectively) are normally inherited from the shell\&. Three exceptions to this are commands in pipelines, for which standard input and/or standard output are those set up by the pipeline, asynchronous commands created when job control is disabled, for which standard input is initially set to be from /dev/null, and commands for which any of the following redirections have been specified: .PP "\fB>\fR \fIfile\fR" .RS 4 standard output is redirected to \fIfile\fR\&. If \fIfile\fR does not exist, it is created; if it does exist, is a regular file and the \fBnoclobber\fR option is set, an error occurs, otherwise the file is truncated\&. Note that this means the command \fIcmd < foo > foo\fR will open \fIfoo\fR for reading and then truncate it when it opens it for writing, before \fIcmd\fR gets a chance to actually read \fIfoo\fR\&. .RE .PP "\fB>|\fR \fIfile\fR" .RS 4 same as \fB>\fR, except the file is truncated, even if the \fBnoclobber\fR option is set\&. .RE .PP "\fB>>\fR \fIfile\fR" .RS 4 same as \fB>\fR, except the file an existing file is appended to instead of being truncated\&. Also, the file is opened in append mode, so writes always go to the end of the file (see \fBopen\fR(2))\&. .RE .PP "\fB<\fR \fIfile\fR" .RS 4 standard input is redirected from \fIfile\fR, which is opened for reading\&. .RE .PP "\fB<>\fR \fIfile\fR" .RS 4 same as \fB<\fR, except the file is opened for reading and writing\&. .RE .PP "\fB<<\fR \fImarker\fR" .RS 4 after reading the command line containing this kind of redirection (called a here document), the shell copies lines from the command source into a temporary file until a line matching \fImarker\fR is read\&. When the command is executed, standard input is redirected from the temporary file\&. If \fImarker\fR contains no quoted characters, the contents of the temporary file are processed as if enclosed in double quotes each time the command is executed, so parameter, command and arithmetic substitutions are performed, along with backslash (\fB\e\fR) escapes for \fB$\fR, \fB`\fR, \fB\e\fR and \fB\enewline\fR\&. If multiple here documents are used on the same command line, they are saved in order\&. .RE .PP "\fB<<\-\fR \fImarker\fR" .RS 4 same as \fB<<\fR, except leading tabs are stripped from lines in the here document\&. .RE .PP "\fB<&\fR \fIfd\fR" .RS 4 standard input is duplicated from file descriptor \fIfd\fR\&. \fIfd\fR can be a single digit, indicating the number of an existing file descriptor, the letter \fBp\fR, indicating the file descriptor associated with the output of the current co\-process, or the character \fB\-\fR, indicating standard input is to be closed\&. .RE .PP "\fB>&\fR \fIfd\fR" .RS 4 same as \fB<&\fR, except the operation is done on standard output\&. .RE .PP In any of the above redirections, the file descriptor that is redirected (\fIi\&.e\&.\fR, standard input or standard output) can be explicitly given by preceding the redirection with a single digit\&. Parameter, command and arithmetic substitutions, tilde substitutions and (if the shell is interactive) file name generation are all performed on the \fIfile\fR, \fImarker\fR and \fIfd\fR arguments of redirections\&. Note however, that the results of any file name generation are only used if a single file is matched; if multiple files match, the word with the unexpanded file name generation characters is used\&. .PP For simple\-commands, redirections may appear anywhere in the command, for compound\-commands (\fBif\fR statements, \fIetc\&.\fR), any redirections must appear at the end\&. Redirections are processed after pipelines are created and in the order they are given, so \fBcat /foo/bar 2>&1 > /dev/null | cat \-n\fR will print an error with a line number prepended to it\&. .SS "Arithmetic Expressions" .PP Integer arithmetic expressions can be used inside \fB$((\fR\&.\&.\fB))\fR expressions, inside array references (\fIe\&.g\&.\fR, \fIname\fR\fB[\fR\fIexpr\fR\fB]\fR), as numeric arguments to the \fBtest\fR command, and as the value of an assignment to an integer parameter\&. .PP Expression may contain alpha\-numeric parameter identifiers, array references, and integer constants and may be combined with the following C operators (listed and grouped in increasing order of precedence)\&. .PP Unary operators: .RS 4 \fB+ \- ! ~ ++ \-\-\fR .RE .PP Binary operators: .RS 4 \fB,\fR \fB= *= /= %= += \-= <<= >>= &= ^= |=\fR \fB||\fR \fB&&\fR \fB|\fR \fB^\fR \fB&\fR \fB== !=\fR \fB< <= >= >\fR \fB<< >>\fR \fB+ \-\fR \fB* / %\fR .RE .PP Ternary operator: .RS 4 \fB?:\fR (precedence is immediately higher than assignment) .RE .PP Grouping operators: .RS 4 \fB( )\fR .RE .PP Integer constants may be specified with arbitrary bases using the notation \fIbase\fR\fB#\fR\fInumber\fR, where \fIbase\fR is a decimal integer specifying the base, and \fInumber\fR is a number in the specified base\&. .PP The operators are evaluated as follows: .PP "unary \fB+\fR" .RS 4 result is the argument (included for completeness)\&. .RE .PP "unary \fB\-\fR" .RS 4 negation\&. .RE .PP "\fB!\fR" .RS 4 logical not; the result is 1 if argument is zero, 0 if not\&. .RE .PP "\fB~\fR" .RS 4 arithmetic (bit\-wise) not\&. .RE .PP "\fB++\fR" .RS 4 increment; must be applied to a parameter (not a literal or other expression) \- the parameter is incremented by 1\&. When used as a prefix operator, the result is the incremented value of the parameter, when used as a postfix operator, the result is the original value of the parameter\&. .RE .PP "\fB++\fR" .RS 4 similar to \fB++\fR, except the parameter is decremented by 1\&. .RE .PP "\fB,\fR" .RS 4 separates two arithmetic expressions; the left hand side is evaluated first, then the right\&. The result is value of the expression on the right hand side\&. .RE .PP "\fB=\fR" .RS 4 assignment; variable on the left is set to the value on the right\&. .RE .PP "\fB*= /= %= += \-= <<= >>= &= ^= |=\fR" .RS 4 assignment operators; \fI \fR\fB=\fR \fI\fR is the same as \fI\fR \fB=\fR \fI \fR \fB(\fR \fI\fR \fB)\fR\&. .RE .PP "\fB||\fR" .RS 4 logical or; the result is 1 if either argument is non\-zero, 0 if not\&. The right argument is evaluated only if the left argument is zero\&. .RE .PP "\fB&&\fR" .RS 4 logical and; the result is 1 if both arguments are non\-zero, 0 if not\&. The right argument is evaluated only if the left argument is non\-zero\&. .RE .PP "\fB|\fR" .RS 4 arithmetic (bit\-wise) or\&. .RE .PP "\fB^\fR" .RS 4 arithmetic (bit\-wise) exclusive\-or\&. .RE .PP "\fB&\fR" .RS 4 arithmetic (bit\-wise) and\&. .RE .PP "\fB==\fR" .RS 4 equal; the result is 1 if both arguments are equal, 0 if not\&. .RE .PP "\fB!=\fR" .RS 4 not equal; the result is 0 if both arguments are equal, 1 if not\&. .RE .PP "\fB<\fR" .RS 4 less than; the result is 1 if the left argument is less than the right, 0 if not\&. .RE .PP "\fB<= >= >\fR" .RS 4 less than or equal, greater than or equal, greater than\&. See <\&. .RE .PP "\fB<< >>\fR" .RS 4 shift left (right); the result is the left argument with its bits shifted left (right) by the amount given in the right argument\&. .RE .PP "\fB+ \- * /\fR" .RS 4 addition, subtraction, multiplication, and division\&. .RE .PP "\fB%\fR" .RS 4 remainder; the result is the remainder of the division of the left argument by the right\&. The sign of the result is unspecified if either argument is negative\&. .RE .PP "\fI\fR \fB?\fR \fI\fR \fB:\fR \fI\fR" .RS 4 if \fI\fR is non\-zero, the result is \fI\fR, otherwise \fI\fR\&. .RE .SS "Functions" .PP Functions are defined using the Bourne/POSIX shell \fIname\fR\fB()\fR syntax\&. Functions are like \&.\-scripts in that they are executed in the current environment, however, unlike \&.\-scripts, shell arguments (\fIi\&.e\&.\fR, positional parameters, \fB$1\fR, \fIetc\&.\fR) are never visible inside them\&. When the shell is determining the location of a command, functions are searched after special built\-in commands, and before regular and non\-regular built\-ins, and before the \fBPATH\fR is searched\&. .PP An existing function may be deleted using \fBunset \-f\fR \fIfunction\-name\fR\&. .PP Since functions are executed in the current shell environment, parameter assignments made inside functions are visible after the function completes\&. .PP The exit status of a function is that of the last command executed in the function\&. A function can be made to finish immediately using the \fBreturn\fR command; this may also be used to explicitly specify the exit status\&. .SS "Command Execution" .PP After evaluation of command line arguments, redirections and parameter assignments, the type of command is determined: a special built\-in, a function, a regular built\-in or the name of a file to execute found using the \fBPATH\fR parameter\&. The checks are made in the above order\&. Special built\-in commands differ from other commands in that the \fBPATH\fR parameter is not used to find them, an error during their execution can cause a non\-interactive shell to exit and parameter assignments that are specified before the command are kept after the command completes\&. Just to confuse things, if the posix option is turned off (see \fBset\fR command below) some special commands are very special in that no field splitting, file globbing, brace expansion nor tilde expansion is performed on arguments that look like assignments\&. Regular built\-in commands are different only in that the \fBPATH\fR parameter is not used to find them\&. .SS "Job Control" .PP Job control refers to the shell\*(Aqs ability to monitor and control \fBjobs\fR, which are processes or groups of processes created for commands or pipelines\&. At a minimum, the shell keeps track of the status of the background (\fIi\&.e\&.\fR, asynchronous) jobs that currently exist; this information can be displayed using the \fBjobs\fR command\&. If job control is fully enabled (using \fBset \-m\fR or \fBset \-o monitor\fR), as it is for interactive shells, the processes of a job are placed in their own process group, foreground jobs can be stopped by typing the suspend character from the terminal (normally ^Z), jobs can be restarted in either the foreground or background, using the \fBfg\fR and \fBbg\fR commands, respectively, and the state of the terminal is saved or restored when a foreground job is stopped or restarted, respectively\&. .PP Note that only commands that create processes (\fIe\&.g\&.\fR, asynchronous commands, subshell commands, and non\-built\-in, non\-function commands) can be stopped; commands like \fBread\fR cannot be\&. .PP When a job is created, it is assigned a job\-number\&. For interactive shells, this number is printed inside \fB[\fR\&.\&.\fB]\fR, followed by the process\-ids of the processes in the job when an asynchronous command is run\&. A job may be referred to in \fBbg\fR, \fBfg\fR, \fBjobs\fR, \fBkill\fR and \fBwait\fR commands either by the process id of the last process in the command pipeline (as stored in the \fB$!\fR parameter) or by prefixing the job\-number with a percent sign (\fB%\fR)\&. Other percent sequences can also be used to refer to jobs: .TS center tab(:); cB rB cB s. T{ %+ T}:T{ %+ T}:T{ The most recently stopped job, or, if there are no stopped jobs, the oldest running job\&. T} .T& c l l l c l l l c l l l c l l l c l l l. T{ %%, \fI%\fR T}:T{ %%, \fI%\fR T}:T{ Same as \fB%+\fR\&. T}:T{ \ \& T} T{ %\- T}:T{ %\- T}:T{ The job that would be the \fB%+\fR job, if the later did not exist\&. T}:T{ \ \& T} T{ %\fIn\fR T}:T{ %\fIn\fR T}:T{ The job with job\-number \fIn\fR\&. T}:T{ \ \& T} T{ %?\fIstring\fR T}:T{ %?\fIstring\fR T}:T{ The job containing the string \fIstring\fR (an error occurs if multiple jobs are matched)\&. T}:T{ \ \& T} T{ %\fIstring\fR T}:T{ %\fIstring\fR T}:T{ The job starting with string \fIstring\fR (an error occurs if multiple jobs are matched)\&. T}:T{ \ \& T} .TE .sp 1 .PP When a job changes state (\fIe\&.g\&.\fR, a background job finishes or foreground job is stopped), the shell prints the following status information: \fB[\fR\fInumber\fR\fB]\fR \fIflag status command\fR where .PP "\ \&\fInumber\fR" .RS 4 is the job\-number of the job\&. .RE .PP "\ \&\fIflag\fR" .RS 4 is \fB+\fR or \fB\-\fR if the job is the \fB%+\fR or \fB%\-\fR job, respectively, or space if it is neither\&. .RE .PP "\ \&\fIstatus\fR" .RS 4 indicates the current state of the job and can be .RE .PP "\fBRunning\fR" .RS 4 the job has neither stopped or exited (note that running does not necessarily mean consuming CPU time \(em the process could be blocked waiting for some event)\&. .RE .PP "\fBDone\fR [\fB(\fR\fInumber\fR\fB)\fR]" .RS 4 the job exited\&. \fInumber\fR is the exit status of the job, which is omitted if the status is zero\&. .RE .PP "\fBStopped\fR [\fB(\fR\fIsignal\fR\fB)\fR]" .RS 4 the job was stopped by the indicated \fIsignal\fR (if no signal is given, the job was stopped by SIGTSTP)\&. .RE .PP "\fIsignal\-description\fR [\fB(core dumped)\fR]" .RS 4 the job was killed by a signal (\fIe\&.g\&.\fR, Memory\ \&fault, Hangup, \fIetc\&.\fR \(em use \fBkill \-l\fR for a list of signal descriptions)\&. The \fB(core\ \&dumped)\fR message indicates the process created a core file\&. .RE .PP "\ \&\fIcommand\fR" .RS 4 is the command that created the process\&. If there are multiple processes in the job, then each process will have a line showing its \fIcommand\fR and possibly its \fIstatus\fR, if it is different from the status of the previous process\&. .RE .PP When an attempt is made to exit the shell while there are jobs in the stopped state, the shell warns the user that there are stopped jobs and does not exit\&. If another attempt is immediately made to exit the shell, the stopped jobs are sent a \fBHUP\fR signal and the shell exits\&. Similarly, if the \fBnohup\fR option is not set and there are running jobs when an attempt is made to exit a login shell, the shell warns the user and does not exit\&. If another attempt is immediately made to exit the shell, the running jobs are sent a \fBHUP\fR signal and the shell exits\&. .SH "BUILTIN UTILITIES" .PP posh implements the following builtin utilities: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} : .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} [ .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} break .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} builtin .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} continue .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} eval .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} exec .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} exit .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} false .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} return .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} set .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} shift .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} times .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} trap .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} wait .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} read .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} test .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} true .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} umask .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} unset .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} cd .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} command .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} echo .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} export .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} getopts .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} kill .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} local .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} pwd .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} readonly .RE .SH "FILES" .PP ~/\&.profile /etc/profile /etc/suid_profile .SH "BUGS" .PP Any bugs in posh should be reported via the Debian BTS\&. Legitimate bugs are inconsistencies between manpage and behavior, and inconsistencies between behavior and Debian policy (currently SUSv3 compliance with the following exceptions: echo \-n, binary \-a and \-o to test, local scoping)\&. .SH "VERSION" .PP This page documents the Policy\-compliant Ordinary SHell\&. .SH "AUTHORS" .PP This shell is based on pdksh\&. .SH "SEE ALSO" .PP \fBawk\fR(1), \fBksh\fR(1), \fBdash\fR(1), \fBed\fR(1), \fBgetconf\fR(1), \fBgetopt\fR(1), \fBsed\fR(1), \fBstty\fR(1), \fBvi\fR(1), \fBdup\fR(2), \fBexecve\fR(2), \fBgetgid\fR(2), \fBgetuid\fR(2), \fBopen\fR(2), \fBpipe\fR(2), \fBwait\fR(2), \fBgetopt\fR(3), \fBrand\fR(3), \fBsignal\fR(3), \fBsystem\fR(3), \fBenviron\fR(5)