diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 8568aa1973c3..9203a7000e5d 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -3940,8 +3940,8 @@ redefined for each instance. .PP When a type is defined a special built-in command of that name is added. These built-ins are declaration commands and follow the -same expansion rules as all the special built-in commands defined -below that are preceded by \(dg\(dg. These commands can subsequently +same expansion rules as the built-in commands described below +that are marked with a \(dd symbol. These commands can subsequently be used inside further type definitions. The man page for these commands can be generated by using the .B \-\-man @@ -7054,7 +7054,7 @@ to fail or zero if no command has failed. .TP 8 .B posix Enable full POSIX standard compliance mode. This option -is on by default if ksh is invoked as \fBsh\fR. It +is on by default if ksh is invoked as \fBsh\fR, \fBrsh\fR, or \fBpfsh\fR. It disables passing exported variables' attributes (such as integer or readonly) to a new ksh process through the environment, causes file descriptors > 2 to be left open when invoking another program, makes the \fB<>\fR redirection operator default to standard input, @@ -8046,14 +8046,48 @@ all interpretations of the given name to be reported. .SS Invocation. If the shell is invoked by .IR exec (2), -and the first character of argument zero +initialization depends on argument zero .RB ( $0 ) +as follows. +If the first character of +.B $0 is .BR \- , +or the +.B \-l +option is given on the invocation command line, then the shell is assumed to be a .I login -shell and -commands are read from +shell. +If the basename of the command path in +.B $0 +is +.BR rsh , +.BR rksh , +or +.BR krsh , +then the shell becomes restricted. +If it is +.BR pfsh +or +.BR pfksh , +then the shell becomes a profile shell (see +.IR pfexec (1)). +If the basename is +.BR sh , +.BR rsh , +or +.BR pfsh , +or the +.B \-o\ posix +option is given on the invocation command line, then +the shell is initialized in full POSIX compliance mode +(see the +.B set +builtin command above for more information). +After this, if the shell was assumed to be a +.I login +shell, commands are read from .B /etc/profile and then from either .B .profile @@ -8062,12 +8096,12 @@ in the current directory or if either file exists. Next, for interactive shells, commands are read from the file named by -performing parameter expansion, command substitution, -and arithmetic substitution on -the value of the environment variable .SM .B ENV -if the file exists. +if the file exists, its name being determined by +performing parameter expansion, command substitution, +and arithmetic substitution on +the value of that environment variable. If the .B \-s option is not present and