diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-05-28 12:23:07 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-05-28 12:23:07 +0000 |
commit | 937b186c70e4e51eb429409f4a8769177598a944 (patch) | |
tree | c7b1b01b3db10e5ca4d86a1bc0209f6a31f5ec10 | |
parent | 834e5bc5cd0869104d606cf7789bf44f0f412b35 (diff) |
be more conservative with the .Dq macro; in particular, use .Sq macros most of
the time instead when quoting 1-2 characters (makes it much easier to read);
based on a patch received awhile ago from d@
-rw-r--r-- | bin/ksh/ksh.1 | 371 | ||||
-rw-r--r-- | bin/ksh/ksh.1tbl | 371 | ||||
-rw-r--r-- | bin/ksh/sh.1 | 306 | ||||
-rw-r--r-- | bin/ksh/sh.1tbl | 306 |
4 files changed, 678 insertions, 676 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1 index af2d58d213e..e777cf112a2 100644 --- a/bin/ksh/ksh.1 +++ b/bin/ksh/ksh.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ksh.1,v 1.16 1999/03/18 11:07:07 aaron Exp $ +.\" $OpenBSD: ksh.1,v 1.17 1999/05/28 12:23:06 aaron Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -152,10 +152,10 @@ option of the built-in command can't be used. .It Redirections that create files can't be used (i.e., -.Dq > , -.Dq >| , -.Dq >> , -.Dq <> ) . +.Sq > , +.Sq >| , +.Sq >> , +.Sq <> ) . .El .Pp A shell is @@ -178,7 +178,7 @@ 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 (i.e., argv[0]) starts with -.Dq \&- +.Sq \&- or if the .Fl l option is used, @@ -218,49 +218,48 @@ The shells begins parsing its input by breaking it into Words, which are sequences of characters, are delimited by unquoted whitespace characters (space, tab, and newline) or meta-characters .Po -.Dq \&< , -.Dq \&> , -.Dq \&| , -.Dq \&; , -.Dq \&( , +.Sq \&< , +.Sq \&> , +.Sq \&| , +.Sq \&; , +.Sq \&( , and -.Dq \&) +.Sq \&) .Pc . Aside from delimiting words, spaces and tabs are ignored, while newlines usually delimit commands. The meta-charcters are used in building the following tokens: -.Dq \&< , -.Dq \&<\&& , -.Dq \&<\&< , -.Dq \&> , -.Dq \&>\&& , -.Dq \&>\&> , +.Sq \&< , +.Sq \&<\&& , +.Sq \&> , +.Sq \&>\&& , +.Sq \&>\&> , etc. are used to specify redirections (see .Sx Input/output redirection below); -.Dq \&| +.Sq \&| is used to create pipelines; -.Dq \&|\&& +.Sq \&|\&& is used to create co-processes (see .Sx Co-processes below); -.Dq \&; +.Sq \&; is used to separate commands; -.Dq \&& +.Sq \&& is used to create asynchronous pipelines; -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| are used to specify conditional execution; -.Dq \&;\&; +.Sq \&;\&; is used in .Ic case statements; -.Dq \&(\&( .. \&)\&) -are used in arithmetic expressions; +.Sq \&(\&( .. \&)\&) +is used in arithmetic expressions; and lastly, -.Dq \&( .. \&) -are used to create subshells. +.Sq \&( .. \&) +is used to create subshells. .Pp Whitespace and meta-characters can be quoted individually using a backslash .Pq Sq \e , @@ -270,52 +269,52 @@ or single .Pq Sq \&' quotes. Note that the following characters are also treated specially by the shell and must be quoted if they are to represent themselves: -.Dq \e , -.Dq \&" , -.Dq \&' , -.Dq \&# , -.Dq \&$ , -.Dq \&` , -.Dq \&~ , -.Dq \&{ , -.Dq \&} , -.Dq \&* , -.Dq \&? , +.Sq \e , +.Sq \&" , +.Sq \&' , +.Sq \&# , +.Sq \&$ , +.Sq \&` , +.Sq \&~ , +.Sq \&{ , +.Sq \&} , +.Sq \&* , +.Sq \&? , and -.Dq \&[ . +.Sq \&[ . The first three of these are the above mentioned quoting characters (see .Sx Quoting below); -.Dq \&# , +.Sq \&# , if used at the beginning of a word, introduces a comment -- everything after the -.Dq \&# +.Sq \&# up to the nearest newline is ignored; -.Dq \&$ +.Sq \&$ is used to introduce parameter, command and arithmetic substitutions (see .Sx Substitution below); -.Dq \&` +.Sq \&` introduces an old-style command substitution (see .Sx Substitution below); -.Dq \&~ +.Sq \&~ begins a directory expansion (see .Sx Tilde expansion below); -.Dq \&{ +.Sq \&{ and -.Dq \&} +.Sq \&} delimit .Xr csh 1 style alterations (see .Sx Brace expansion below); -and, finally, -.Dq \&* , -.Dq \&? , +and finally, +.Sq \&* , +.Sq \&? , and -.Dq \&[ +.Sq \&[ are used in file name generation (see .Sx File name patterns below). @@ -359,13 +358,13 @@ assignments is that of the last command substitution performed during the parameter assignment or 0 is there were no command substitutions. .Pp Commands can be chained together using the -.Dq \&| +.Sq \&| token to form pipelines, in which the standard output of each command but the last is piped (see .Xr pipe 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 -.Dq \&! +.Sq \&! reversed 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; if the original status was not 0, the complemented status will be 0. @@ -373,12 +372,12 @@ if the original status was not 0, the complemented status will be 0. .Em Lists of commands can be created by separating pipelines by any of the following tokens: -.Dq \&&\&& , -.Dq \&|\&| , -.Dq \&& , -.Dq \&|\&& , +.Sq \&&\&& , +.Sq \&|\&| , +.Sq \&& , +.Sq \&|\&& , and -.Dq \&; . +.Sq \&; . The first two are for conditional execution: .Dq Ar cmd1 No && Ar cmd2 executes @@ -386,22 +385,22 @@ executes only if the exit status of .Ar cmd1 is zero; -.Dq \&|\&| +.Sq \&|\&| is the opposite -- .Ar cmd2 is executed only if the exit status of .Ar cmd1 is non-zero. -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| have equal precedence which is higher than that of -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& and -.Dq \&; , +.Sq \&; , which also have equal precedence. The -.Dq \&& +.Sq \&& 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, see @@ -415,19 +414,19 @@ ignored and with input redirected from .Pa /dev/null (however, redirections specified in the asynchronous command have precedence). The -.Dq \&|\&& +.Sq \&|\&& operator starts a co-process which is a special kind of asynchronous process (see .Sx Co-processes below). Note that a command must follow the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators, while it need not follow -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& or -.Dq \&; . +.Sq \&; . 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 @@ -510,9 +509,9 @@ used in .Ic case statements are the same as those used for file name patterns except that the restrictions regarding -.Dq \&. +.Sq \&. and -.Dq \&/ +.Sq \&/ 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 @@ -559,7 +558,7 @@ if is never executed, the exit status is zero. .Ar term is either a newline or a -.Dq \&; . +.Sq \&; . .It Xo Ic if Ar list Ic then .Ar list [ Ic elif Ar list Ic then .Ar list ] Ar ... [ Ic else @@ -700,29 +699,29 @@ The (and) and .Fl o (or) operators are replaced with -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| , +.Sq \&|\&| , respectively. .It Operators (e.g., -.Dq Fl f , -.Dq = , -.Dq \&! , +.Sq Fl f , +.Sq = , +.Sq \&! , etc.) must be unquoted. .It The second operand of the -.Dq \&!= +.Sq \&!= and -.Dq = +.Sq = expressions are patterns (e.g., the comparison .Ic [[ foobar = f*r ]] succeeds). .It There are two additional binary operators: -.Dq \&< +.Sq \&< and -.Dq \&> +.Sq \&> which return true if their first string operand is less than, or greater than, their second string operand, respectively. .It @@ -736,9 +735,9 @@ use .It Parameter, command and arithmetic substitutions are performed as expressions are evaluated and lazy expression evaluation is used for the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators. This means that in the statement .Pp .Ic \&[[ -r foo && $(< foo) = b*r ]] @@ -753,39 +752,39 @@ exists and is readable. .Ss Quoting Quoting is used to prevent the shell from treating characters or words specially. There are three methods of quoting. First, -.Dq \e +.Sq \e quotes the following character, unless it is at the end of a line, in which case both the -.Dq \e +.Sq \e and the newline are stripped. Second, a single quote .Pq Sq ' quotes everything up to the next single quote (this may span lines). Third, a double quote .Pq Sq \&" quotes all characters, except -.Dq \&$ , -.Dq \&` +.Sq \&$ , +.Sq \&` and -.Dq \e , +.Sq \e , up to the next unquoted double quote. -.Dq $ +.Sq $ and -.Dq ` +.Sq ` inside double quotes have their usual meaning (i.e., parameter, command or arithmetic substitution) except no field splitting is carried out on the results of double-quoted substitutions. If a -.Dq \e +.Sq \e inside a double-quoted string is followed by -.Dq \e , -.Dq $ , -.Dq ` , +.Sq \e , +.Sq $ , +.Sq ` , or -.Dq \&" , +.Sq \&" , it is replaced by the second character; if it is followed by a newline, both the -.Dq \e +.Sq \e and the newline are stripped; otherwise, both the -.Dq \e +.Sq \e and the character following are unchanged. .Pp NOTE: See @@ -923,14 +922,14 @@ substitutions, normal quoting rules are used when is parsed, however, for the .Ic ` Ns Ar command Ns Ic ` form, a -.Dq \e +.Sq \e followed by any of -.Dq $ , -.Dq ` , +.Sq $ , +.Sq ` , or -.Dq \e +.Sq \e is stripped (a -.Dq \e +.Sq \e followed by any other character is unchanged). As a special case in command substitutions, a command of the form .Ic \&< Ar file @@ -959,7 +958,7 @@ 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 .Po -.Dq _ +.Sq _ counts as a letter .Pc . Parameter substitutions take the form @@ -997,7 +996,7 @@ 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 -.Dq = +.Sq = must be unquoted for the shell to recognize a parameter assignment. The fourth way of setting a parameter is with the .Ic export , @@ -1091,7 +1090,7 @@ is used instead. .El .Pp In the above modifiers, the -.Dq \&: +.Sq \&: can be omitted, in which case the conditions only depand on .Ar name being set (as opposed to set and not @@ -1109,8 +1108,8 @@ The following forms of parameter substitution can also be used: The number of positional parameters if .Ar name is -.Dq \&* , -.Dq \&@ , +.Sq \&* , +.Sq \&@ , not specified, or the length of the string value of parameter .Ar name . .It Xo Ic ${# Ns Ar name Ns @@ -1129,7 +1128,7 @@ If matches the beginning of the value of parameter .Ar name , the matched text is deleted from the result of substitution. A single -.Dq \&# +.Sq \&# results in the shortest match, two of them results in the longest match. .Sm off @@ -1223,7 +1222,7 @@ Search path for the built-in command. Works the same way as .Ev PATH for those directories not beginning with -.Dq \&/ +.Sq \&/ in .Ic cd commands. Note that if @@ -1345,7 +1344,7 @@ minutes). .It Ev MAILPATH A list of files to be checked for mail. The list is colon separated, and each file may be followed by a -.Dq \&? +.Sq \&? and a message to be printed if new mail has arrived. Command, parameter and arithmetic substitution is performed on the message, and, during substitution, the parameter @@ -1384,13 +1383,13 @@ The process ID of the shell's parent (read-only). .It Ev PS1 The primary prompt for interactive shells. Parameter, command and arithmetic substitutions are performed, and -.Dq \&! +.Sq \&! is replaced with the current command number (see .Ic fc command below). A literal -.Dq \&! +.Sq \&! can be put in the prompt by placing -.Dq \&!\&! +.Sq \&!\&! in .Ev PS1 . Note that since the command line editors try to figure out how long the prompt @@ -1473,13 +1472,13 @@ or .Ss Tilde expansion Tilde expansion, which is done in parallel with parameter substitution, is done on words starting with an unquoted -.Dq ~ . +.Sq ~ . The characters following the tilde, up to the first -.Dq / , +.Sq / , if any, are assumed to be a login name. If the login name is empty, -.Dq \&+ +.Sq \&+ or -.Dq \&- , +.Sq \&- , the value of the .Ev HOME , PWD or @@ -1538,9 +1537,9 @@ are not expanded). Brace expansion is carried out after parameter substitution and before file name generation. .Ss File name patterns A file name pattern is a word containing one or more unquoted -.Dq \&? +.Sq \&? or -.Dq \&* +.Sq \&* characters or .Dq [..] sequences. Once brace expansion has been performed, the shell replaces file @@ -1555,19 +1554,19 @@ Matches any sequence of characters. .It Ic \&[ Ns No .. Ns Ic \&] Matches any of the characters inside the brackets. Ranges of characters can be specified by separating two characters by a -.Dq \&- +.Sq \&- (e.g., .Dq [a0-9] matches the letter .Dq a or any digit). In order to represent itself, a -.Dq \&- +.Sq \&- must either be quoted or the first or last character in the character list. Similarly, a -.Dq \&] +.Sq \&] must be quoted or the first character in the list if it is to represent itself instead of the end of the list. Also, a -.Dq \&! +.Sq \&! 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. .It Ic \&[\&! Ns No .. Ns Ic \&] @@ -1676,7 +1675,7 @@ If the .Ic markdirs option is set, any directories that result from file name generation are marked with a trailing -.Dq / . +.Sq / . .Pp The POSIX character classes (i.e., .Ic \&[\&: Ns Ar class-name Ns Ic \&:\&] @@ -1746,11 +1745,11 @@ parameter, command and arithmetic substitutions are performed, along with backslash .Pq Sq \e escapes for -.Dq \&$ , -.Dq ` , -.Dq \e , +.Sq \&$ , +.Sq ` , +.Sq \e , and -.Dq \enewline . +.Sq \enewline . If multiple here documents are used on the same command line, they are saved in order. .It Ic \&<\&<\&- Ar marker @@ -1763,10 +1762,10 @@ Standard input is duplicated from file descriptor .Ar fd can be a single digit, indicating the number of an existing file descriptor; the letter -.Dq p , +.Sq p , indicating the file descriptor associated with the output of the current co-process; or the character -.Dq \&- , +.Sq \&- , indicating standard input is to be closed. .It Ic \&>\&& Ar fd Same as @@ -2161,11 +2160,11 @@ non-POSIX mode, the exit status is that of the last foregrounded job. .It .Ic getopts . In POSIX mode, options must start with a -.Dq \&- ; +.Sq \&- ; in non-POSIX mode, options can start with either -.Dq \&- +.Sq \&- or -.Dq \&+ . +.Sq \&+ . .It Brace expansion (also known as alternation). In POSIX mode, brace expansion is disabled; in non-POSIX mode, brace expansion is enabled. Note that @@ -2330,8 +2329,10 @@ as where .Ar value is quoted. If options were preceded with -.Dq \&+ , -or a lone \&+ is given on the command line, only +.Sq \&+ , +or a lone +.Sq \&+ +is given on the command line, only .Ar name is printed. In addition, if the .Fl p @@ -2509,7 +2510,7 @@ defaults to 1. Prints its arguments (separated by spaces) followed by a newline, to the standard output. The newline is suppressed if any of the arguments contain the backslash sequence -.Dq \ec . +.Sq \ec . See the .Ic print command below for a list of other backslash sequences that are recognized. @@ -2627,11 +2628,11 @@ is invoked, it places the next option in the shell parameter and the index of the next argument to be processed in the shell parameter .Ev OPTIND . If the option was introduced with a -.Dq \&+ , +.Sq \&+ , the option places in .Ar name is prefixed with a -.Dq \&+ . +.Sq \&+ . When an option requires an argument, .Ic getopts places it in the shell parameter @@ -2650,9 +2651,9 @@ When the end of the options is encountered, .Ic getopts exits with a non-zero exit status. Options end at the first (non-option argument) argument that does not start with a -.Dq \&- , +.Sq \&- , or when a -.Dq \&-\&- +.Sq \&-\&- argument is encountered. .Pp Option parsing can be reset by setting @@ -2727,23 +2728,23 @@ terminated with a newline. The .Fl n option suppresses the newline. By default, certain C escapes are translated. These include -.Dq \eb , -.Dq \ef , -.Dq \en , -.Dq \er , -.Dq \et , -.Dq \ev , +.Sq \eb , +.Sq \ef , +.Sq \en , +.Sq \er , +.Sq \et , +.Sq \ev , and -.Dq \e0### +.Sq \e0### .Po -.Dq # +.Sq # is an octal digit, of which there may be 0 to 3 .Pc . -.Dq \ec +.Sq \ec is equivalent to using the .Fl n option. -.Dq \e +.Sq \e expansion may be inhibited with the .Fl r option. The @@ -2768,7 +2769,7 @@ option is used to emulate, to some degree, the .Bx .Xr echo command, which does not process -.Dq \e +.Sq \e sequences unless the .Fl e option is given. As above, the @@ -2970,10 +2971,10 @@ if is used). .It Fl u Ic nounset Referencing of an unset parameter is treated as an error, unless one of the -.Dq \&- , -.Dq \&+ +.Sq \&- , +.Sq \&+ or -.Dq = +.Sq = modifiers is used. .It Fl v Ic verbose Write shell input to standard error as it is read. @@ -2983,7 +2984,7 @@ the value of .Ev PS4 . .It Fl X Ic markdirs Mark directories with a trailing -.Dq / +.Sq / during file name generation. .It Ic bgnice Background jobs are run with lower priority. @@ -3074,11 +3075,11 @@ will print the long names of all options that are currently on. .Pp Remaining arguments, if any, are positional parameters and are assigned, in order, to the positional parameters (i.e., $1, $2, etc.). If options end with -.Dq \&-\&- +.Sq \&-\&- and there are no remaining arguments, all positional parameters are cleared. If no options or arguments are given, the values of all names are printed. For unknown historical reasons, a lone -.Dq \&- +.Sq \&- option is treated specially -- it clears both the .Fl x and @@ -3186,7 +3187,7 @@ is set (see .Ic set command above for a list of options). As a non-standard extension, if the option starts with a -.Dq \&! , +.Sq \&! , the test is negated; the test always fails if .Ar option doesn't exist (thus @@ -3281,15 +3282,15 @@ arguments to or .Ic \&[ ... \&] is less than five; if leading -.Dq \&! +.Sq \&! arguments can be stripped such that only one argument remains then a string length test is performed (again, even if the argument is a unary operator); if leading -.Dq \&! +.Sq \&! arguments can be stripped such that three arguments remain and the second argument is a binary operator, then the binary operation is performed (even if the first argument is a unary operator, including an unstripped -.Dq \&! ) . +.Sq \&! ) . .Pp NOTE: A common mistake is to use .Ic if \&[ $foo = bar \&] @@ -3300,9 +3301,9 @@ is or unset, if it has embedded spaces (i.e., .Ev IFS characters), or if it is a unary operator like -.Dq Ic \&! +.Sq Ic \&! or -.Dq Fl n . +.Sq Fl n . Use tests like .Ic if \&[ \&"X$foo\&" = Xbar \&] instead. @@ -3373,10 +3374,10 @@ arguments, parameter attributes are displayed; if no options are used, the current attributes of all parameters are printed as .Ic typeset commands; if an option is given (or -.Dq \&- +.Sq \&- with no option letter), all parameters and their values with the specified attributes are printed; if options are introduced with -.Dq \&+ , +.Sq \&+ , parameter values are not printed. .Pp If @@ -3398,7 +3399,7 @@ operates on the attributes of functions. As with parameters, if no .Ar name Ns s are given, functions are listed with their values (i.e., definitions) unless options are introduced with -.Dq \&+ , +.Sq \&+ , in which case only the function names are reported. .Bl -tag -width 3n .It Fl L Ns Ar n @@ -3740,9 +3741,9 @@ where is the job number of the job. .It Ar flag is the -.Dq \&+ +.Sq \&+ or -.Dq \&- +.Sq \&- character if the job is the .Ic %\&+ or .Ic %\&- @@ -3899,7 +3900,7 @@ Automatically completes as much as is unique of the command name or the file name containing the cursor. If the entire remaining command or file name is unique, a space is printed after its completion, unless it is a directory name in which case -.Dq / +.Sq / is appended. If there is no command or file name with the current partialword as its prefix, a bell character is output (usually causing a beep to be sounded). @@ -3968,7 +3969,7 @@ Error (ring the bell). Places the cursor where the mark is and sets the mark to where the cursor was. .It Ic expand-file ^[\&* Appends a -.Dq \&* +.Sq \&* to the current word and replaces the word with the result of performing file globbing on the word. If no files match the pattern, the bell is rung. .It Ic forward-char Ar n Ic ^F @@ -3994,7 +3995,7 @@ is not specified; otherwise deletes characters between the cursor and column .It Ic list ^[? Prints a sorted, columnated list of command named or file names (if any) that can complete the partial word containing the cursor. Directoary names have -.Dq / +.Sq / appended to them. .It Ic list-command ^X? Prints a sorted, columnated list of command names (if any) that can complete @@ -4040,7 +4041,7 @@ occurrence of the next character typed. .It Ic search-history ^R Enter incremental search mode. The internal history list is searched backwards for commands matching the input. An initial -.Dq ^ +.Sq ^ in the search string anchors the search. The abort key will leave search mode. Other commands will be executed after leaving search mode. Successive .Ic search-history @@ -4160,10 +4161,10 @@ above), enabled with If a line is longer than the screen width (see .Dv COLUMNS parameter), a -.Dq \&> , -.Dq \&+ +.Sq \&> , +.Sq \&+ or -.Dq \&< +.Sq \&< character is displayed in the last column indicating that there are more characters after, before and after, or before the current position, respectively. The line is scrolled horizontally as necessary. @@ -4223,16 +4224,16 @@ is not specified, the current line is edited. The actual command executed is .It Ic \&* No and Ic ^X Command or file name expansion is applied to the current big-word (with an appended -.Dq \&* , +.Sq \&* , if the word contains no file globbing characters) -- the big-word is replaced with the resulting words. If the current big-word is the first on the line (or follows one of the following characters: -.Dq \&; , -.Dq \&| , -.Dq \&& , -.Dq \&( , +.Sq \&; , +.Sq \&| , +.Sq \&& , +.Sq \&( , or -.Dq \&) ) +.Sq \&) ) and does not contain a slash .Pq Sq / then the command expansion is done; otherwise file name expansion is done. @@ -4387,7 +4388,7 @@ line containing if .Ar string starts with -.Dq ^ , +.Sq ^ , the remainder of the string must appear at the start of the history line for it to match. .It Ar n Ns Ic \&? Ns Ar string diff --git a/bin/ksh/ksh.1tbl b/bin/ksh/ksh.1tbl index 7a1ed0e7c6c..09bb56d0158 100644 --- a/bin/ksh/ksh.1tbl +++ b/bin/ksh/ksh.1tbl @@ -1,4 +1,4 @@ -.\" $OpenBSD: ksh.1tbl,v 1.16 1999/03/18 11:07:07 aaron Exp $ +.\" $OpenBSD: ksh.1tbl,v 1.17 1999/05/28 12:23:06 aaron Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -152,10 +152,10 @@ option of the built-in command can't be used. .It Redirections that create files can't be used (i.e., -.Dq > , -.Dq >| , -.Dq >> , -.Dq <> ) . +.Sq > , +.Sq >| , +.Sq >> , +.Sq <> ) . .El .Pp A shell is @@ -178,7 +178,7 @@ 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 (i.e., argv[0]) starts with -.Dq \&- +.Sq \&- or if the .Fl l option is used, @@ -218,49 +218,48 @@ The shells begins parsing its input by breaking it into Words, which are sequences of characters, are delimited by unquoted whitespace characters (space, tab, and newline) or meta-characters .Po -.Dq \&< , -.Dq \&> , -.Dq \&| , -.Dq \&; , -.Dq \&( , +.Sq \&< , +.Sq \&> , +.Sq \&| , +.Sq \&; , +.Sq \&( , and -.Dq \&) +.Sq \&) .Pc . Aside from delimiting words, spaces and tabs are ignored, while newlines usually delimit commands. The meta-charcters are used in building the following tokens: -.Dq \&< , -.Dq \&<\&& , -.Dq \&<\&< , -.Dq \&> , -.Dq \&>\&& , -.Dq \&>\&> , +.Sq \&< , +.Sq \&<\&& , +.Sq \&> , +.Sq \&>\&& , +.Sq \&>\&> , etc. are used to specify redirections (see .Sx Input/output redirection below); -.Dq \&| +.Sq \&| is used to create pipelines; -.Dq \&|\&& +.Sq \&|\&& is used to create co-processes (see .Sx Co-processes below); -.Dq \&; +.Sq \&; is used to separate commands; -.Dq \&& +.Sq \&& is used to create asynchronous pipelines; -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| are used to specify conditional execution; -.Dq \&;\&; +.Sq \&;\&; is used in .Ic case statements; -.Dq \&(\&( .. \&)\&) -are used in arithmetic expressions; +.Sq \&(\&( .. \&)\&) +is used in arithmetic expressions; and lastly, -.Dq \&( .. \&) -are used to create subshells. +.Sq \&( .. \&) +is used to create subshells. .Pp Whitespace and meta-characters can be quoted individually using a backslash .Pq Sq \e , @@ -270,52 +269,52 @@ or single .Pq Sq \&' quotes. Note that the following characters are also treated specially by the shell and must be quoted if they are to represent themselves: -.Dq \e , -.Dq \&" , -.Dq \&' , -.Dq \&# , -.Dq \&$ , -.Dq \&` , -.Dq \&~ , -.Dq \&{ , -.Dq \&} , -.Dq \&* , -.Dq \&? , +.Sq \e , +.Sq \&" , +.Sq \&' , +.Sq \&# , +.Sq \&$ , +.Sq \&` , +.Sq \&~ , +.Sq \&{ , +.Sq \&} , +.Sq \&* , +.Sq \&? , and -.Dq \&[ . +.Sq \&[ . The first three of these are the above mentioned quoting characters (see .Sx Quoting below); -.Dq \&# , +.Sq \&# , if used at the beginning of a word, introduces a comment -- everything after the -.Dq \&# +.Sq \&# up to the nearest newline is ignored; -.Dq \&$ +.Sq \&$ is used to introduce parameter, command and arithmetic substitutions (see .Sx Substitution below); -.Dq \&` +.Sq \&` introduces an old-style command substitution (see .Sx Substitution below); -.Dq \&~ +.Sq \&~ begins a directory expansion (see .Sx Tilde expansion below); -.Dq \&{ +.Sq \&{ and -.Dq \&} +.Sq \&} delimit .Xr csh 1 style alterations (see .Sx Brace expansion below); -and, finally, -.Dq \&* , -.Dq \&? , +and finally, +.Sq \&* , +.Sq \&? , and -.Dq \&[ +.Sq \&[ are used in file name generation (see .Sx File name patterns below). @@ -359,13 +358,13 @@ assignments is that of the last command substitution performed during the parameter assignment or 0 is there were no command substitutions. .Pp Commands can be chained together using the -.Dq \&| +.Sq \&| token to form pipelines, in which the standard output of each command but the last is piped (see .Xr pipe 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 -.Dq \&! +.Sq \&! reversed 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; if the original status was not 0, the complemented status will be 0. @@ -373,12 +372,12 @@ if the original status was not 0, the complemented status will be 0. .Em Lists of commands can be created by separating pipelines by any of the following tokens: -.Dq \&&\&& , -.Dq \&|\&| , -.Dq \&& , -.Dq \&|\&& , +.Sq \&&\&& , +.Sq \&|\&| , +.Sq \&& , +.Sq \&|\&& , and -.Dq \&; . +.Sq \&; . The first two are for conditional execution: .Dq Ar cmd1 No && Ar cmd2 executes @@ -386,22 +385,22 @@ executes only if the exit status of .Ar cmd1 is zero; -.Dq \&|\&| +.Sq \&|\&| is the opposite -- .Ar cmd2 is executed only if the exit status of .Ar cmd1 is non-zero. -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| have equal precedence which is higher than that of -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& and -.Dq \&; , +.Sq \&; , which also have equal precedence. The -.Dq \&& +.Sq \&& 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, see @@ -415,19 +414,19 @@ ignored and with input redirected from .Pa /dev/null (however, redirections specified in the asynchronous command have precedence). The -.Dq \&|\&& +.Sq \&|\&& operator starts a co-process which is a special kind of asynchronous process (see .Sx Co-processes below). Note that a command must follow the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators, while it need not follow -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& or -.Dq \&; . +.Sq \&; . 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 @@ -510,9 +509,9 @@ used in .Ic case statements are the same as those used for file name patterns except that the restrictions regarding -.Dq \&. +.Sq \&. and -.Dq \&/ +.Sq \&/ 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 @@ -559,7 +558,7 @@ if is never executed, the exit status is zero. .Ar term is either a newline or a -.Dq \&; . +.Sq \&; . .It Xo Ic if Ar list Ic then .Ar list [ Ic elif Ar list Ic then .Ar list ] Ar ... [ Ic else @@ -700,29 +699,29 @@ The (and) and .Fl o (or) operators are replaced with -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| , +.Sq \&|\&| , respectively. .It Operators (e.g., -.Dq Fl f , -.Dq = , -.Dq \&! , +.Sq Fl f , +.Sq = , +.Sq \&! , etc.) must be unquoted. .It The second operand of the -.Dq \&!= +.Sq \&!= and -.Dq = +.Sq = expressions are patterns (e.g., the comparison .Ic [[ foobar = f*r ]] succeeds). .It There are two additional binary operators: -.Dq \&< +.Sq \&< and -.Dq \&> +.Sq \&> which return true if their first string operand is less than, or greater than, their second string operand, respectively. .It @@ -736,9 +735,9 @@ use .It Parameter, command and arithmetic substitutions are performed as expressions are evaluated and lazy expression evaluation is used for the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators. This means that in the statement .Pp .Ic \&[[ -r foo && $(< foo) = b*r ]] @@ -753,39 +752,39 @@ exists and is readable. .Ss Quoting Quoting is used to prevent the shell from treating characters or words specially. There are three methods of quoting. First, -.Dq \e +.Sq \e quotes the following character, unless it is at the end of a line, in which case both the -.Dq \e +.Sq \e and the newline are stripped. Second, a single quote .Pq Sq ' quotes everything up to the next single quote (this may span lines). Third, a double quote .Pq Sq \&" quotes all characters, except -.Dq \&$ , -.Dq \&` +.Sq \&$ , +.Sq \&` and -.Dq \e , +.Sq \e , up to the next unquoted double quote. -.Dq $ +.Sq $ and -.Dq ` +.Sq ` inside double quotes have their usual meaning (i.e., parameter, command or arithmetic substitution) except no field splitting is carried out on the results of double-quoted substitutions. If a -.Dq \e +.Sq \e inside a double-quoted string is followed by -.Dq \e , -.Dq $ , -.Dq ` , +.Sq \e , +.Sq $ , +.Sq ` , or -.Dq \&" , +.Sq \&" , it is replaced by the second character; if it is followed by a newline, both the -.Dq \e +.Sq \e and the newline are stripped; otherwise, both the -.Dq \e +.Sq \e and the character following are unchanged. .Pp NOTE: See @@ -923,14 +922,14 @@ substitutions, normal quoting rules are used when is parsed, however, for the .Ic ` Ns Ar command Ns Ic ` form, a -.Dq \e +.Sq \e followed by any of -.Dq $ , -.Dq ` , +.Sq $ , +.Sq ` , or -.Dq \e +.Sq \e is stripped (a -.Dq \e +.Sq \e followed by any other character is unchanged). As a special case in command substitutions, a command of the form .Ic \&< Ar file @@ -959,7 +958,7 @@ 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 .Po -.Dq _ +.Sq _ counts as a letter .Pc . Parameter substitutions take the form @@ -997,7 +996,7 @@ 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 -.Dq = +.Sq = must be unquoted for the shell to recognize a parameter assignment. The fourth way of setting a parameter is with the .Ic export , @@ -1091,7 +1090,7 @@ is used instead. .El .Pp In the above modifiers, the -.Dq \&: +.Sq \&: can be omitted, in which case the conditions only depand on .Ar name being set (as opposed to set and not @@ -1109,8 +1108,8 @@ The following forms of parameter substitution can also be used: The number of positional parameters if .Ar name is -.Dq \&* , -.Dq \&@ , +.Sq \&* , +.Sq \&@ , not specified, or the length of the string value of parameter .Ar name . .It Xo Ic ${# Ns Ar name Ns @@ -1129,7 +1128,7 @@ If matches the beginning of the value of parameter .Ar name , the matched text is deleted from the result of substitution. A single -.Dq \&# +.Sq \&# results in the shortest match, two of them results in the longest match. .Sm off @@ -1223,7 +1222,7 @@ Search path for the built-in command. Works the same way as .Ev PATH for those directories not beginning with -.Dq \&/ +.Sq \&/ in .Ic cd commands. Note that if @@ -1345,7 +1344,7 @@ minutes). .It Ev MAILPATH A list of files to be checked for mail. The list is colon separated, and each file may be followed by a -.Dq \&? +.Sq \&? and a message to be printed if new mail has arrived. Command, parameter and arithmetic substitution is performed on the message, and, during substitution, the parameter @@ -1384,13 +1383,13 @@ The process ID of the shell's parent (read-only). .It Ev PS1 The primary prompt for interactive shells. Parameter, command and arithmetic substitutions are performed, and -.Dq \&! +.Sq \&! is replaced with the current command number (see .Ic fc command below). A literal -.Dq \&! +.Sq \&! can be put in the prompt by placing -.Dq \&!\&! +.Sq \&!\&! in .Ev PS1 . Note that since the command line editors try to figure out how long the prompt @@ -1473,13 +1472,13 @@ or .Ss Tilde expansion Tilde expansion, which is done in parallel with parameter substitution, is done on words starting with an unquoted -.Dq ~ . +.Sq ~ . The characters following the tilde, up to the first -.Dq / , +.Sq / , if any, are assumed to be a login name. If the login name is empty, -.Dq \&+ +.Sq \&+ or -.Dq \&- , +.Sq \&- , the value of the .Ev HOME , PWD or @@ -1538,9 +1537,9 @@ are not expanded). Brace expansion is carried out after parameter substitution and before file name generation. .Ss File name patterns A file name pattern is a word containing one or more unquoted -.Dq \&? +.Sq \&? or -.Dq \&* +.Sq \&* characters or .Dq [..] sequences. Once brace expansion has been performed, the shell replaces file @@ -1555,19 +1554,19 @@ Matches any sequence of characters. .It Ic \&[ Ns No .. Ns Ic \&] Matches any of the characters inside the brackets. Ranges of characters can be specified by separating two characters by a -.Dq \&- +.Sq \&- (e.g., .Dq [a0-9] matches the letter .Dq a or any digit). In order to represent itself, a -.Dq \&- +.Sq \&- must either be quoted or the first or last character in the character list. Similarly, a -.Dq \&] +.Sq \&] must be quoted or the first character in the list if it is to represent itself instead of the end of the list. Also, a -.Dq \&! +.Sq \&! 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. .It Ic \&[\&! Ns No .. Ns Ic \&] @@ -1676,7 +1675,7 @@ If the .Ic markdirs option is set, any directories that result from file name generation are marked with a trailing -.Dq / . +.Sq / . .Pp The POSIX character classes (i.e., .Ic \&[\&: Ns Ar class-name Ns Ic \&:\&] @@ -1746,11 +1745,11 @@ parameter, command and arithmetic substitutions are performed, along with backslash .Pq Sq \e escapes for -.Dq \&$ , -.Dq ` , -.Dq \e , +.Sq \&$ , +.Sq ` , +.Sq \e , and -.Dq \enewline . +.Sq \enewline . If multiple here documents are used on the same command line, they are saved in order. .It Ic \&<\&<\&- Ar marker @@ -1763,10 +1762,10 @@ Standard input is duplicated from file descriptor .Ar fd can be a single digit, indicating the number of an existing file descriptor; the letter -.Dq p , +.Sq p , indicating the file descriptor associated with the output of the current co-process; or the character -.Dq \&- , +.Sq \&- , indicating standard input is to be closed. .It Ic \&>\&& Ar fd Same as @@ -2161,11 +2160,11 @@ non-POSIX mode, the exit status is that of the last foregrounded job. .It .Ic getopts . In POSIX mode, options must start with a -.Dq \&- ; +.Sq \&- ; in non-POSIX mode, options can start with either -.Dq \&- +.Sq \&- or -.Dq \&+ . +.Sq \&+ . .It Brace expansion (also known as alternation). In POSIX mode, brace expansion is disabled; in non-POSIX mode, brace expansion is enabled. Note that @@ -2330,8 +2329,10 @@ as where .Ar value is quoted. If options were preceded with -.Dq \&+ , -or a lone \&+ is given on the command line, only +.Sq \&+ , +or a lone +.Sq \&+ +is given on the command line, only .Ar name is printed. In addition, if the .Fl p @@ -2509,7 +2510,7 @@ defaults to 1. Prints its arguments (separated by spaces) followed by a newline, to the standard output. The newline is suppressed if any of the arguments contain the backslash sequence -.Dq \ec . +.Sq \ec . See the .Ic print command below for a list of other backslash sequences that are recognized. @@ -2627,11 +2628,11 @@ is invoked, it places the next option in the shell parameter and the index of the next argument to be processed in the shell parameter .Ev OPTIND . If the option was introduced with a -.Dq \&+ , +.Sq \&+ , the option places in .Ar name is prefixed with a -.Dq \&+ . +.Sq \&+ . When an option requires an argument, .Ic getopts places it in the shell parameter @@ -2650,9 +2651,9 @@ When the end of the options is encountered, .Ic getopts exits with a non-zero exit status. Options end at the first (non-option argument) argument that does not start with a -.Dq \&- , +.Sq \&- , or when a -.Dq \&-\&- +.Sq \&-\&- argument is encountered. .Pp Option parsing can be reset by setting @@ -2727,23 +2728,23 @@ terminated with a newline. The .Fl n option suppresses the newline. By default, certain C escapes are translated. These include -.Dq \eb , -.Dq \ef , -.Dq \en , -.Dq \er , -.Dq \et , -.Dq \ev , +.Sq \eb , +.Sq \ef , +.Sq \en , +.Sq \er , +.Sq \et , +.Sq \ev , and -.Dq \e0### +.Sq \e0### .Po -.Dq # +.Sq # is an octal digit, of which there may be 0 to 3 .Pc . -.Dq \ec +.Sq \ec is equivalent to using the .Fl n option. -.Dq \e +.Sq \e expansion may be inhibited with the .Fl r option. The @@ -2768,7 +2769,7 @@ option is used to emulate, to some degree, the .Bx .Xr echo command, which does not process -.Dq \e +.Sq \e sequences unless the .Fl e option is given. As above, the @@ -2970,10 +2971,10 @@ if is used). .It Fl u Ic nounset Referencing of an unset parameter is treated as an error, unless one of the -.Dq \&- , -.Dq \&+ +.Sq \&- , +.Sq \&+ or -.Dq = +.Sq = modifiers is used. .It Fl v Ic verbose Write shell input to standard error as it is read. @@ -2983,7 +2984,7 @@ the value of .Ev PS4 . .It Fl X Ic markdirs Mark directories with a trailing -.Dq / +.Sq / during file name generation. .It Ic bgnice Background jobs are run with lower priority. @@ -3074,11 +3075,11 @@ will print the long names of all options that are currently on. .Pp Remaining arguments, if any, are positional parameters and are assigned, in order, to the positional parameters (i.e., $1, $2, etc.). If options end with -.Dq \&-\&- +.Sq \&-\&- and there are no remaining arguments, all positional parameters are cleared. If no options or arguments are given, the values of all names are printed. For unknown historical reasons, a lone -.Dq \&- +.Sq \&- option is treated specially -- it clears both the .Fl x and @@ -3186,7 +3187,7 @@ is set (see .Ic set command above for a list of options). As a non-standard extension, if the option starts with a -.Dq \&! , +.Sq \&! , the test is negated; the test always fails if .Ar option doesn't exist (thus @@ -3281,15 +3282,15 @@ arguments to or .Ic \&[ ... \&] is less than five; if leading -.Dq \&! +.Sq \&! arguments can be stripped such that only one argument remains then a string length test is performed (again, even if the argument is a unary operator); if leading -.Dq \&! +.Sq \&! arguments can be stripped such that three arguments remain and the second argument is a binary operator, then the binary operation is performed (even if the first argument is a unary operator, including an unstripped -.Dq \&! ) . +.Sq \&! ) . .Pp NOTE: A common mistake is to use .Ic if \&[ $foo = bar \&] @@ -3300,9 +3301,9 @@ is or unset, if it has embedded spaces (i.e., .Ev IFS characters), or if it is a unary operator like -.Dq Ic \&! +.Sq Ic \&! or -.Dq Fl n . +.Sq Fl n . Use tests like .Ic if \&[ \&"X$foo\&" = Xbar \&] instead. @@ -3373,10 +3374,10 @@ arguments, parameter attributes are displayed; if no options are used, the current attributes of all parameters are printed as .Ic typeset commands; if an option is given (or -.Dq \&- +.Sq \&- with no option letter), all parameters and their values with the specified attributes are printed; if options are introduced with -.Dq \&+ , +.Sq \&+ , parameter values are not printed. .Pp If @@ -3398,7 +3399,7 @@ operates on the attributes of functions. As with parameters, if no .Ar name Ns s are given, functions are listed with their values (i.e., definitions) unless options are introduced with -.Dq \&+ , +.Sq \&+ , in which case only the function names are reported. .Bl -tag -width 3n .It Fl L Ns Ar n @@ -3740,9 +3741,9 @@ where is the job number of the job. .It Ar flag is the -.Dq \&+ +.Sq \&+ or -.Dq \&- +.Sq \&- character if the job is the .Ic %\&+ or .Ic %\&- @@ -3899,7 +3900,7 @@ Automatically completes as much as is unique of the command name or the file name containing the cursor. If the entire remaining command or file name is unique, a space is printed after its completion, unless it is a directory name in which case -.Dq / +.Sq / is appended. If there is no command or file name with the current partialword as its prefix, a bell character is output (usually causing a beep to be sounded). @@ -3968,7 +3969,7 @@ Error (ring the bell). Places the cursor where the mark is and sets the mark to where the cursor was. .It Ic expand-file ^[\&* Appends a -.Dq \&* +.Sq \&* to the current word and replaces the word with the result of performing file globbing on the word. If no files match the pattern, the bell is rung. .It Ic forward-char Ar n Ic ^F @@ -3994,7 +3995,7 @@ is not specified; otherwise deletes characters between the cursor and column .It Ic list ^[? Prints a sorted, columnated list of command named or file names (if any) that can complete the partial word containing the cursor. Directoary names have -.Dq / +.Sq / appended to them. .It Ic list-command ^X? Prints a sorted, columnated list of command names (if any) that can complete @@ -4040,7 +4041,7 @@ occurrence of the next character typed. .It Ic search-history ^R Enter incremental search mode. The internal history list is searched backwards for commands matching the input. An initial -.Dq ^ +.Sq ^ in the search string anchors the search. The abort key will leave search mode. Other commands will be executed after leaving search mode. Successive .Ic search-history @@ -4160,10 +4161,10 @@ above), enabled with If a line is longer than the screen width (see .Dv COLUMNS parameter), a -.Dq \&> , -.Dq \&+ +.Sq \&> , +.Sq \&+ or -.Dq \&< +.Sq \&< character is displayed in the last column indicating that there are more characters after, before and after, or before the current position, respectively. The line is scrolled horizontally as necessary. @@ -4223,16 +4224,16 @@ is not specified, the current line is edited. The actual command executed is .It Ic \&* No and Ic ^X Command or file name expansion is applied to the current big-word (with an appended -.Dq \&* , +.Sq \&* , if the word contains no file globbing characters) -- the big-word is replaced with the resulting words. If the current big-word is the first on the line (or follows one of the following characters: -.Dq \&; , -.Dq \&| , -.Dq \&& , -.Dq \&( , +.Sq \&; , +.Sq \&| , +.Sq \&& , +.Sq \&( , or -.Dq \&) ) +.Sq \&) ) and does not contain a slash .Pq Sq / then the command expansion is done; otherwise file name expansion is done. @@ -4387,7 +4388,7 @@ line containing if .Ar string starts with -.Dq ^ , +.Sq ^ , the remainder of the string must appear at the start of the history line for it to match. .It Ar n Ns Ic \&? Ns Ar string diff --git a/bin/ksh/sh.1 b/bin/ksh/sh.1 index c57ec5044a1..c1a2fad6976 100644 --- a/bin/ksh/sh.1 +++ b/bin/ksh/sh.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sh.1,v 1.9 1999/03/02 23:46:54 aaron Exp $ +.\" $OpenBSD: sh.1,v 1.10 1999/05/28 12:23:06 aaron Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -150,10 +150,10 @@ option of the built-in command can't be used. .It Redirections that create files can't be used (i.e., -.Dq > , -.Dq >| , -.Dq >> , -.Dq <> ) . +.Sq > , +.Sq >| , +.Sq >> , +.Sq <> ) . .El .Pp A shell is @@ -176,7 +176,7 @@ 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 (i.e., argv[0]) starts with -.Dq \&- +.Sq \&- or if the .Fl l option is used, @@ -216,43 +216,43 @@ The shells begins parsing its input by breaking it into Words, which are sequences of characters, are delimited by unquoted whitespace characters (space, tab, and newline) or meta-characters .Po -.Dq \&< , -.Dq \&> , -.Dq \&| , -.Dq \&; , -.Dq \&( , +.Sq \&< , +.Sq \&> , +.Sq \&| , +.Sq \&; , +.Sq \&( , and -.Dq \&) +.Sq \&) .Pc . Aside from delimiting words, spaces and tabs are ignored, while newlines usually delimit commands. The meta-charcters are used in building the following tokens: -.Dq \&< , -.Dq \&<\&& , -.Dq \&<\&< , -.Dq \&> , -.Dq \&>\&& , -.Dq \&>\&> , +.Sq \&< , +.Sq \&<\&& , +.Sq \&<\&< , +.Sq \&> , +.Sq \&>\&& , +.Sq \&>\&> , etc. are used to specify redirections (see .Sx Input/output redirection below); -.Dq \&| +.Sq \&| is used to create pipelines; -.Dq \&; +.Sq \&; is used to separate commands; -.Dq \&& +.Sq \&& is used to create asynchronous pipelines; -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| are used to specify conditional execution; -.Dq \&;\&; +.Sq \&;\&; is used in .Ic case statements; and lastly, -.Dq \&( .. \&) -are used to create subshells. +.Sq \&( .. \&) +is used to create subshells. .Pp Whitespace and meta-characters can be quoted individually using a backslash .Pq Sq \e , @@ -262,52 +262,52 @@ or single .Pq Sq \&' quotes. Note that the following characters are also treated specially by the shell and must be quoted if they are to represent themselves: -.Dq \e , -.Dq \&" , -.Dq \&' , -.Dq \&# , -.Dq \&$ , -.Dq \&` , -.Dq \&~ , -.Dq \&{ , -.Dq \&} , -.Dq \&* , -.Dq \&? , +.Sq \e , +.Sq \&" , +.Sq \&' , +.Sq \&# , +.Sq \&$ , +.Sq \&` , +.Sq \&~ , +.Sq \&{ , +.Sq \&} , +.Sq \&* , +.Sq \&? , and -.Dq \&[ . +.Sq \&[ . The first three of these are the above mentioned quoting characters (see .Sx Quoting below); -.Dq \&# , +.Sq \&# , if used at the beginning of a word, introduces a comment -- everything after the -.Dq \&# +.Sq \&# up to the nearest newline is ignored; -.Dq \&$ +.Sq \&$ is used to introduce parameter, command and arithmetic substitutions (see .Sx Substitution below); -.Dq \&` +.Sq \&` introduces an old-style command substitution (see .Sx Substitution below); -.Dq \&~ +.Sq \&~ begins a directory expansion (see .Sx Tilde expansion below); -.Dq \&{ +.Sq \&{ and -.Dq \&} +.Sq \&} delimit .Xr csh 1 style alterations (see .Sx Brace expansion below); -and, finally, -.Dq \&* , -.Dq \&? , +and finally, +.Sq \&* , +.Sq \&? , and -.Dq \&[ +.Sq \&[ are used in file name generation (see .Sx File name patterns below). @@ -351,13 +351,13 @@ assignments is that of the last command substitution performed during the parameter assignment or 0 is there were no command substitutions. .Pp Commands can be chained together using the -.Dq \&| +.Sq \&| token to form pipelines, in which the standard output of each command but the last is piped (see .Xr pipe 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 -.Dq \&! +.Sq \&! reversed 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; if the original status was not 0, the complemented status will be 0. @@ -365,12 +365,12 @@ if the original status was not 0, the complemented status will be 0. .Em Lists of commands can be created by separating pipelines by any of the following tokens: -.Dq \&&\&& , -.Dq \&|\&| , -.Dq \&& , -.Dq \&|\&& , +.Sq \&&\&& , +.Sq \&|\&| , +.Sq \&& , +.Sq \&|\&& , and -.Dq \&; . +.Sq \&; . The first two are for conditional execution: .Dq Ar cmd1 No && Ar cmd2 executes @@ -378,22 +378,22 @@ executes only if the exit status of .Ar cmd1 is zero; -.Dq \&|\&| +.Sq \&|\&| is the opposite -- .Ar cmd2 is executed only if the exit status of .Ar cmd1 is non-zero. -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| have equal precedence which is higher that that of -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& and -.Dq \&; , +.Sq \&; , which also have equal precedence. The -.Dq \&& +.Sq \&& 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, see @@ -407,14 +407,14 @@ ignored and with input redirected from .Pa /dev/null (however, redirections specified in the asynchronous command have precedence). Note that a command must follow the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators, while it need not follow -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& or -.Dq \&; . +.Sq \&; . 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 @@ -491,9 +491,9 @@ used in .Ic case statements are the same as those used for file name patterns except that the restrictions regarding -.Dq \&. +.Sq \&. and -.Dq \&/ +.Sq \&/ 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 @@ -540,7 +540,7 @@ if is never executed, the exit status is zero. .Ar term is either a newline or a -.Dq \&; . +.Sq \&; . .It Xo Ic if Ar list Ic then .Ar list [ Ic elif Ar list Ic then .Ar list ] Ar ... [ Ic else @@ -611,39 +611,39 @@ below). .Ss Quoting Quoting is used to prevent the shell from treating characters or words specially. There are three methods of quoting. First, -.Dq \e +.Sq \e quotes the following character, unless it is at the end of a line, in which case both the -.Dq \e +.Sq \e and the newline are stripped. Second, a single quote .Pq Sq ' quotes everything up to the next single quote (this may span lines). Third, a double quote .Pq Sq \&" quotes all characters, except -.Dq \&$ , -.Dq \&` +.Sq \&$ , +.Sq \&` and -.Dq \e , +.Sq \e , up to the next unquoted double quote. -.Dq $ +.Sq $ and -.Dq ` +.Sq ` inside double quotes have their usual meaning (i.e., parameter, command or arithmetic substitution) except no field splitting is carried out on the results of double-quoted substitutions. If a -.Dq \e +.Sq \e inside a double-quoted string is followed by -.Dq \e , -.Dq $ , -.Dq ` , +.Sq \e , +.Sq $ , +.Sq ` , or -.Dq \&" , +.Sq \&" , it is replaced by the second character; if it is followed by a newline, both the -.Dq \e +.Sq \e and the newline are stripped; otherwise, both the -.Dq \e +.Sq \e and the character following are unchanged. .Pp NOTE: See @@ -780,14 +780,14 @@ substitutions, normal quoting rules are used when is parsed, however, for the .Ic ` Ns Ar command Ns Ic ` form, a -.Dq \e +.Sq \e followed by any of -.Dq $ , -.Dq ` , +.Sq $ , +.Sq ` , or -.Dq \e +.Sq \e is stripped (a -.Dq \e +.Sq \e followed by any other character is unchanged). As a special case in command substitutions, a command of the form .Ic \&< Ar file @@ -816,7 +816,7 @@ 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 .Po -.Dq _ +.Sq _ counts as a letter .Pc . Parameter substitutions take the form @@ -854,7 +854,7 @@ 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 -.Dq = +.Sq = must be unquoted for the shell to recognize a parameter assignment. The fourth way of setting a parameter is with the .Ic export , @@ -946,7 +946,7 @@ is used instead. .El .Pp In the above modifiers, the -.Dq \&: +.Sq \&: can be omitted, in which case the conditions only depand on .Ar name being set (as opposed to set and not @@ -964,8 +964,8 @@ The following forms of parameter substitution can also be used: The number of positional parameters if .Ar name is -.Dq \&* , -.Dq \&@ , +.Sq \&* , +.Sq \&@ , not specified, or the length of the string value of parameter .Ar name . .It Xo Ic ${# Ns Ar name Ns @@ -984,7 +984,7 @@ If matches the beginning of the value of parameter .Ar name , the matched text is deleted from the result of substitution. A single -.Dq \&# +.Sq \&# results in the shortest match, two of them results in the longest match. .Sm off @@ -1068,7 +1068,7 @@ Search path for the built-in command. Works the same way as .Ev PATH for those directories not beginning with -.Dq \&/ +.Sq \&/ in .Ic cd commands. Note that if @@ -1206,13 +1206,13 @@ files are created in .Ss Tilde expansion Tilde expansion, which is done in parallel with parameter substitution, is done on words starting with an unquoted -.Dq ~ . +.Sq ~ . The characters following the tilde, up to the first -.Dq / , +.Sq / , if any, are assumed to be a login name. If the login name is empty, -.Dq \&+ +.Sq \&+ or -.Dq \&- , +.Sq \&- , the value of the .Ev HOME , PWD or @@ -1241,9 +1241,9 @@ command may be used to list, change and add to this cache (e.g., .Ic alias -d fac=/usr/local/facilities; cd ~fac/bin ) . .Ss File name patterns A file name pattern is a word containing one or more unquoted -.Dq \&? +.Sq \&? or -.Dq \&* +.Sq \&* characters or .Dq [..] sequences. Once brace expansion has been performed, the shell replaces file @@ -1258,19 +1258,19 @@ Matches any sequence of characters. .It Ic \&[ Ns No .. Ns Ic \&] Matches any of the characters inside the brackets. Ranges of characters can be specified by separating two characters by a -.Dq \&- +.Sq \&- (e.g., .Dq [a0-9] matches the letter .Dq a or any digit). In order to represent itself, a -.Dq \&- +.Sq \&- must either be quoted or the first or last character in the character list. Similarly, a -.Dq \&] +.Sq \&] must be quoted or the first character in the list if it is to represent itself instead of the end of the list. Also, a -.Dq \&! +.Sq \&! 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. .It Ic \&[\&! Ns No .. Ns Ic \&] @@ -1310,7 +1310,7 @@ If the .Ic markdirs option is set, any directories that result from file name generation are marked with a trailing -.Dq / . +.Sq / . .Pp The POSIX character classes (i.e., .Ic \&[\&: Ns Ar class-name Ns Ic \&:\&] @@ -1380,9 +1380,9 @@ parameter, command and arithmetic substitutions are performed, along with backslash .Pq Sq \e escapes for -.Dq \&$ , -.Dq ` , -.Dq \e , +.Sq \&$ , +.Sq ` , +.Sq \e , and .Dq \enewline . If multiple here documents are used on the same command line, they are saved in @@ -1397,10 +1397,10 @@ Standard input is duplicated from file descriptor .Ar fd can be a single digit, indicating the number of an existing file descriptor; the letter -.Dq p , +.Sq p , indicating the file descriptor associated with the output of the current co-process; or the character -.Dq \&- , +.Sq \&- , indicating standard input is to be closed. .It Ic \&>\&& Ar fd Same as @@ -1755,11 +1755,11 @@ non-POSIX mode, the exit status is that of the last foregrounded job. .It .Ic getopts . In POSIX mode, options must start with a -.Dq \&- ; +.Sq \&- ; in non-POSIX mode, options can start with either -.Dq \&- +.Sq \&- or -.Dq \&+ . +.Sq \&+ . .It Brace expansion (also known as alternation). In POSIX mode, brace expansion is disabled; in non-POSIX mode, brace expansion is enabled. Note that @@ -1824,9 +1824,9 @@ in POSIX mode, in non-POSIX mode. .It Test. In POSIX mode, the expression -.Dq Fl t +.Sq Fl t (preceded by some number of -.Dq Ic \&! +.Sq Ic \&! arguments) is always true as it is a non-zero length string; in non-POSIX mode, it tests if file descriptor 1 is a tty (i.e., the .Ar fd @@ -1924,7 +1924,7 @@ as where .Ar value is quoted. If options were preceded with -.Dq \&+ , +.Sq \&+ , or a lone \&+ is given on the command line, only .Ar name is printed. In addition, if the @@ -2009,7 +2009,7 @@ is missing, the home directory is used. If .Ar dir is -.Dq \&- , +.Sq \&- , the previous working directory is used (see .Ev OLDPWD parameter). If the @@ -2077,7 +2077,7 @@ defaults to 1. Prints its arguments (separated by spaces) followed by a newline, to the standard output. The newline is suppressed if any of the arguments contain the backslash sequence -.Dq \ec . +.Sq \ec . See the .Ic print command below for a list of other backslash sequences that are recognized. @@ -2170,11 +2170,11 @@ is invoked, it places the next option in the shell parameter and the index of the next argument to be processed in the shell parameter .Ev OPTIND . If the option was introduced with a -.Dq \&+ , +.Sq \&+ , the option places in .Ar name is prefixed with a -.Dq \&+ . +.Sq \&+ . When an option requires an argument, .Ic getopts places it in the shell parameter @@ -2193,9 +2193,9 @@ When the end of the options is encountered, .Ic getopts exits with a non-zero exit status. Options end at the first (non-option argument) argument that does not start with a -.Dq \&- , +.Sq \&- , or when a -.Dq \&-\&- +.Sq \&-\&- argument is encountered. .Pp Option parsing can be reset by setting @@ -2260,23 +2260,23 @@ terminated with a newline. The .Fl n option suppresses the newline. By default, certain C escapes are translated. These include -.Dq \eb , -.Dq \ef , -.Dq \en , -.Dq \er , -.Dq \et , -.Dq \ev , +.Sq \eb , +.Sq \ef , +.Sq \en , +.Sq \er , +.Sq \et , +.Sq \ev , and -.Dq \e0### +.Sq \e0### .Po -.Dq # +.Sq # is an octal digit, of which there may be 0 to 3 .Pc . -.Dq \ec +.Sq \ec is equivalent to using the .Fl n option. -.Dq \e +.Sq \e expansion may be inhibited with the .Fl r option. The @@ -2301,7 +2301,7 @@ option is used to emulate, to some degree, the .Bx .Xr echo command, which does not process -.Dq \e +.Sq \e sequences unless the .Fl e option is given. As above, the @@ -2503,10 +2503,10 @@ if is used). .It Fl u Ic nounset Referencing of an unset parameter is treated as an error, unless one of the -.Dq \&- , -.Dq \&+ +.Sq \&- , +.Sq \&+ or -.Dq = +.Sq = modifiers is used. .It Fl v Ic verbose Write shell input to standard error as it is read. @@ -2516,7 +2516,7 @@ the value of .Ev PS4 . .It Fl X Ic markdirs Mark directories with a trailing -.Dq / +.Sq / during file name generation. .It Ic bgnice Background jobs are run with lower priority. @@ -2597,11 +2597,11 @@ will print the long names of all options that are currently on. .Pp Remaining arguments, if any, are positional parameters and are assigned, in order, to the positional parameters (i.e., $1, $2, etc.). If options end with -.Dq \&-\&- +.Sq \&-\&- and there are no remaining arguments, all positional parameters are cleared. If no options or arguments are given, the values of all names are printed. For unknown historical reasons, a lone -.Dq \&- +.Sq \&- option is treated specially -- it clears both the .Fl x and @@ -2709,7 +2709,7 @@ is set (see .Ic set command above for a list of options). As a non-standard extension, if the option starts with a -.Dq \&! , +.Sq \&! , the test is negated; the test always fails if .Ar option doesn't exist (thus @@ -2802,15 +2802,15 @@ arguments to or .Ic \&[ ... \&] is less than five; if leading -.Dq \&! +.Sq \&! arguments can be stripped such that only one argument remains then a string length test is performed (again, even if the argument is a unary operator); if leading -.Dq \&! +.Sq \&! arguments can be stripped such that three arguments remain and the second argument is a binary operator, then the binary operation is performed (even if the first argument is a unary operator, including an unstripped -.Dq \&! ) . +.Sq \&! ) . .Pp NOTE: A common mistake is to use .Ic if \&[ $foo = bar \&] @@ -2821,9 +2821,9 @@ is or unset, if it has embedded spaces (i.e., .Ev IFS characters), or if it is a unary operator like -.Dq Ic \&! +.Sq Ic \&! or -.Dq Fl n . +.Sq Fl n . Use tests like .Ic if \&[ \&"X$foo\&" = Xbar \&] instead. @@ -2894,10 +2894,10 @@ arguments, parameter attributes are displayed; if no options are used, the current attributes of all parameters are printed as .Ic typeset commands; if an option is given (or -.Dq \&- +.Sq \&- with no option letter), all parameters and their values with the specified attributes are printed; if options are introduced with -.Dq \&+ , +.Sq \&+ , parameter values are not printed. .Pp If @@ -2919,7 +2919,7 @@ operates on the attributes of functions. As with parameters, if no .Ar name Ns s are given, functions are listed with their values (i.e., definitions) unless options are introduced with -.Dq \&+ , +.Sq \&+ , in which case only the function names are reported. .Bl -tag -width 3n .It Fl L Ns Ar n @@ -3261,9 +3261,9 @@ where is the job number of the job. .It Ar flag is the -.Dq \&+ +.Sq \&+ or -.Dq \&- +.Sq \&- character if the job is the .Ic %\&+ or .Ic %\&- diff --git a/bin/ksh/sh.1tbl b/bin/ksh/sh.1tbl index 1c8268372a1..97ae3b773c5 100644 --- a/bin/ksh/sh.1tbl +++ b/bin/ksh/sh.1tbl @@ -1,4 +1,4 @@ -.\" $OpenBSD: sh.1tbl,v 1.9 1999/03/02 23:46:54 aaron Exp $ +.\" $OpenBSD: sh.1tbl,v 1.10 1999/05/28 12:23:06 aaron Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -150,10 +150,10 @@ option of the built-in command can't be used. .It Redirections that create files can't be used (i.e., -.Dq > , -.Dq >| , -.Dq >> , -.Dq <> ) . +.Sq > , +.Sq >| , +.Sq >> , +.Sq <> ) . .El .Pp A shell is @@ -176,7 +176,7 @@ 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 (i.e., argv[0]) starts with -.Dq \&- +.Sq \&- or if the .Fl l option is used, @@ -216,43 +216,43 @@ The shells begins parsing its input by breaking it into Words, which are sequences of characters, are delimited by unquoted whitespace characters (space, tab, and newline) or meta-characters .Po -.Dq \&< , -.Dq \&> , -.Dq \&| , -.Dq \&; , -.Dq \&( , +.Sq \&< , +.Sq \&> , +.Sq \&| , +.Sq \&; , +.Sq \&( , and -.Dq \&) +.Sq \&) .Pc . Aside from delimiting words, spaces and tabs are ignored, while newlines usually delimit commands. The meta-charcters are used in building the following tokens: -.Dq \&< , -.Dq \&<\&& , -.Dq \&<\&< , -.Dq \&> , -.Dq \&>\&& , -.Dq \&>\&> , +.Sq \&< , +.Sq \&<\&& , +.Sq \&<\&< , +.Sq \&> , +.Sq \&>\&& , +.Sq \&>\&> , etc. are used to specify redirections (see .Sx Input/output redirection below); -.Dq \&| +.Sq \&| is used to create pipelines; -.Dq \&; +.Sq \&; is used to separate commands; -.Dq \&& +.Sq \&& is used to create asynchronous pipelines; -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| are used to specify conditional execution; -.Dq \&;\&; +.Sq \&;\&; is used in .Ic case statements; and lastly, -.Dq \&( .. \&) -are used to create subshells. +.Sq \&( .. \&) +is used to create subshells. .Pp Whitespace and meta-characters can be quoted individually using a backslash .Pq Sq \e , @@ -262,52 +262,52 @@ or single .Pq Sq \&' quotes. Note that the following characters are also treated specially by the shell and must be quoted if they are to represent themselves: -.Dq \e , -.Dq \&" , -.Dq \&' , -.Dq \&# , -.Dq \&$ , -.Dq \&` , -.Dq \&~ , -.Dq \&{ , -.Dq \&} , -.Dq \&* , -.Dq \&? , +.Sq \e , +.Sq \&" , +.Sq \&' , +.Sq \&# , +.Sq \&$ , +.Sq \&` , +.Sq \&~ , +.Sq \&{ , +.Sq \&} , +.Sq \&* , +.Sq \&? , and -.Dq \&[ . +.Sq \&[ . The first three of these are the above mentioned quoting characters (see .Sx Quoting below); -.Dq \&# , +.Sq \&# , if used at the beginning of a word, introduces a comment -- everything after the -.Dq \&# +.Sq \&# up to the nearest newline is ignored; -.Dq \&$ +.Sq \&$ is used to introduce parameter, command and arithmetic substitutions (see .Sx Substitution below); -.Dq \&` +.Sq \&` introduces an old-style command substitution (see .Sx Substitution below); -.Dq \&~ +.Sq \&~ begins a directory expansion (see .Sx Tilde expansion below); -.Dq \&{ +.Sq \&{ and -.Dq \&} +.Sq \&} delimit .Xr csh 1 style alterations (see .Sx Brace expansion below); -and, finally, -.Dq \&* , -.Dq \&? , +and finally, +.Sq \&* , +.Sq \&? , and -.Dq \&[ +.Sq \&[ are used in file name generation (see .Sx File name patterns below). @@ -351,13 +351,13 @@ assignments is that of the last command substitution performed during the parameter assignment or 0 is there were no command substitutions. .Pp Commands can be chained together using the -.Dq \&| +.Sq \&| token to form pipelines, in which the standard output of each command but the last is piped (see .Xr pipe 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 -.Dq \&! +.Sq \&! reversed 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; if the original status was not 0, the complemented status will be 0. @@ -365,12 +365,12 @@ if the original status was not 0, the complemented status will be 0. .Em Lists of commands can be created by separating pipelines by any of the following tokens: -.Dq \&&\&& , -.Dq \&|\&| , -.Dq \&& , -.Dq \&|\&& , +.Sq \&&\&& , +.Sq \&|\&| , +.Sq \&& , +.Sq \&|\&& , and -.Dq \&; . +.Sq \&; . The first two are for conditional execution: .Dq Ar cmd1 No && Ar cmd2 executes @@ -378,22 +378,22 @@ executes only if the exit status of .Ar cmd1 is zero; -.Dq \&|\&| +.Sq \&|\&| is the opposite -- .Ar cmd2 is executed only if the exit status of .Ar cmd1 is non-zero. -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| have equal precedence which is higher that that of -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& and -.Dq \&; , +.Sq \&; , which also have equal precedence. The -.Dq \&& +.Sq \&& 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, see @@ -407,14 +407,14 @@ ignored and with input redirected from .Pa /dev/null (however, redirections specified in the asynchronous command have precedence). Note that a command must follow the -.Dq \&&\&& +.Sq \&&\&& and -.Dq \&|\&| +.Sq \&|\&| operators, while it need not follow -.Dq \&& , -.Dq \&|\&& +.Sq \&& , +.Sq \&|\&& or -.Dq \&; . +.Sq \&; . 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 @@ -491,9 +491,9 @@ used in .Ic case statements are the same as those used for file name patterns except that the restrictions regarding -.Dq \&. +.Sq \&. and -.Dq \&/ +.Sq \&/ 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 @@ -540,7 +540,7 @@ if is never executed, the exit status is zero. .Ar term is either a newline or a -.Dq \&; . +.Sq \&; . .It Xo Ic if Ar list Ic then .Ar list [ Ic elif Ar list Ic then .Ar list ] Ar ... [ Ic else @@ -611,39 +611,39 @@ below). .Ss Quoting Quoting is used to prevent the shell from treating characters or words specially. There are three methods of quoting. First, -.Dq \e +.Sq \e quotes the following character, unless it is at the end of a line, in which case both the -.Dq \e +.Sq \e and the newline are stripped. Second, a single quote .Pq Sq ' quotes everything up to the next single quote (this may span lines). Third, a double quote .Pq Sq \&" quotes all characters, except -.Dq \&$ , -.Dq \&` +.Sq \&$ , +.Sq \&` and -.Dq \e , +.Sq \e , up to the next unquoted double quote. -.Dq $ +.Sq $ and -.Dq ` +.Sq ` inside double quotes have their usual meaning (i.e., parameter, command or arithmetic substitution) except no field splitting is carried out on the results of double-quoted substitutions. If a -.Dq \e +.Sq \e inside a double-quoted string is followed by -.Dq \e , -.Dq $ , -.Dq ` , +.Sq \e , +.Sq $ , +.Sq ` , or -.Dq \&" , +.Sq \&" , it is replaced by the second character; if it is followed by a newline, both the -.Dq \e +.Sq \e and the newline are stripped; otherwise, both the -.Dq \e +.Sq \e and the character following are unchanged. .Pp NOTE: See @@ -780,14 +780,14 @@ substitutions, normal quoting rules are used when is parsed, however, for the .Ic ` Ns Ar command Ns Ic ` form, a -.Dq \e +.Sq \e followed by any of -.Dq $ , -.Dq ` , +.Sq $ , +.Sq ` , or -.Dq \e +.Sq \e is stripped (a -.Dq \e +.Sq \e followed by any other character is unchanged). As a special case in command substitutions, a command of the form .Ic \&< Ar file @@ -816,7 +816,7 @@ 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 .Po -.Dq _ +.Sq _ counts as a letter .Pc . Parameter substitutions take the form @@ -854,7 +854,7 @@ 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 -.Dq = +.Sq = must be unquoted for the shell to recognize a parameter assignment. The fourth way of setting a parameter is with the .Ic export , @@ -946,7 +946,7 @@ is used instead. .El .Pp In the above modifiers, the -.Dq \&: +.Sq \&: can be omitted, in which case the conditions only depand on .Ar name being set (as opposed to set and not @@ -964,8 +964,8 @@ The following forms of parameter substitution can also be used: The number of positional parameters if .Ar name is -.Dq \&* , -.Dq \&@ , +.Sq \&* , +.Sq \&@ , not specified, or the length of the string value of parameter .Ar name . .It Xo Ic ${# Ns Ar name Ns @@ -984,7 +984,7 @@ If matches the beginning of the value of parameter .Ar name , the matched text is deleted from the result of substitution. A single -.Dq \&# +.Sq \&# results in the shortest match, two of them results in the longest match. .Sm off @@ -1068,7 +1068,7 @@ Search path for the built-in command. Works the same way as .Ev PATH for those directories not beginning with -.Dq \&/ +.Sq \&/ in .Ic cd commands. Note that if @@ -1206,13 +1206,13 @@ files are created in .Ss Tilde expansion Tilde expansion, which is done in parallel with parameter substitution, is done on words starting with an unquoted -.Dq ~ . +.Sq ~ . The characters following the tilde, up to the first -.Dq / , +.Sq / , if any, are assumed to be a login name. If the login name is empty, -.Dq \&+ +.Sq \&+ or -.Dq \&- , +.Sq \&- , the value of the .Ev HOME , PWD or @@ -1241,9 +1241,9 @@ command may be used to list, change and add to this cache (e.g., .Ic alias -d fac=/usr/local/facilities; cd ~fac/bin ) . .Ss File name patterns A file name pattern is a word containing one or more unquoted -.Dq \&? +.Sq \&? or -.Dq \&* +.Sq \&* characters or .Dq [..] sequences. Once brace expansion has been performed, the shell replaces file @@ -1258,19 +1258,19 @@ Matches any sequence of characters. .It Ic \&[ Ns No .. Ns Ic \&] Matches any of the characters inside the brackets. Ranges of characters can be specified by separating two characters by a -.Dq \&- +.Sq \&- (e.g., .Dq [a0-9] matches the letter .Dq a or any digit). In order to represent itself, a -.Dq \&- +.Sq \&- must either be quoted or the first or last character in the character list. Similarly, a -.Dq \&] +.Sq \&] must be quoted or the first character in the list if it is to represent itself instead of the end of the list. Also, a -.Dq \&! +.Sq \&! 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. .It Ic \&[\&! Ns No .. Ns Ic \&] @@ -1310,7 +1310,7 @@ If the .Ic markdirs option is set, any directories that result from file name generation are marked with a trailing -.Dq / . +.Sq / . .Pp The POSIX character classes (i.e., .Ic \&[\&: Ns Ar class-name Ns Ic \&:\&] @@ -1380,9 +1380,9 @@ parameter, command and arithmetic substitutions are performed, along with backslash .Pq Sq \e escapes for -.Dq \&$ , -.Dq ` , -.Dq \e , +.Sq \&$ , +.Sq ` , +.Sq \e , and .Dq \enewline . If multiple here documents are used on the same command line, they are saved in @@ -1397,10 +1397,10 @@ Standard input is duplicated from file descriptor .Ar fd can be a single digit, indicating the number of an existing file descriptor; the letter -.Dq p , +.Sq p , indicating the file descriptor associated with the output of the current co-process; or the character -.Dq \&- , +.Sq \&- , indicating standard input is to be closed. .It Ic \&>\&& Ar fd Same as @@ -1755,11 +1755,11 @@ non-POSIX mode, the exit status is that of the last foregrounded job. .It .Ic getopts . In POSIX mode, options must start with a -.Dq \&- ; +.Sq \&- ; in non-POSIX mode, options can start with either -.Dq \&- +.Sq \&- or -.Dq \&+ . +.Sq \&+ . .It Brace expansion (also known as alternation). In POSIX mode, brace expansion is disabled; in non-POSIX mode, brace expansion is enabled. Note that @@ -1824,9 +1824,9 @@ in POSIX mode, in non-POSIX mode. .It Test. In POSIX mode, the expression -.Dq Fl t +.Sq Fl t (preceded by some number of -.Dq Ic \&! +.Sq Ic \&! arguments) is always true as it is a non-zero length string; in non-POSIX mode, it tests if file descriptor 1 is a tty (i.e., the .Ar fd @@ -1924,7 +1924,7 @@ as where .Ar value is quoted. If options were preceded with -.Dq \&+ , +.Sq \&+ , or a lone \&+ is given on the command line, only .Ar name is printed. In addition, if the @@ -2009,7 +2009,7 @@ is missing, the home directory is used. If .Ar dir is -.Dq \&- , +.Sq \&- , the previous working directory is used (see .Ev OLDPWD parameter). If the @@ -2077,7 +2077,7 @@ defaults to 1. Prints its arguments (separated by spaces) followed by a newline, to the standard output. The newline is suppressed if any of the arguments contain the backslash sequence -.Dq \ec . +.Sq \ec . See the .Ic print command below for a list of other backslash sequences that are recognized. @@ -2170,11 +2170,11 @@ is invoked, it places the next option in the shell parameter and the index of the next argument to be processed in the shell parameter .Ev OPTIND . If the option was introduced with a -.Dq \&+ , +.Sq \&+ , the option places in .Ar name is prefixed with a -.Dq \&+ . +.Sq \&+ . When an option requires an argument, .Ic getopts places it in the shell parameter @@ -2193,9 +2193,9 @@ When the end of the options is encountered, .Ic getopts exits with a non-zero exit status. Options end at the first (non-option argument) argument that does not start with a -.Dq \&- , +.Sq \&- , or when a -.Dq \&-\&- +.Sq \&-\&- argument is encountered. .Pp Option parsing can be reset by setting @@ -2260,23 +2260,23 @@ terminated with a newline. The .Fl n option suppresses the newline. By default, certain C escapes are translated. These include -.Dq \eb , -.Dq \ef , -.Dq \en , -.Dq \er , -.Dq \et , -.Dq \ev , +.Sq \eb , +.Sq \ef , +.Sq \en , +.Sq \er , +.Sq \et , +.Sq \ev , and -.Dq \e0### +.Sq \e0### .Po -.Dq # +.Sq # is an octal digit, of which there may be 0 to 3 .Pc . -.Dq \ec +.Sq \ec is equivalent to using the .Fl n option. -.Dq \e +.Sq \e expansion may be inhibited with the .Fl r option. The @@ -2301,7 +2301,7 @@ option is used to emulate, to some degree, the .Bx .Xr echo command, which does not process -.Dq \e +.Sq \e sequences unless the .Fl e option is given. As above, the @@ -2503,10 +2503,10 @@ if is used). .It Fl u Ic nounset Referencing of an unset parameter is treated as an error, unless one of the -.Dq \&- , -.Dq \&+ +.Sq \&- , +.Sq \&+ or -.Dq = +.Sq = modifiers is used. .It Fl v Ic verbose Write shell input to standard error as it is read. @@ -2516,7 +2516,7 @@ the value of .Ev PS4 . .It Fl X Ic markdirs Mark directories with a trailing -.Dq / +.Sq / during file name generation. .It Ic bgnice Background jobs are run with lower priority. @@ -2597,11 +2597,11 @@ will print the long names of all options that are currently on. .Pp Remaining arguments, if any, are positional parameters and are assigned, in order, to the positional parameters (i.e., $1, $2, etc.). If options end with -.Dq \&-\&- +.Sq \&-\&- and there are no remaining arguments, all positional parameters are cleared. If no options or arguments are given, the values of all names are printed. For unknown historical reasons, a lone -.Dq \&- +.Sq \&- option is treated specially -- it clears both the .Fl x and @@ -2709,7 +2709,7 @@ is set (see .Ic set command above for a list of options). As a non-standard extension, if the option starts with a -.Dq \&! , +.Sq \&! , the test is negated; the test always fails if .Ar option doesn't exist (thus @@ -2802,15 +2802,15 @@ arguments to or .Ic \&[ ... \&] is less than five; if leading -.Dq \&! +.Sq \&! arguments can be stripped such that only one argument remains then a string length test is performed (again, even if the argument is a unary operator); if leading -.Dq \&! +.Sq \&! arguments can be stripped such that three arguments remain and the second argument is a binary operator, then the binary operation is performed (even if the first argument is a unary operator, including an unstripped -.Dq \&! ) . +.Sq \&! ) . .Pp NOTE: A common mistake is to use .Ic if \&[ $foo = bar \&] @@ -2821,9 +2821,9 @@ is or unset, if it has embedded spaces (i.e., .Ev IFS characters), or if it is a unary operator like -.Dq Ic \&! +.Sq Ic \&! or -.Dq Fl n . +.Sq Fl n . Use tests like .Ic if \&[ \&"X$foo\&" = Xbar \&] instead. @@ -2894,10 +2894,10 @@ arguments, parameter attributes are displayed; if no options are used, the current attributes of all parameters are printed as .Ic typeset commands; if an option is given (or -.Dq \&- +.Sq \&- with no option letter), all parameters and their values with the specified attributes are printed; if options are introduced with -.Dq \&+ , +.Sq \&+ , parameter values are not printed. .Pp If @@ -2919,7 +2919,7 @@ operates on the attributes of functions. As with parameters, if no .Ar name Ns s are given, functions are listed with their values (i.e., definitions) unless options are introduced with -.Dq \&+ , +.Sq \&+ , in which case only the function names are reported. .Bl -tag -width 3n .It Fl L Ns Ar n @@ -3261,9 +3261,9 @@ where is the job number of the job. .It Ar flag is the -.Dq \&+ +.Sq \&+ or -.Dq \&- +.Sq \&- character if the job is the .Ic %\&+ or .Ic %\&- |