diff options
Diffstat (limited to 'bin/ksh/ksh.1')
-rw-r--r-- | bin/ksh/ksh.1 | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1 index 6f066e78b30..3e58f42c18e 100644 --- a/bin/ksh/ksh.1 +++ b/bin/ksh/ksh.1 @@ -1,8 +1,8 @@ -.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ +.\" $OpenBSD: ksh.1,v 1.161 2015/09/14 20:06:58 schwarze Exp $ .\" .\" Public Domain .\" -.Dd $Mdocdate: July 4 2015 $ +.Dd $Mdocdate: September 14 2015 $ .Dt KSH 1 .Os .Sh NAME @@ -900,15 +900,15 @@ There are three kinds of substitution: parameter, command, and arithmetic. Parameter substitutions, which are described in detail in the next section, take the form -.Pf $ Ns Ar name +.Pf $ Ar name or -.Pf ${ Ns Ar ... Ns } ; +.Pf ${ Ar ... Ns } ; command substitutions take the form -.Pf $( Ns Ar command Ns \&) +.Pf $( Ar command ) or -.Pf ` Ns Ar command Ns ` ; +.Pf ` Ar command Ns ` ; and arithmetic substitutions take the form -.Pf $(( Ns Ar expression Ns )) . +.Pf $(( Ar expression ) ) . .Pp If a substitution appears outside of double quotes, the results of the substitution are generally subject to word or field splitting according to @@ -984,11 +984,11 @@ brace expansion and file name expansion (see the relevant sections below). A command substitution is replaced by the output generated by the specified command, which is run in a subshell. For -.Pf $( Ns Ar command Ns \&) +.Pf $( Ar command ) substitutions, normal quoting rules are used when .Ar command is parsed; however, for the -.Pf ` Ns Ar command Ns ` +.Pf ` Ar command Ns ` form, a .Ql \e followed by any of @@ -1000,7 +1000,7 @@ is stripped (a .Ql \e followed by any other character is unchanged). As a special case in command substitutions, a command of the form -.Pf \*(Lt Ar file +.Pf < Ar file is interpreted to mean substitute the contents of .Ar file . Note that @@ -1010,7 +1010,7 @@ has the same effect as but it is carried out more efficiently because no process is started. .Pp .Sy Note : -.Pf $( Ns Ar command Ns \&) +.Pf $( Ar command ) expressions are currently parsed by finding the matching parenthesis, regardless of quoting. This should be fixed soon. @@ -1039,11 +1039,11 @@ where .Ar expr is an arithmetic expression. Parameter substitutions take the form -.Pf $ Ns Ar name , -.Pf ${ Ns Ar name Ns } , +.Pf $ Ar name , +.Pf ${ Ar name Ns } , or .Sm off -.Pf ${ Ar name Oo Ar expr Oc } +.Pf ${ Ar name Bo Ar expr Bc } .Sm on where .Ar name @@ -1115,9 +1115,7 @@ Lastly, parameters can be assigned values using assignment operators inside arithmetic expressions (see .Sx Arithmetic expressions below) or using the -.Sm off -.Pf ${ Ar name No = Ar value No } -.Sm on +.Pf ${ Ar name Ns = Ns Ar value Ns } form of the parameter substitution (see below). .Pp Parameters with the export attribute (set using the @@ -1137,7 +1135,7 @@ from its environment and automatically sets the export attribute for those parameters. .Pp Modifiers can be applied to the -.Pf ${ Ns Ar name Ns } +.Pf ${ Ar name Ns } form of parameter substitution: .Bl -tag -width Ds .Sm off @@ -1209,7 +1207,7 @@ is not needed, it is not evaluated. The following forms of parameter substitution can also be used: .Pp .Bl -tag -width Ds -compact -.It Pf ${# Ns Ar name Ns \&} +.It Pf ${# Ar name Ns } The number of positional parameters if .Ar name is @@ -1218,21 +1216,13 @@ is or not specified; otherwise the length of the string value of parameter .Ar name . .Pp -.It Pf ${# Ns Ar name Ns [*]} -.It Pf ${# Ns Ar name Ns [@]} +.It Pf ${# Ar name Ns [*]} +.It Pf ${# Ar name Ns [@]} The number of elements in the array .Ar name . .Pp -.Sm off -.It Xo -.Pf ${ Ar name -.Pf # Ar pattern No } -.Xc -.It Xo -.Pf ${ Ar name -.Pf ## Ar pattern No } -.Xc -.Sm on +.It Pf ${ Ar name Ns # Ns Ar pattern Ns } +.It Pf ${ Ar name Ns ## Ns Ar pattern Ns } If .Ar pattern matches the beginning of the value of parameter @@ -1243,16 +1233,8 @@ A single results in the shortest match, and two of them result in the longest match. .Pp -.Sm off -.It Xo -.Pf ${ Ar name -.Pf % Ar pattern No } -.Xc -.It Xo -.Pf ${ Ar name -.Pf %% Ar pattern No } -.Xc -.Sm on +.It Pf ${ Ar name Ns % Ns Ar pattern Ns } +.It Pf ${ Ar name Ns %% Ns Ar pattern Ns } Like ${..#..} substitution, but it deletes from the end of the value. .El .Pp @@ -4714,7 +4696,7 @@ bound to by default, written using caret notation e.g. the ASCII ESC character is written as ^[. ^[A-Z] sequences are not case sensitive. A count prefix for a command is entered using the sequence -.Pf ^[ Ns Ar n , +.Pf ^[ Ar n , where .Ar n is a sequence of 1 or more digits. |