Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ksh Import pdksh V5.2.14.



details:   https://anonhg.NetBSD.org/src/rev/c2d64c2611e6
branches:  trunk
changeset: 477539:c2d64c2611e6
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Wed Oct 20 14:27:32 1999 +0000

description:
Import pdksh V5.2.14.
Includes lots of bugfixes.

diffstat:

 bin/ksh/ksh.Man |  3532 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 bin/ksh/mkman   |    44 +
 2 files changed, 3576 insertions(+), 0 deletions(-)

diffs (truncated from 3584 to 300 lines):

diff -r 8c0e5fe471e2 -r c2d64c2611e6 bin/ksh/ksh.Man
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ksh/ksh.Man   Wed Oct 20 14:27:32 1999 +0000
@@ -0,0 +1,3532 @@
+'\" t
+.\"{{{}}}
+.\"{{{  Notes about man page
+.\"     - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
+.\"       text and .ksh( and .ksh) for ksh specific text.
+.\"     - put i.e., e.g. and etc. in italics
+.\"}}}
+.\"{{{  To do
+.\" todo: Things not covered that should be:
+.\"    - distinguish (POSIX) special built-in's, (POSIX) regular built-in's,
+.\"      and sh/ksh weirdo built-in's (put S,R,X superscripts after command
+.\"      name in built-in commands section?)
+.\"    - need to be consistent about notation for `See section-name', `
+.\"      See description of foobar command', `See section section-name', etc.
+.\"    - need to use the term `external command' meaning `a command that is 
+.\"       executed using execve(2)' (as opposed to a built-in command or 
+.\"       function) for more clear description.
+.\"}}}
+.\"{{{  Title
+.ksh(
+.TH KSH 1 "August 19, 1996" "" "User commands"
+.ksh)
+.sh(
+.TH SH 1 "August 19, 1996" "" "User commands"
+.sh)
+.\"}}}
+.\"{{{  Name
+.SH NAME
+.ksh(
+ksh \- Public domain Korn shell
+.ksh)
+.sh(
+sh \- Public domain Bourne shell
+.sh)
+.\"}}}
+.\"{{{  Synopsis
+.SH SYNOPSIS
+.ad l
+.ksh(
+\fBksh\fP
+.ksh)
+.sh(
+\fBsh\fP
+.sh)
+[\fB\(+-abCefhikmnprsuvxX\fP] [\fB\(+-o\fP \fIoption\fP] [ [ \fB\-c\fP \fIcommand-string\fP [\fIcommand-name\fP] | \fB\-s\fP | \fIfile\fP ] [\fIargument\fP ...] ]
+.ad b
+.\"}}}
+.\"{{{  Description
+.SH DESCRIPTION
+.ksh(
+\fBksh\fP is a command interpreter that is intended for both 
+interactive and shell script use.  Its command language is a superset
+of the \fIsh\fP(1) shell language.
+.ksh)
+.sh(
+\fBsh\fP is a reimplementation of the Bourne shell, a command
+interpreter for both interactive and script use.
+.sh)
+.\"{{{  Shell Startup
+.SS "Shell Startup"
+The following options can be specified only on the command line:
+.IP "\fB\-c\fP \fIcommand-string\fP"
+the shell executes the command(s) contained in \fIcommand-string\fP
+.IP \fB\-i\fP
+interactive mode \(em see below
+.IP \fB\-l\fP
+login shell \(em see below
+interactive mode \(em see below
+.IP \fB\-s\fP
+the shell reads commands from standard input; all non-option arguments
+are positional parameters
+.IP \fB\-r\fP
+restricted mode \(em see below
+.PP
+In addition to the above, the options described in the \fBset\fP built-in
+command can also be used on the command line.
+.PP
+If neither the \fB\-c\fP nor the \fB\-s\fP 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.\fP, the contents of the \fB$0\fP) parameter
+is determined as follows: if the \fB\-c\fP 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.\fP, argv[0]) is used.
+.PP
+A shell is \fBinteractive\fP if the \fB\-i\fP 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\fP and \fBPS2\fP parameters).
+For non-interactive shells, the \fBtrackall\fP option is on by default
+(see \fBset\fP command below).
+.PP
+A shell is \fBrestricted\fP if the \fB\-r\fP option is used or if either
+the basename of the name the shell is invoked with or the \fBSHELL\fP
+parameter match the pattern *r*sh (\fIe.g.\fP, rsh, rksh, rpdksh, \fIetc.\fP).
+The following restrictions come into effect after the shell processes
+any profile and \fB$ENV\fP files:
+.nr P2 \n(PD
+.nr PD 0
+.IP \ \ \(bu
+the \fBcd\fP command is disabled
+.IP \ \ \(bu
+the \fBSHELL\fP, \fBENV\fP and \fBPATH\fP parameters can't be changed
+.IP \ \ \(bu
+command names can't be specified with absolute or relative paths
+.IP \ \ \(bu
+the \fB\-p\fP option of the \fBcommand\fP built-in can't be used
+.IP \ \ \(bu
+redirections that create files can't be used (\fIi.e.\fP, \fB>\fP,
+\fB>|\fP, \fB>>\fP, \fB<>\fP)
+.nr PD \n(P2
+.PP
+A shell is \fBprivileged\fP if the \fB\-p\fP option is used or if
+the real user-id or group-id does not match the effective user-id
+or group-id (see \fIgetuid\fP(2), \fIgetgid\fP(2)).
+A privileged shell does not process $HOME/.profile nor the \fBENV\fP
+parameter (see below), 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.\fP, argv[0])
+starts with \fB\-\fP or if the \fB\-l\fP option is used, the shell is assumed
+to be a login shell and the shell reads and executes the contents of
+\fB/etc/profile\fP and \fB$HOME/.profile\fP if they exist and are readable.
+.PP
+If the \fBENV\fP parameter is set when the shell starts (or, in the
+case of login shells, after any profiles are processed), its value
+is subjected to parameter, command, arithmetic and tilde substitution and
+the resulting file (if any) is read and executed.
+If \fBENV\fP parameter is not set (and not null) and pdksh was compiled
+with the \fBDEFAULT_ENV\fP macro defined, the file named in that macro
+is included (after the above mentioned substitutions have been performed).
+.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.
+.\"}}}
+.\"{{{  Command Syntax
+.SS "Command Syntax"
+.\"{{{  words and tokens
+The shell begins parsing its input by breaking it into \fIword\fPs.
+Words, which are sequences of characters, are delimited by unquoted
+\fIwhite-space\fP characters (space, tab and newline) or \fImeta-characters\fP
+(\fB<\fP, \fB>\fP, \fB|\fP, \fB;\fP, \fB&\fP, \fB(\fP and \fB)\fP).
+Aside from delimiting words, spaces and tabs are ignored, while
+newlines usually delimit commands.
+The meta-characters are used in building the following tokens:
+\fB<\fP, \fB<&\fP, \fB<<\fP, \fB>\fP, \fB>&\fP, \fB>>\fP, \fIetc.\fP are
+used to specify redirections (see Input/Output Redirection below);
+\fB|\fP is used to create pipelines;
+.ksh(
+\fB|&\fP is used to create co-processes (see Co-Processes below);
+.ksh)
+\fB;\fP is used to separate commands;
+\fB&\fP is used to create asynchronous pipelines;
+\fB&&\fP and \fB||\fP are used to specify conditional execution;
+\fB;;\fP is used in \fBcase\fP statements;
+.ksh(
+\fB((\fP .. \fB))\fP are used in arithmetic expressions;
+.ksh)
+and lastly,
+\fB(\fP .. \fB)\fP are used to create subshells.
+.PP
+White-space and meta-characters can be quoted individually using
+backslash (\fB\e\fP), or in groups using double (\fB"\fP) or single (\fB'\fP)
+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\fP, \fB"\fP, \fB'\fP, \fB#\fP, \fB$\fP, \fB`\fP, \fB~\fP, \fB{\fP,
+\fB}\fP, \fB*\fP, \fB?\fP and \fB[\fP.
+The first three of these are the above mentioned quoting characters
+(see Quoting below);
+\fB#\fP, if used at the beginning of a word, introduces a comment \(em everything
+after the \fB#\fP up to the nearest newline is ignored;
+\fB$\fP is used to introduce parameter, command and arithmetic substitutions
+(see Substitution below);
+\fB`\fP introduces an old-style command substitution
+(see Substitution below);
+\fB~\fP begins a directory expansion (see Tilde Expansion below);
+\fB{\fP and \fB}\fP delimit \fIcsh\fP(1) style alternations
+(see Brace Expansion below);
+and, finally, \fB*\fP, \fB?\fP and \fB[\fP are used in file name generation
+(see File Name Patterns below).
+.\"}}}
+.\"{{{  simple-command
+.PP
+As words and tokens are parsed, the shell builds commands, of which
+there are two basic types: \fIsimple-commands\fP, typically programs
+that are executed, and \fIcompound-commands\fP, such as \fBfor\fP and
+\fBif\fP 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\fP, \fIi.e.\fP, a separate executable file that is located using the
+\fBPATH\fP parameter (see Command Execution below).
+Note that all command constructs have an \fIexit status\fP: for external
+commands, this is related to the status returned by \fIwait\fP(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.\fP) 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.
+.\"}}}
+.\"{{{  pipeline
+.PP
+Commands can be chained together using the \fB|\fP token to
+form \fIpipelines\fP, in which the standard output of each command but
+the last is piped (see \fIpipe\fP(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!\fP 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.
+.\"}}}
+.\"{{{  lists
+.PP
+\fILists\fP of commands can be created by separating pipelines by
+any of the following tokens: \fB&&\fP, \fB||\fP, \fB&\fP, \fB|&\fP and \fB;\fP.
+The first two are for conditional execution: \fIcmd1\fP \fB&&\fP \fIcmd2\fP
+executes \fIcmd2\fP only if the exit status of \fIcmd1\fP is zero;
+\fB||\fP is the opposite \(em \fIcmd2\fP is executed only if the exit status
+of \fIcmd1\fP is non-zero.
+\fB&&\fP and \fB||\fP have equal precedence which is higher than that of
+\fB&\fP, \fB|&\fP and \fB;\fP, which also have equal precedence.
+The \fB&\fP 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.\fP, 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).
+.ksh(
+The \fB|&\fP operator starts a \fIco-process\fP which is special kind of
+asynchronous process (see Co-Processes below).
+.ksh)
+Note that a command must follow the \fB&&\fP and \fB||\fP operators, while
+a command need not follow \fB&\fP, \fB|&\fP and \fB;\fP.
+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.
+.\"}}}
+.\"{{{  compound-commands
+.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.\fP, they can't be preceded by parameter
+assignments or redirections):
+.TS
+center;
+lfB lfB lfB lfB lfB .
+case   else    function        then    !
+do     esac    if      time    [[
+done   fi      in      until   {
+elif   for     select  while   }
+.TE
+\fBNote:\fP 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\fP 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\fP) that are followed by reserved words must end with a
+semi-colon, a newline or a (syntactically correct) reserved word.
+For example,
+.RS
+\fB{ echo foo; echo bar; }\fP
+.br
+\fB{ echo foo; echo bar<newline>}\fP
+.br
+\fB{ { echo foo; echo bar; } }\fP
+.RE
+are all valid, but
+.RS
+\fB{ echo foo; echo bar }\fP
+.RE
+is not.
+.\"{{{  ( list )
+.IP "\fB(\fP \fIlist\fP \fB)\fP"
+Execute \fIlist\fP in a subshell.  There is no implicit way to pass
+environment changes from a subshell back to its parent.



Home | Main Index | Thread Index | Old Index