Edwin Beasant
2012-04-23 ff6ec3349816d4f766e144fbe70e1712db859746
7106955 move ksh93 from ON to userland
55 files added
1 files modified
27447 ■■■■■ changed files
components/ksh93/Makefile 119 ●●●●● patch | view | raw | blame | history
components/ksh93/developer-astdev.p5m 60 ●●●●● patch | view | raw | blame | history
components/ksh93/files/alias.1 394 ●●●●● patch | view | raw | blame | history
components/ksh93/files/alias.1.ja_JP.UTF-8 396 ●●●●● patch | view | raw | blame | history
components/ksh93/files/dirs.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/dirs.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/jsh.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/jsh.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/ksh.1 6235 ●●●●● patch | view | raw | blame | history
components/ksh93/files/ksh.1.ja_JP.UTF-8 6235 ●●●●● patch | view | raw | blame | history
components/ksh93/files/ksh.1.zh_CN.UTF-8 6235 ●●●●● patch | view | raw | blame | history
components/ksh93/files/ksh93.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/ksh93.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/ksh93.1.zh_CN.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/msgcc.1 234 ●●●●● patch | view | raw | blame | history
components/ksh93/files/msgcpp.1 873 ●●●●● patch | view | raw | blame | history
components/ksh93/files/msgcvt.1 133 ●●●●● patch | view | raw | blame | history
components/ksh93/files/msggen.1 373 ●●●●● patch | view | raw | blame | history
components/ksh93/files/msgget.1 142 ●●●●● patch | view | raw | blame | history
components/ksh93/files/popd.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/popd.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/pushd.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/pushd.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/rksh.1 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/rksh.1.ja_JP.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/rksh.1.zh_CN.UTF-8 1 ●●●● patch | view | raw | blame | history
components/ksh93/files/sh.1 1732 ●●●●● patch | view | raw | blame | history
components/ksh93/files/sh.1.ja_JP.UTF-8 1732 ●●●●● patch | view | raw | blame | history
components/ksh93/files/shcomp.1 160 ●●●●● patch | view | raw | blame | history
components/ksh93/files/shcomp.1.ja_JP.UTF-8 160 ●●●●● patch | view | raw | blame | history
components/ksh93/files/shcomp.1.zh_CN.UTF-8 160 ●●●●● patch | view | raw | blame | history
components/ksh93/ksh.kshrc 62 ●●●●● patch | view | raw | blame | history
components/ksh93/ksh93.license 215 ●●●●● patch | view | raw | blame | history
components/ksh93/ksh93.p5m 110 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR6919590.patch 24 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR6964621.patch 553 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7025778.patch 44 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7026179.patch 49 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7032821.patch 11 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7036535.patch 68 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7057565.patch 12 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7065478.patch 46 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7065900.patch 11 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7071431.patch 11 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7105086.patch 46 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CR7110983.patch 24 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/CRXXX_Error_Catalog.patch 11 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/build_cflags.patch 36 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/disable_dll.patch 16 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/multi_lang_arith.patch 12 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/package-pax-suid.patch 78 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/path_utmp.patch 24 ●●●●● patch | view | raw | blame | history
components/ksh93/patches/solaris_alias.patch 363 ●●●●● patch | view | raw | blame | history
components/ksh93/source-demo-ksh.p5m 58 ●●●●● patch | view | raw | blame | history
make-rules/attpackagemake.mk 95 ●●●●● patch | view | raw | blame | history
make-rules/prep.mk 81 ●●●● patch | view | raw | blame | history
components/ksh93/Makefile
New file
@@ -0,0 +1,119 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
include ../../make-rules/shared-macros.mk
COMPONENT_PROJECT_URL= http://www2.research.att.com/sw/download/
# These are required if retrieving packages from the AT&T website.
ATT_USERNAME= "I accept www.opensource.org/licenses/cpl"
ATT_PASSWD= "."
# This flag controls the prep.mk behaviour to patch each archive individually
PATCH_EACH_ARCHIVE = 1
COMPONENT_NAME = INIT
COMPONENT_VERSION = 2011-02-08
COMPONENT_SRC = $(COMPONENT_NAME).$(COMPONENT_VERSION)
COMPONENT_ARCHIVE =    $(COMPONENT_NAME).$(COMPONENT_VERSION).tgz
COMPONENT_ARCHIVE_HASH = sha1:69f909e437376c1ebcf0b1298794ccfc93504faf
COMPONENT_ARCHIVE_URL = http://www2.research.att.com/~gsf/download/tgz/$(COMPONENT_ARCHIVE)
COMPONENT_PATCHES =
# Patch only required if building ksh93 only and not ast-base
# package-pax-suid.patch
# The ksh93 tarballs don't unpack cleanly into their own directories.
UNPACK_ARGS= -r $(COMPONENT_SRC)
NUM_EXTRA_ARCHIVES= 1
COMPONENT_NAME_1= ast-base
COMPONENT_VERSION_1= 2011-02-08
COMPONENT_SRC_1= $(COMPONENT_NAME_1).$(COMPONENT_VERSION_1)
COMPONENT_ARCHIVE_1= $(COMPONENT_NAME_1).$(COMPONENT_VERSION_1).tgz
COMPONENT_ARCHIVE_HASH_1= sha1:1c9af1389a54d5c94e63f26aad9578f584ab573b
COMPONENT_ARCHIVE_URL_1= http://www2.research.att.com/~gsf/download/tgz/$(COMPONENT_ARCHIVE_1)
COMPONENT_PATCHES_1= solaris_alias.patch build_cflags.patch path_utmp.patch \
                     CR6919590.patch CR7032821.patch CR7071431.patch \
                     CR6964621.patch CR7036535.patch \
                     CRXXX_Error_Catalog.patch CR7025778.patch \
                     CR7065478.patch CR7026179.patch \
                     CR7065900.patch CR7110983.patch \
                     CR7105086.patch disable_dll.patch \
                     CR7057565.patch
# Make the unpack of the second archive relocate to a sensible place
UNPACK_ARGS_1= -r $(COMPONENT_SRC_1)
# We override LD_B_DIRECT because -B direct has unfortunate consequences for the
# interposition used by the Safe/Fast IO library (i.e. it becomes neither safe
# nor fast, and causes the build to deadly embrace).
LD_B_DIRECT=
# Disable nmake's probing of runpaths
CC.RUNPATH=
CC.LD.RUNPATH=
CC.LD.ORIGIN=
CC.DLL.ORIGIN=
# Prevent nmake from taking over the entire machine
NPROCS=1
# Set the built to build all targets, install all of ast-base, and test ksh93.
COMPONENT_BUILD_TARGETS +=
COMPONENT_INSTALL_PACKAGES += ast-base
COMPONENT_TEST_TARGETS += ksh93
# Unpack the ast-base tarball and copy it into the INIT tree,
# mark it as un-patched
COMPONENT_POST_UNPACK_ACTION_1= \
    $(RM) $(COMPONENT_SRC)/*patched_1; \
    $(CP) -r $(COMPONENT_SRC_1)/* $(COMPONENT_SRC)
# Add the two tarball paths to the paths to be cleaned
CLEAN_PATHS+= build $(COMPONENT_NAME_1).$(COMPONENT_VERSION_1) \
              $(COMPONENT_NAME).$(COMPONENT_VERSION)
# ksh.kshrc needs to be installed with the ksh package
COMPONENT_POST_INSTALL_ACTION= \
    @$(MKDIR) -p $(PROTO_DIR)/etc/; \
    $(CP) ksh.kshrc $(PROTO_DIR)/etc/
# Packaging information
IPS_PKG_NAME= ksh93
IPS_COMPONENT_VERSION= 20110208
# common targets
build:        $(BUILD_32_and_64)
install:    $(INSTALL_32_and_64)
test:        $(TEST_32_and_64)
BUILD_PKG_DEPENDENCIES= $(BUILD_TOOLS)
PKG_PROTO_DIRS +=   $(COMPONENT_DIR)/files
include ../../make-rules/prep.mk
include ../../make-rules/attpackagemake.mk
include ../../make-rules/ips.mk
include ../../make-rules/depend.mk
components/ksh93/developer-astdev.p5m
New file
@@ -0,0 +1,60 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
# The man pages are all at the top of a "files" directory; setting the hash to
# # point to the files therein.
<transform file path=usr/share/man/man.+/(.+)$ -> set action.hash %<\1> >
# Bypassing the mangler for these files because they are pre-Solarified.
<transform file path=usr/share/man/.+$ -> add mangler.bypass true >
set name=pkg.fmri \
    value=pkg:/developer/astdev@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.description \
    value="AT&T AST development utilities for extracting messages for localisation"
set name=pkg.summary value="AT&T AST development utilities"
set name=info.classification \
    value="org.opensolaris.category.2008:System/Software Management"
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream \
    value="AT&T Software Technology (AST) OpenSource Software Collection"
set name=info.upstream-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.arc-caseid value=PSARC/2012/002
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
dir path=usr group=sys
dir path=usr/ast group=sys
dir path=usr/ast/bin
dir path=usr/share/man/man1
file $(MACH64)/bin/msgcc path=usr/ast/bin/msgcc mode=0555
file $(MACH64)/bin/msgcpp path=usr/ast/bin/msgcpp mode=0555
file $(MACH64)/bin/msgcvt path=usr/ast/bin/msgcvt mode=0555
file $(MACH64)/bin/msggen path=usr/ast/bin/msggen mode=0555
file $(MACH64)/bin/msgget path=usr/ast/bin/msgget mode=0555
file path=usr/share/man/man1/msgcc.1
file path=usr/share/man/man1/msgcpp.1
file path=usr/share/man/man1/msgcvt.1
file path=usr/share/man/man1/msggen.1
file path=usr/share/man/man1/msgget.1
legacy pkg=SUNWastdev desc="AT&T AST development utilities" \
    name="AT&T AST development utilities"
license ksh93.license license=CPL
components/ksh93/files/alias.1
New file
@@ -0,0 +1,394 @@
'\" te
.\" Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\"  Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at  http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.  This notice shall appear on any product containing this material.
.TH alias 1 "8 Apr 2008" "SunOS 5.11" "User Commands"
.SH NAME
alias, unalias \- create or remove a pseudonym or shorthand for a command or series of commands
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/alias\fR [\fIalias-name\fR[= \fIstring\fR...]]
.fi
.LP
.nf
\fB/usr/bin/unalias\fR \fIalias-name\fR...
.fi
.LP
.nf
\fB/usr/bin/unalias\fR \fB-a\fR
.fi
.SS "\fBcsh\fR"
.LP
.nf
\fBalias\fR [\fIname\fR [\fIdef\fR]]
.fi
.LP
.nf
\fBunalias\fR \fIpattern\fR
.fi
.SS "\fBksh88\fR"
.LP
.nf
\fBalias\fR [\fB-tx\fR] [\fIname\fR[= \fIvalue\fR]...]
.fi
.LP
.nf
\fBunalias\fR \fIname\fR...
.fi
.LP
.nf
\fBunalias\fR [\fB-a\fR]
.fi
.SS "\fBksh\fR"
.LP
.nf
\fBalias\fR [\fB-ptx\fR] [\fIname\fR[= \fIvalue\fR]...]
.fi
.LP
.nf
\fBunalias\fR [\fB-a\fR] [\fIname\fR...]
.fi
.SH DESCRIPTION
.sp
.LP
The \fBalias\fR and \fBunalias\fR utilities create or remove a pseudonym or shorthand term for a command or series of commands, with different functionality in the C-shell and Korn shell environments.
.SS "\fB/usr/bin/alias\fR"
.sp
.LP
The \fBalias\fR utility creates or redefines alias definitions or writes the values of existing alias definitions to standard output. An alias definition provides a string value that replaces a command name when it is encountered.
.sp
.LP
An alias definition affects the current shell execution environment and the execution environments of the subshells of the current shell. When used as specified by this document, the alias definition does not affect the parent process of the current shell nor any utility environment invoked by the shell.
.SS "\fB/usr/bin/unalias\fR"
.sp
.LP
The \fBunalias\fR utility removes the definition for each alias name specified. The aliases are removed from the current shell execution environment. The \fB-a\fR option removes all alias definitions from the current execution environment.
.SS "\fBcsh\fR"
.sp
.LP
\fBalias\fR assigns \fIdef\fR to the alias \fIname\fR. The assigned \fIdef\fR is a list of words that can contain escaped history-substitution metasyntax. \fIname\fR is not allowed to be \fBalias\fR or \fBunalias\fR. If \fIdef\fR is omitted, the alias \fIname\fR is displayed along with its current definition. If both \fIname\fR and \fIdef\fR are omitted, all aliases are displayed.
.sp
.LP
Because of implementation restrictions, an alias definition must have been entered on a previous command line before it can be used.
.sp
.LP
\fBunalias\fR discards aliases that match (filename substitution) \fIpattern\fR. All aliases can be removed by `\fBunalias *\fR'.
.SS "\fBksh88\fR"
.sp
.LP
\fBalias\fR with no arguments prints the list of aliases in the form \fIname=value\fR on standard output. An \fBalias\fR is defined for each name whose \fIvalue\fR is specified. A trailing space in \fIvalue\fR causes the next word to be checked for alias substitution. The \fB-t\fR flag is used to set and list tracked aliases. The value of a tracked alias is the full pathname corresponding to the specified \fIname\fR. The value becomes undefined when the value of \fBPATH\fR is reset but the aliases remained tracked. Without the \fB-t\fR flag, for each \fIname\fR in the argument list for which no \fIvalue\fR is specified, the name and value of the alias is printed. The \fB-x\fR flag is used to set or print \fIexported alias\fRes. An exported alias is defined for scripts invoked by \fIname\fR. The exit status is non-zero if a \fIname\fR is specified, but no value, and no alias has been defined for the \fIname\fR.
.sp
.LP
The \fBalias\fRs specified by the list of \fIname\fRs can be removed from the \fBalias\fR list with \fBunalias\fR.
.SS "\fBksh\fR"
.sp
.LP
\fBalias\fR creates or redefines alias definitions or writes the existing alias definitions to standard output.
.sp
.LP
An alias definition provides a string value that replaces a command name when the command is read. Alias names can contain any printable character that is not special to the shell. If an alias value ends in a SPACE or TAB, the word following the command name the alias replaces is also checked to see whether it is an alias.
.sp
.LP
If no names are specified, the names and values of all aliases are written to standard output. Otherwise, for each name that is specified, and \fB=\fR\fIvalue\fR is not specified, the current value of the alias corresponding to name is written to standard output. If \fB=\fR\fIvalue\fR is specified, the alias name is created or redefined.
.sp
.LP
\fBalias\fR is built-in to the shell as a declaration command so that field splitting and pathname expansion are not performed on the arguments. Tilde expansion occurs on \fIvalue\fR. An alias definition only affects scripts read by the current shell environment. It does not affect scripts run by this shell.
.sp
.LP
\fBunalias\fR removes the definition of each named alias from the current shell execution environment, or all aliases if \fB-a\fR is specified. It does not affect any commands that have already been read and subsequently executed.
.SH OPTIONS
.sp
.LP
The following option is supported by \fBunalias\fR:
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
Removes all alias definitions from the current shell execution environment.
.RE
.SS "\fBksh88\fR"
.sp
.LP
The following option is supported by \fBalias\fR:
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
Sets and lists tracked aliases.
.RE
.SS "\fBksh\fR"
.sp
.LP
The following options are supported by \fBalias\fR:
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
.rt
Causes the output to be in the form of \fBalias\fR commands that can be used as input to the shell to recreate the current aliases.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
Specifies tracked aliases.
.sp
Tracked aliases connect a command name to the command's pathname, and are reset when the \fBPATH\fR variable is unset. The tracked aliases feature is now obsolete.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
Ignored, this option is obsolete.
.RE
.sp
.LP
The following option is supported by \fBunalias\fR:
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
Causes all alias definitions to be removed. \fIname\fR operands are optional and ignored if specified.
.RE
.SH OPERANDS
.sp
.LP
The following operands are supported:
.SS "\fBalias\fR"
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR\fR
.ad
.RS 14n
.rt
Write the alias definition to standard output.
.RE
.SS "\fBunalias\fR"
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR\fR
.ad
.RS 21n
.rt
The name of an alias to be removed.
.RE
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR\fB=\fR\fIstring\fR\fR
.ad
.RS 21n
.rt
Assign the value of \fIstring\fR to the alias \fIalias-name\fR.
.RE
.sp
.LP
If no operands are specified, all alias definitions are written to standard output.
.SH OUTPUT
.sp
.LP
The format for displaying aliases (when no operands or only \fIname\fR operands are specified) is:
.sp
.in +2
.nf
"%s=%s\en" \fIname\fR, \fIvalue\fR
.fi
.in -2
.sp
.sp
.LP
The \fIvalue\fR string is written with appropriate quoting so that it is suitable for reinput to the shell.
.SH EXAMPLES
.LP
\fBExample 1 \fRModifying a Command's Output
.sp
.LP
This example specifies that the output of the \fBls\fR utility is columnated and more annotated:
.sp
.in +2
.nf
example% \fBalias ls="ls \(miCF"\fR
.fi
.in -2
.sp
.LP
\fBExample 2 \fRRepeating Previous Entries in the Command History File
.sp
.LP
This example creates a simple "redo" command to repeat previous entries in the command history file:
.sp
.in +2
.nf
example% \fBalias r='fc \(mis'\fR
.fi
.in -2
.sp
.LP
\fBExample 3 \fRSpecifying a Command's Output Options
.sp
.LP
This example provides that the \fBdu\fR utility summarize disk output in units of 1024 bytes:
.sp
.in +2
.nf
example% \fBalias du=du \(mik\fR
.fi
.in -2
.sp
.LP
\fBExample 4 \fRDealing with an Argument That is an Alias Name
.sp
.LP
This example sets up the \fBnohup\fR utility so that it can deal with an argument that is an alias name:
.sp
.in +2
.nf
example% \fBalias nohup="nohup "\fR
.fi
.in -2
.sp
.SH ENVIRONMENT VARIABLES
.sp
.LP
See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBalias\fR and \fBunalias\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 5n
.rt
Successful completion.
.RE
.SS "\fBalias\fR"
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
One of the \fIalias-name\fR operands specified did not have an alias definition, or an error occurred.
.RE
.SS "\fBunalias\fR"
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
One of the \fIalias-name\fR operands specified did not represent a valid alias definition, or an error occurred.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.SS "\fBcsh, ksh88\fR"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
Interface StabilityCommitted
_
StandardSee \fBstandards\fR(5).
.TE
.SS "\fBksh\fR"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
Interface StabilityUncommitted
.TE
.SH SEE ALSO
.sp
.LP
\fBcsh\fR(1), \fBksh\fR(1), \fBksh88\fR(1), \fBshell_builtins\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
components/ksh93/files/alias.1.ja_JP.UTF-8
New file
@@ -0,0 +1,396 @@
'\" te
.\" Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\"  Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material.
.TH alias 1 "2008 年 4 月 8 日" "SunOS 5.11" "ユーザーコマンド"
.SH 名前
alias, unalias \- コマンドまたはコマンド群の別名または省略形の生成と削除
.SH 形式
.LP
.nf
\fB/usr/bin/alias\fR [\fIalias-name\fR[= \fIstring\fR...]]
.fi
.LP
.nf
\fB/usr/bin/unalias\fR \fIalias-name\fR...
.fi
.LP
.nf
\fB/usr/bin/unalias\fR \fB-a\fR
.fi
.SS "\fBcsh\fR"
.LP
.nf
\fBalias\fR [\fIname\fR [\fIdef\fR]]
.fi
.LP
.nf
\fBunalias\fR \fIpattern\fR
.fi
.SS "\fBksh88\fR"
.LP
.nf
\fBalias\fR [\fB-tx\fR] [\fIname\fR[= \fIvalue\fR]...]
.fi
.LP
.nf
\fBunalias\fR \fIname\fR...
.fi
.LP
.nf
\fBunalias\fR [\fB-a\fR]
.fi
.SS "\fBksh\fR"
.LP
.nf
\fBalias\fR [\fB-ptx\fR] [\fIname\fR[= \fIvalue\fR]...]
.fi
.LP
.nf
\fBunalias\fR [\fB-a\fR] [\fIname\fR...]
.fi
.SH 機能説明
.sp
.LP
\fBalias\fR および \fBunalias\fR ユーティリティは、コマンドまたはコマンド群の別名あるいは省略形を作成または削除します。これらのユーティリティの動作は、C シェル環境と Korn シェル環境では異なります。
.SS "\fB/usr/bin/alias\fR"
.sp
.LP
\fBalias\fR ユーティリティは、別名定義を作成または再定義するか、あるいは既存の別名定義を標準出力に書き出します。別名定義は、コマンド名を置き換える文字列を指定するものです。
.sp
.LP
別名定義は、現在のシェルの実行環境、およびそのシェルの全サブシェルの実行環境に影響を及ぼします。このマニュアルに記述されているように用いれば、別名定義は現在のシェルの親プロセスにも、シェルが呼び出すユーティリティーの環境にも影響を及ぼしません。
.SS "\fB/usr/bin/unalias\fR"
.sp
.LP
\fBunalias\fR ユーティリティは、指定された別名の定義を削除します。それにより、現在のシェルの実行環境から別名が削除されます。\fB-a\fR オプションは、現在の実行環境からすべての別名定義を削除します。
.SS "\fBcsh\fR"
.sp
.LP
\fBalias\fR は別名 \fIname\fR に \fIdef\fR で指定した別名の定義を割り当てます。その割り当てられた \fIdef\fR はワードの並びで、エスケープされたヒストリ置換のメタシンタックスを含んでいてもかまいません。\fIname\fR に \fBalias\fR または \fBunalias\fR を使用することはできません。\fIdef\fR を省略すると、別名 \fIname\fR が現在の定義と共に表示されます。\fIname\fR と \fIdef\fR の両方を省略すると、現在あるすべての別名が表示されます。
.sp
.LP
実装状態の制限によって、別名の定義は、それが使われる前のコマンド行で入力されていなければなりません。
.sp
.LP
\fBunalias\fR は \fIpattern\fR が示すファイル名置換パターンに一致する別名を破棄します。`\fBunalias *\fR' と指定すると、すべての別名を破棄できます。
.SS "\fBksh88\fR"
.sp
.LP
引数なしの場合、このコマンドは標準出力上に \fIname=value\fR という形式の別名のリストを表示します。\fB\fR\fIvalue\fR が指定された名前に対しては別名を定義します。\fB\fR\fIvalue\fR の末尾にスペースがあると、次のワードが別名置換指定かどうかをチェックします。\fB-t\fR フラグは、検索済みの別名を設定または一覧表示します。検索済み別名の値は、指定した \fIname\fR に対応する完全パス名になります。\fBPATH\fR の値を再設定するとこの値は未定義になりますが、別名は検索済みのままです。\fB-t\fR フラグを省略すると、\fIvalue\fR が指定されていない引数リスト内の各 \fIname\fR について、別名の名前と値を表示します。\fB-x\fR フラグは、エクスポートされた別名を設定または表示します。\fI\fRエクスポートされた別名は、\fI名前\fRで起動されるスクリプト用に定義されます。\fIname\fR が指定されているが、\fIvalue\fR は指定されておらず、name に対する別名も定義されていない場合は、終了ステータスは 0 以外になります。
.sp
.LP
\fBunalias\fR を指定すると \fIname\fR が示す \fBalias\fR を \fBalias\fR リストから削除できます。
.SS "\fBksh\fR"
.sp
.LP
\fBalias\fR は、別名定義を作成または再定義したり、既存の別名定義を標準出力に書き出したりします。
.sp
.LP
別名定義は、コマンド名を置き換える文字列を指定するものです。別名には、シェルに対する特殊文字を除く、任意の出力可能な文字を含めることができます。別名の末尾がスペース (SPACE) またはタブ (TAB) の場合は、別名により置き換えられるコマンド名に続く語も別名かどうかがチェックされます。
.sp
.LP
名前が指定されていない場合は、すべての別名の名前と値が標準出力に書き込まれます。名前は指定されているが \fB=\fR\fIvalue\fR が指定されていない場合は、名前に対応する別名の現在値が名前ごとに標準出力に書き込まれます。\fB=\fR\fIvalue\fR が指定されている場合は、別名が作成または再定義されます。
.sp
.LP
\fBalias\fR は宣言コマンドとしてシェルに内蔵されているため、引数に対するフィールド分割およびパス名展開は実行されません。チルド展開は \fIvalue\fR に対して行われます。別名定義が影響を与えるのは、現在のシェル環境により読み込まれたスクリプトだけです。このシェルにより実行されるスクリプトには影響しません。
.sp
.LP
\fBunalias\fR は、指定された各別名の定義を現在のシェル実行環境から削除します。\fB-a\fR が指定されている場合は、すべての別名を削除します。すでに読み込まれ、実行されているコマンドには影響を与えません。
.SH オプション
.sp
.LP
\fBunalias\fR では、次のオプションがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fB-a\fR \fR
.ad
.RS 7n
.rt
現在のシェルの実行環境から、すべての別名定義を削除します。
.RE
.SS "\fBksh88\fR"
.sp
.LP
\fBalias\fR では次のオプションがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fB-t\fR \fR
.ad
.RS 7n
.rt
検索済みの別名を設定または一覧表示します。
.RE
.SS "\fBksh\fR"
.sp
.LP
\fBalias\fR では次のオプションがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
.rt
出力をシェルへの入力に使用可能な \fBalias\fR コマンドの形式にして、現在の別名を再作成できるようにします。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
検索済みの別名を指定します。
.sp
検索済みの別名は、コマンド名をコマンドのパス名に関連付けます。これらは、\fBPATH\fR 変数の設定解除時にリセットされます。検索済み別名の機能は、廃止または互換性がなくなる可能性があります。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
無視されます。このオプションは廃止されています。
.RE
.sp
.LP
\fBunalias\fR では次のオプションがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
すべての別名定義を削除します。\fIname\fR オペランドは省略可能であり、指定されている場合は無視されます。
.RE
.SH オペランド
.sp
.LP
次のオペランドがサポートされています。
.SS "\fBalias\fR"
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR \fR
.ad
.RS 15n
.rt
別名定義を標準出力に書き出します。
.RE
.SS "\fBunalias\fR"
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR \fR
.ad
.RS 21n
.rt
削除する別名を指定します。
.RE
.sp
.ne 2
.mk
.na
\fB\fIalias-name\fR\fB=\fR\fIstring\fR\fR
.ad
.RS 21n
.rt
\fIalias-name\fR で示す別名に、\fIstring\fR で示す文字列を割り当てます。
.RE
.sp
.LP
オペランドを 1 つも指定しないと、すべての別名定義が標準出力に書き込まれます。
.SH 出力
.sp
.LP
オペランドがすべて省略された場合、または \fIname\fR オペランドだけが指定された場合の、別名の表示形式は次のとおりです。
.sp
.in +2
.nf
"%s=%s\en" \fIname\fR, \fIvalue\fR
.fi
.in -2
.sp
.sp
.LP
文字列 \fIvalue\fR は、シェルへ再入力できるよう、適切な引用符を付加して出力されます。
.SH 使用例
.LP
\fB例 1 \fRコマンドの出力を変更する
.sp
.LP
\fBls\fR ユーティリティの出力を複数カラム形式の注釈付きに変更します。
.sp
.in +2
.nf
example% \fBalias ls="ls \(miCF"\fR
.fi
.in -2
.sp
.LP
\fB例 2 \fRコマンド履歴ファイルにある直前のエントリを繰り返す
.sp
.LP
次の例は、コマンドの履歴ファイルにある直前の入力を繰り返す単純な "redo" コマンドを生成します。
.sp
.in +2
.nf
example% \fBalias r='fc \(mis'\fR
.fi
.in -2
.sp
.LP
\fB例 3 \fRコマンドの出力オプションを指定する
.sp
.LP
次の例は、\fBdu\fR ユーティリティがディスク出力を 1024 バイト単位にまとめるようにします。
.sp
.in +2
.nf
example% \fBalias du=du \(mik\fR
.fi
.in -2
.sp
.LP
\fB例 4 \fR別名である引数を処理する
.sp
.LP
次の例では、別名である引数を処理できるよう、\fBnohup\fR ユーティリティーを設定します。
.sp
.in +2
.nf
example% \fBalias nohup="nohup "\fR
.fi
.in -2
.sp
.SH 環境
.sp
.LP
\fBalias\fR と \fBunalias\fR の実行に影響を与える次の環境変数についての詳細は、\fBenviron\fR(5) を参照してください。\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR、および \fBNLSPATH\fR。
.SH 終了ステータス
.sp
.LP
次の終了値が返されます。
.sp
.ne 2
.mk
.na
\fB\fB0\fR \fR
.ad
.RS 6n
.rt
正常終了。
.RE
.SS "\fBalias\fR"
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
\fIalias-name\fR オペランドで指定した名前の 1 つが別名定義を持っていなかったか、もしくはエラーが発生しました。
.RE
.SS "\fBunalias\fR"
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
\fIalias-name\fR オペランドで指定した名前の 1 つが正しい別名定義を表していなかったか、もしくはエラーが発生しました。
.RE
.SH 属性
.sp
.LP
属性についての詳細は、\fBattributes\fR(5) を参照してください。
.SS "\fBcsh, ksh88\fR"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性タイプ属性値
_
使用条件system/core-os
_
インタフェースの安定性確実
_
標準T{
\fBstandards\fR(5) を参照してください。
T}
.TE
.SS "\fBksh\fR"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性タイプ属性値
_
使用条件system/core-os
_
インタフェースの安定性不確実
.TE
.SH 関連項目
.sp
.LP
\fBcsh\fR(1), \fBksh\fR(1), \fBksh88\fR(1), \fBshell_builtins\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
components/ksh93/files/dirs.1
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/dirs.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/jsh.1
New file
@@ -0,0 +1 @@
.so man1/sh.1
components/ksh93/files/jsh.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/sh.1
components/ksh93/files/ksh.1
New file
Diff too large
components/ksh93/files/ksh.1.ja_JP.UTF-8
New file
Diff too large
components/ksh93/files/ksh.1.zh_CN.UTF-8
New file
Diff too large
components/ksh93/files/ksh93.1
New file
@@ -0,0 +1 @@
.so man1/ksh.1
components/ksh93/files/ksh93.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/ksh.1
components/ksh93/files/ksh93.1.zh_CN.UTF-8
New file
@@ -0,0 +1 @@
.so man1/ksh.1
components/ksh93/files/msgcc.1
New file
@@ -0,0 +1,234 @@
'\" te
.\" Copyright (c) 2000-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc.
.TH msgcc 1 "9 Oct 2007" "SunOS 5.11" "User Commands"
.SH NAME
msgcc \- C language message catalog compiler
.SH SYNOPSIS
.LP
.nf
\fBmsgcc\fR [\fB-M-\fR\fIoption\fR] [\fBcc-options\fR\fIoption\fR] \fIfile...\fR
.fi
.SH DESCRIPTION
.sp
.LP
\fBmsgcc\fR is a C language message catalog compiler. It accepts \fBcc\fR style options and arguments.
.sp
.LP
A \fBmsgcpp\fR(1) \fB\&.mso\fR file is generated for each input \fB\&.c\fR file. If the \fB-c\fR option is not specified then a \fBgencat\fR(1) format .\fBmsg\fR file is generated from the input \fB\&.mso\fR and \fB\&.msg\fR files. If \fB-c\fR is not specified then a \fB\&.msg\fR suffix is appended to the \fB-o\fR file if it doesn't already have a suffix. The default output is \fBa.out.msg\fR if \fB-c\fR and \fB-o\fR are not specified.
.sp
.LP
If \fB-M-new\fR is not specified then messages are merged with those in the pre-existing \fB-o\fR file.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fIcc-options\fR\fR
.ad
.RS 14n
.rt
Specify \fBcc\fR style options and arguments.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-M-\fR\fIoption\fR\fR
.ad
.RS 14n
.rt
Set a \fBmsgcc\fR option.
.sp
Specify option as one of the following:
.sp
.ne 2
.mk
.na
\fB\fBmkmsgs\fR\fR
.ad
.RS 18n
.rt
The \fB-o\fR file is assumed to be in \fBmkmsgs\fR(1) format.
.RE
.sp
.ne 2
.mk
.na
\fB\fBnew\fR\fR
.ad
.RS 18n
.rt
Create a new \fB-o\fR file.
.RE
.sp
.ne 2
.mk
.na
\fB\fBpreserve\fR\fR
.ad
.RS 18n
.rt
Messages in the \fB-o\fR file that are not in new \fB\&.msg\fR file arguments are preserved. The default is to either reuse the message numbers with new message text that is similar to the old or to delete the message text, leaving an unused message number.
.RE
.sp
.ne 2
.mk
.na
\fB\fBset=\fR\fInumber\fR\fR
.ad
.RS 18n
.rt
Set the message set number to \fInumber\fR. The default is \fB1\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBsimilar=\fR\fInumber\fR\fR
.ad
.RS 18n
.rt
The message text similarity message threshold. The similarity measure between old and new message text is:
.sp
.in +2
.nf
100*(2*gzip(\fIold\fR+\fInew\fR)\e
     /(gzip(\fIold\fR)+gzip(\fInew\fR))-1)
.fi
.in -2
.sp
where \fBgzip(\fR\fIx\fR\fB)\fR is the size of text \fIx\fR when compressed by \fBgzip\fR. The default threshold is \fB$__similar__$.A\fR threshold of \fB0\fR turns off message replacement, but unused old messages are still deleted. Use \fB-M-preserve\fR to preserve all old messages.
.RE
.sp
.ne 2
.mk
.na
\fB\fBverbose\fR\fR
.ad
.RS 18n
.rt
Trace similar message replacements on the standard error.
.RE
.RE
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.mk
.na
\fB\fIfile\fR\fR
.ad
.RS 8n
.rt
Specifies the name of the file on which \fBmsgcc\fR operates.
.RE
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
An error occurred.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBmsgcc\fR
.sp
.LP
The following example uses \fBmsgcc\fR to extract localizable strings from the file \fBhello.c\fR, marked using \fBERROR_dictionary()\fR, writes them to the file \fBhello.mso\fR, and creates a \fBgencat\fR format \fBxxx.msg\fR file:
.sp
.in +2
.nf
example% cat hello.c
#include <stdio.h>
#include <stdlib.h>
/*
 * dummy macro to avoid including
 * libast headers
 */
#define ERROR_dictionary(x) x
int main(int ac, char *av[])
{
        puts( ERROR_dictionary("hello world") );
        return( EXIT_SUCCESS );
}
example% msgcc -o xxx -D__STDC__ -D__i386 hello.c
example% cat hello.mso
str "hello world"
example% cat xxx.msg
$ xxx message catalog
$translation msgcc 2007-09-25
$set 1
$quote "
1 "hello world"
.fi
.in -2
.sp
.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitydeveloper/astdev
_
Interface StabilityVolatile
.TE
.SH SEE ALSO
.sp
.LP
\fBcpp\fR(1), \fBgencat\fR(1), \fBmkmsgs\fR(1), \fBmsggen\fR(1), \fBmsgcpp\fR(1), \fBmsgcvt\fR(1), \fBattributes\fR(5)
components/ksh93/files/msgcpp.1
New file
@@ -0,0 +1,873 @@
'\" te
.\" Copyright (c) 1986-2006 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc.
.TH msgcpp 1 "9 Oct 2007" "SunOS 5.11" "User Commands"
.SH NAME
msgcpp \- C language message catalog preprocessor
.SH SYNOPSIS
.LP
.nf
\fBmsgcpp\fR [\fB-ACEHMPVX\fR] [\fB-D\fR \fIname\fR[\fB=\fR\fIvalue\fR]] [\fB-I\fR \fIdirectory\fR] [\fB-U\fR \fIname\fR]
 [\fB-T\fR[\fIlength\fR]] [\fB-Y\fR \fIdirectory\fR] [\fIinput\fR [\fIoutput\fR] ]
.fi
.SH DESCRIPTION
.sp
.LP
\fBmsgcpp\fR is a C language message catalog preprocessor. It accepts \fBcpp\fR(1) style options and arguments. \fBmsgcpp\fR preprocesses an input C source file and emits keyed lines to the output, usually for further processing by\fBmsgcc\fR(1). \fBmsgcc\fR output is in the \fBgencat\fR(1) syntax. Candidate message text is determined by arguments to the last \fB<error.h>\fR and \fB<option.h>\fR functions. The \fBmsgcpp\fR keyed output lines are:
.sp
.ne 2
.mk
.na
\fB\fBcmd\fR \fIcommand\fR\fR
.ad
.RS 19n
.rt
\fIcommand\fR is a candidate for \fB--??keys\fR option string generation. This is triggered by \fBb_command(int argc\fR, in the input.
.RE
.sp
.ne 2
.mk
.na
\fB\fBdef\fR \fIname string\fR\fR
.ad
.RS 19n
.rt
\fIname\fR is a candidate variable with \fIstring\fR value string.
.RE
.sp
.ne 2
.mk
.na
\fB\fBstr\fR \fIstring\fR\fR
.ad
.RS 19n
.rt
\fIstring\fR should be entered into the catalog.
.RE
.sp
.ne 2
.mk
.na
\fB\fBvar\fR \fIname\fR\fR
.ad
.RS 19n
.rt
If \fBdef\fR \fIname\fR occurs then its string value should be entered into the catalog.
.RE
.sp
.LP
The input source file is preprocessed with the \fBpp:allpossible\fR option on. This enables non-C semantics. All source should first be compiled error-free with a real compiler before running \fBmsgcpp\fR. The following changes are enabled for the top level files. Included file behavior is not affected.
.RS +4
.TP
1.
All \fB#if\fR, \fB#ifdef\fR and \fB#ifndef\fR branches are enabled.
.RE
.RS +4
.TP
2.
The first definition for a macro is retained, even when subsequent \fB#define\fR statements would normally redefine the macro. \fB#undef\fR must be used to redefine a macro.
.RE
.RS +4
.TP
3.
Macro calls with an improper number of arguments are silently ignored.
.RE
.RS +4
.TP
4.
\fB#include\fR on non-existent headers are silently ignored.
.RE
.RS +4
.TP
5.
Invalid C source characters are silently ignored.
.RE
.sp
.LP
\fBmsgcat.h\fR is included if it exists. This file may contain macro definitions for functions that translate string arguments. If \fBfoo\fR is a function that translates its string arguments then include the line \fB#define foo _TRANSLATE_\fR in \fBmsgcat.h\fR, or specify the option \fB-Dfoo=_TRANSLATE_\fR. If \fBbar\fR is a function that translates string arguments if the first argument is \fBstderr\fR, then use either \fB#define bar _STDIO_\fR or \fB-Dbar=_STDIO_\fR.
.sp
.LP
The macro \fB_BLD_msgcat\fR is defined to be \fB1\fR. As an alternative to \fBmsgcat.h\fR, \fB_TRANSLATE_\fR definitions could be placed inside \fB#ifdef _BLD_msgcat ... #endif\fR.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-A\fR\fR
.ad
.br
.na
\fB\fB--assert=\fR\fIassertion\fR\fR
.ad
.RS 25n
.rt
Enter the assertion using \fB#assert\fR for system V compatibility.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-C\fR\fR
.ad
.br
.na
\fB\fB--comments\fR\fR
.ad
.RS 25n
.rt
Pass comments to the output.
.sp
Comments are omitted by default.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D\fR\fR
.ad
.br
.na
\fB\fB--define=\fR\fIname\fR\fB[=\fR\fIvalue\fR\fB]\fR\fR
.ad
.RS 25n
.rt
Define the macro \fIname\fR to have \fIvalue\fR. This is the only portable way to pass options through \fBcc\fR to \fBcpp\fR(1).
.RS +4
.TP
.ie t \(bu
.el o
If \fB=\fR\fIvalue\fR is omitted, \fIvalue\fR is assumed to be \fB1\fR .
.RE
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR begins with \fB:\fR, then it is interpreted as a \fBlibpp\fR \fB#pragma pp\fR: statement.
.RE
.RS +4
.TP
.ie t \(bu
.el o
If \fIname\fR begins with \fB%\fR, it is interpreted as a \fBlibpp\fR \fB#\fR directive statement.
.RE
.RS +4
.TP
.ie t \(bu
.el o
If name begins with a \fB-\fR or a \fB+\fR, it is interpreted as a \fBlibpp\fR option.
.sp
\fB-\fR turns the option on, \fB+\fR turns it off.
.RE
.RS +4
.TP
.ie t \(bu
.el o
Most options have a \fB#pragma\fR counterpart that is listed with the option definition.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-C\fR\fR
.ad
.br
.na
\fB\fBpp:compatibility\fR\fR
.ad
.sp .6
.RS 4n
Preprocess for K&R C compatibility.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-D\fR\fIlevel\fR\fR
.ad
.br
.na
\fB\fBpp:debug level\fR \fIlevel\fR\fR
.ad
.sp .6
.RS 4n
Set the debug trace level.
.sp
Specify \fIlevel\fR as a number greater than or equal to \fB0\fR. Higher levels produce more output. Levels higher than \fB3\fR can only be enabled in the \fB-g\fR compiled versions.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-F\fR\fIname\fR\fR
.ad
.sp .6
.RS 4n
Set the main input file name to \fIname\fR. This only affects the error messages and the line sync output.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-H\fR\fR
.ad
.br
.na
\fB\fBpp:hosted\fR\fR
.ad
.sp .6
.RS 4n
All directories are hosted. Compatibility warning messages from the hosted directory headers are suppressed.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-I\fR\fR
.ad
.br
.na
\fB\fBpp:cdir\fR\fR
.ad
.sp .6
.RS 4n
All directories contain C headers. This option is only used only with \fB-D-+\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-K\fR\fR
.ad
.br
.na
\fB\fBpp:keyargs\fR\fR
.ad
.sp .6
.RS 4n
Enable the non-standard \fIname\fR\fB=\fR\fIvalue\fR macro argument mode.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-L\fR\fB[\fR\fIid\fR\fB]\fR\fR
.ad
.br
.na
\fB\fBpp:lineid [\fR\fIid\fR]\fR
.ad
.sp .6
.RS 4n
Set the line sync directive id to \fIid\fR. If \fIid\fR is not specified, set to null.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-M\fR\fR
.ad
.br
.na
\fB\fBpp:nomultiple\fR\fR
.ad
.sp .6
.RS 4n
Disable multiple include detection.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-P\fR\fR
.ad
.br
.na
\fB\fBpp:passthrough\fR\fR
.ad
.sp .6
.RS 4n
Enable the non-standard passthrough mode. This can be useful for processing non-C input.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-Q\fR\fR
.ad
.br
.na
\fB\fBpp:dump\fR\fR
.ad
.sp .6
.RS 4n
Dump macro definitions to the output so that the output may be passed through \fBcpp\fR again. This is used for generating precompiled headers.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-R\fR\fR
.ad
.br
.na
\fB\fBpp:transition\fR\fR
.ad
.sp .6
.RS 4n
Enable the transition preprocessing mode. This is used for compilers that cannot make up their semantics between K&R and ISO C.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-S\fR\fR
.ad
.br
.na
\fB\fBpp:strict\fR\fR
.ad
.sp .6
.RS 4n
Enable strict preprocessing semantics and warnings. This works with any mode (compatibility, transition, or the default ISO).
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-T\fR\fItest\fR\fR
.ad
.br
.na
\fB\fBpp:test\fR \fItest\fR\fR
.ad
.sp .6
.RS 4n
Enable implementation specific test code according to \fItest\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-W\fR\fR
.ad
.br
.na
\fB\fBpp:warn\fR\fR
.ad
.sp .6
.RS 4n
Enable pedantic warnings in non-hosted files.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-X\fR\fB[cc]\fR\fR
.ad
.br
.na
\fB\fB\fR\fR
.ad
.sp .6
.RS 4n
Preprocess for the \fBcc\fR compiler, which must be an executable path or an executable on \fB$PATH\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-Z\fR\fR
.ad
.br
.na
\fB\fBpp:pool\fR\fR
.ad
.sp .6
.RS 4n
Enable pool mode.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-d\fR\fR
.ad
.sp .6
.RS 4n
List canonicalized \fB#define\fR statements for non-predefined macros in the output.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-m\fR\fR
.ad
.sp .6
.RS 4n
List canonicalized \fB#define\fR statements for all macros. All other output is disabled.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-D-+\fR\fR
.ad
.br
.na
\fB\fBpp:plusplus\fR\fR
.ad
.sp .6
.RS 4n
Preprocess for the C++ dialect.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fB-E\fR\fR
.ad
.br
.na
\fB\fB--preprocess\fR\fR
.ad
.RS 25n
.rt
Ignored; for compatibility with very old compilers.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-H\fR\fR
.ad
.br
.na
\fB\fB--include-reference\fR\fR
.ad
.RS 25n
.rt
Emit \fB#include\fR file paths on the standard error, one per line, indented to show nesting.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I\fR\fR
.ad
.br
.na
\fB\fB--include[=\fR\fIdirectory\fR\fB]\fR\fR
.ad
.RS 25n
.rt
Append directory to the list of directories searched for \fB#include\fR files.
.sp
If directory is \fB-\fR:
.RS +4
.TP
1.
\fB-I\fR directories before \fB-I-\fR are searched only for \fB"..."\fR include files
.RE
.RS +4
.TP
2.
\fB-I\fR directories after \fB-I-\fR are searched for \fB"..."\fR and \fB<"...">\fR include files
.RE
.RS +4
.TP
3.
the directory \fB\&.\fR is searched only if it is explicitly specified by an \fB-I\fR option
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-C\fR\fIdirectory\fR\fR
.ad
.br
.na
\fB\fBpp:cdir directory\fR\fR
.ad
.sp .6
.RS 4n
Mark \fIdirectory\fR as a C header directory. This option is used with \fBpp:plusplus\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-D[\fR\fIfile\fR]\fR
.ad
.sp .6
.RS 4n
Read the default \fBprobe\fR definitions from \fIfile\fR, or ignore the default definitions if \fIfile\fR is omitted.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-H\fR\fIdirectory\fR\fR
.ad
.br
.na
\fB\fBpp:hostdir\fR \fIdirectory\fR\fR
.ad
.sp .6
.RS 4n
Mark directory as a hosted directory. Headers from hosted directories have compatibility warnings disabled.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-I\fR\fIheader\fR\fR
.ad
.br
.na
\fB\fBpp:ignore\fR \fIheader\fR\fR
.ad
.sp .6
.RS 4n
Add \fIheader\fR to the list of ignored headers.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-M\fR\fIfile\fR\fR
.ad
.sp .6
.RS 4n
\fIfile\fR contains a sequence of header \fB[= "map" ]\fR lines, where header is either \fB<name>\fR or \fB"name"\fR, and \fB"map"\fR is an explicit binding for header. header is ignored \fBif = "map"\fR is omitted.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-R\fR\fIfile\fR\fR
.ad
.sp .6
.RS 4n
Include \fIfile\fR but do not emit text or line syncs.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-S\fR\fIdirectory\fR\fR
.ad
.sp .6
.RS 4n
Add \fIdirectory\fR to the default standard include directory list.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-I-T\fR\fIfile\fR\fR
.ad
.sp .6
.RS 4n
Include \fIfile\fR and emit text to the output file. The option value can be omitted.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fB-M\fR\fR
.ad
.br
.na
\fB\fB--dependencies\fR\fR
.ad
.RS 25n
.rt
Generate \fBmake\fR(1S) dependencies. This option is not needed with \fBnmake\fR.
.sp
The \fB-M\fR option can be followed by optional flags to change the dependency output styles.
.sp
The following optional flags are supported:
.sp
.ne 2
.mk
.na
\fB\fBD\fR\fR
.ad
.RS 5n
.rt
Generate dependencies in a separate \fB\&.d\fR file. Preprocessed output is still written to output, or the standard output if output is omitted.
.RE
.sp
.ne 2
.mk
.na
\fB\fBG\fR\fR
.ad
.RS 5n
.rt
Also generate missing dependencies.
.RE
.sp
.ne 2
.mk
.na
\fB\fBM\fR\fR
.ad
.RS 5n
.rt
Only generate local header dependencies. Hosted headers are omitted. Hosted headers are determined by the \fB-I-H\fR option and the -\fB-pp:hosted\fR and \fBpp:hostdir pragmas\fR. No special distinction is made between the \fB""\fR and \fB<>\fR include styles.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fB-P\fR\fR
.ad
.br
.na
\fB\fB--sync\fR\fR
.ad
.RS 25n
.rt
Emit line syncs.
.sp
Line sync is turned on by default. \fB-P\fR means \fB--nosync\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-T\fR\fB[\fR\fIlength\fR\fB]\fR\fR
.ad
.RS 25n
.rt
If not \fBgcc\fR, truncate identifiers to \fIlength\fR characters for compatibility with old AT&T compilers.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-U\fR\fR
.ad
.br
.na
\fB\fB--undefine=\fR\fIname\fR\fR
.ad
.RS 25n
.rt
Remove the definition for the macro \fIname\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-V\fR\fR
.ad
.br
.na
\fB\fB--version\fR\fR
.ad
.RS 25n
.rt
Emit the \fBlibpp\fR version.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-X\fR\fR
.ad
.br
.na
\fB\fB--argmode\fR\fR
.ad
.RS 25n
.rt
Enable \fIname\fR\fB=\fR\fIvalue\fR macro arguments for \fBeasel\fR compatibility.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-Y\fR\fR
.ad
.br
.na
\fB\fB--standard=\fR\fIdirectory\fR\fR
.ad
.RS 25n
.rt
Add \fIdirectory\fR to the list searched for \fB#include <...>\fR files.
.RE
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.mk
.na
\fB\fIinput\fR\fR
.ad
.RS 10n
.rt
Specifies C source file to preprocess.
.RE
.sp
.ne 2
.mk
.na
\fB\fIoutput\fR\fR
.ad
.RS 10n
.rt
Specifies output file.
.RE
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
An error occurred.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBmsgcpp\fR to Extract Localizable Strings
.sp
.LP
The following example uses \fBmsgcpp\fR to extract localizable strings from the file \fBhello.c\fR, marked using the \fBERROR_dictionary()\fR, and writes them to the file \fBhello.mso\fR:
.sp
.in +2
.nf
example% cat hello.c
#include <stdio.h>
#include <stdlib.h>
/*
 * dummy macro to avoid including
 * libast headers
 */
#define ERROR_dictionary(x) x
int main(int ac, char *av[])
{
    puts( ERROR_dictionary("hello world") );
    puts( ERROR_dictionary("hello all") );
    return( EXIT_SUCCESS );
 }
example% msgcpp -D__STDC__ -D__i386 hello.c hello.mso
example% cat hello.mso
str "hello world"
str "hello all"
.fi
.in -2
.sp
.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitydeveloper/astdev
_
Interface StabilityVolatile
.TE
.SH SEE ALSO
.sp
.LP
\fBcpp\fR(1), \fBgencat\fR(1), \fBmsgcc\fR(1), \fBmsgcvt\fR(1), \fBmsggen\fR(1), \fBmake\fR(1S), \fBattributes\fR(5)
.sp
.LP
Kernighan, Brian W. and Ritchie, Dennis M., \fIThe C Programming Language\fR, Prentice Hall, 1988.
components/ksh93/files/msgcvt.1
New file
@@ -0,0 +1,133 @@
'\" te
.\" Copyright (c) 2000-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
.TH msgcvt 1 "26 Apr 2010" "SunOS 5.11" "User Commands"
.SH NAME
msgcvt \- convert message file to and from HTML
.SH SYNOPSIS
.LP
.nf
\fBmsgcvt\fR [\fB-hmr\fR]
.fi
.SH DESCRIPTION
.sp
.LP
\fBmsgcvt\fR reads a \fBgencat\fR(1) format file on the standard input and converts it to \fBHTML\fR on the standard output. The input file must contain the control statement \fB$quote "\fR and use the \fB"\fR character to quote message text. The output is in a form suitable for automatic translation by web sites such as http://babelfish.yahoo.com\&.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-h\fR\fR
.ad
.br
.na
\fB\fB--html\fR\fR
.ad
.RS 10n
.rt
Generate \fBHTML\fR from \fBgencat\fR(1) input.
.sp
This is the default.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-m\fR\fR
.ad
.br
.na
\fB\fB--msg\fR\fR
.ad
.RS 10n
.rt
Generate a \fBgencat\fR(1) message file from (presumably translated) \fBHTML\fR. Wide characters are UTF-8 encoded.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-r\fR\fR
.ad
.br
.na
\fB\fB--raw\fR\fR
.ad
.RS 10n
.rt
The message file is raw message text, one message per line, with no quoting or line numbering.
.RE
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
One or more specified jobs does not exist.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRGenerating a \fBgencat\fR Message Catalog File
.sp
.LP
The following example generates a \fBgencat\fR(1) message catalog file from an HTML file:
.sp
.in +2
.nf
example% cat example.html | msgcvt -m > examplecat
.fi
.in -2
.sp
.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitydeveloper/astdev
_
Interface StabilityVolatile
.TE
.SH SEE ALSO
.sp
.LP
\fBgencat\fR(1), \fBmsgcc\fR(1), \fBmsggen\fR(1), \fBattributes\fR(5)
components/ksh93/files/msggen.1
New file
@@ -0,0 +1,373 @@
'\" te
.\" Copyright (c) 2000-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc.
.TH msggen 1 "9 Oct 2007" "SunOS 5.11" "User Commands"
.SH NAME
msggen \- generate a machine independent formatted message catalog
.SH SYNOPSIS
.LP
.nf
\fBmsggen\fR [\fB-fls\fR] \fIcatfile\fR [\fImsgfile\fR]
.fi
.SH DESCRIPTION
.sp
.LP
\fBmsggen\fR merges the message text source file \fImsgfile\fR into a machine independent formatted message catalog \fIcatfile\fR. The file \fIcatfile\fR is created if it does not already exist. If \fIcatfile\fR does exist, its messages are included in the new \fIcatfile\fR. If set and message numbers collide, the new message text defined in \fImsgfile\fR replaces the old message text currently contained in \fIcatfile\fR.
.sp
.LP
Non-ASCII characters must be UTF-8 encoded. \fBiconv\fR(1) can be used to convert to/from UTF-8.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.br
.na
\fB\fB--format\fR\fR
.ad
.RS 12n
.rt
List the \fBprintf\fR(3C) format signature for each message in \fIcatfile\fR. A format signature is one line containing one character for each format specification:
.sp
.ne 2
.mk
.na
\fB\fBc\fR\fR
.ad
.RS 5n
.rt
char
.RE
.sp
.ne 2
.mk
.na
\fB\fBd\fR\fR
.ad
.RS 5n
.rt
double
.RE
.sp
.ne 2
.mk
.na
\fB\fBD\fR\fR
.ad
.RS 5n
.rt
long double
.RE
.sp
.ne 2
.mk
.na
\fB\fBf\fR\fR
.ad
.RS 5n
.rt
float
.RE
.sp
.ne 2
.mk
.na
\fB\fBh\fR\fR
.ad
.RS 5n
.rt
short
.RE
.sp
.ne 2
.mk
.na
\fB\fBi\fR\fR
.ad
.RS 5n
.rt
int
.RE
.sp
.ne 2
.mk
.na
\fB\fBj\fR\fR
.ad
.RS 5n
.rt
long long
.RE
.sp
.ne 2
.mk
.na
\fB\fBl\fR\fR
.ad
.RS 5n
.rt
long
.RE
.sp
.ne 2
.mk
.na
\fB\fBp\fR\fR
.ad
.RS 5n
.rt
void*
.RE
.sp
.ne 2
.mk
.na
\fB\fBs\fR\fR
.ad
.RS 5n
.rt
string
.RE
.sp
.ne 2
.mk
.na
\fB\fBt\fR\fR
.ad
.RS 5n
.rt
ptrdiff_t
.RE
.sp
.ne 2
.mk
.na
\fB\fBz\fR\fR
.ad
.RS 5n
.rt
size_t
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fR
.ad
.RS 5n
.rt
unknown
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fB-l\fR\fR
.ad
.br
.na
\fB\fB--list\fR\fR
.ad
.RS 12n
.rt
List \fIcatfile\fR in UTF-8 msgfile form.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.br
.na
\fB\fB--set\fR\fR
.ad
.RS 12n
.rt
Convert the \fIcatfile\fR to a message set number and print the number on the standard output.
.RE
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.mk
.na
\fB\fIcatfile\fR\fR
.ad
.RS 11n
.rt
Machine independent formatted message catalog file.
.RE
.sp
.ne 2
.mk
.na
\fB\fImsgfile\fR\fR
.ad
.RS 11n
.rt
Message text source file.
.RE
.SH USAGE
.sp
.LP
Message text source files are in \fBgencat\fR(1) format, defined as follows. The fields of a message text source line are separated by a single blank character. Any other blank characters are considered to be part of the subsequent field. The \fBNL_*\fR constants are defined in one or both of \fB<limits.h>\fR and \fB<nl_types.h>\fR\&.
.sp
.ne 2
.mk
.na
\fB\fB$\fR \fIcomment\fR\fR
.ad
.sp .6
.RS 4n
A line beginning with a \fB$\fR followed by a blank character is treated as a comment.
.RE
.sp
.ne 2
.mk
.na
\fB\fB$delset\fR \fIn comment\fR\fR
.ad
.sp .6
.RS 4n
This line deletes message set \fIn\fR from an existing message catalog. \fIn\fR denotes the set number \fB[1, NL_SETMAX]\fR. Any text following the set number is treated as a comment.
.RE
.sp
.ne 2
.mk
.na
\fB\fB$quote\fR \fIc\fR\fR
.ad
.sp .6
.RS 4n
This line specifies an optional quote character \fIc\fR, which can be used to surround message-text so that trailing spaces or empty messages are visible in a message source line. By default, or if an empty \fB$quote\fR directive is supplied, no quoting of message-text is recognized.
.RE
.sp
.ne 2
.mk
.na
\fB\fB$set\fR \fIn comment\fR\fR
.ad
.sp .6
.RS 4n
This line specifies the set identifier of the following messages until the next \fB$set\fR or end-of-file (\fBEOF\fR) appears. \fIn\fR denotes the set identifier, which is defined as a number in the range \fB[1, NL_SETMAX]\fR. Set numbers need not be contiguous. Any text following the set identifier is treated as a comment. If no \fB$set\fR directive is specified in a message text source file, all messages are located in message set 1.
.RE
.sp
.ne 2
.mk
.na
\fB\fB$translation\fR \fIidentification YYYY-MM-DD\fR\fB[,...]\fR\fR
.ad
.sp .6
.RS 4n
Append translation information to the message catalog header. Only the newest date for a given identification is retained in the catalog. Multiple translation lines are combined into a single, comma-separated list.
.RE
.sp
.ne 2
.mk
.na
\fB\fBm\fR \fImessage-text\fR\fR
.ad
.sp .6
.RS 4n
\fBm\fR denotes the message identifier, which is defined as a number in the range \fB[1, NL_MSGMAX]\fR. The message-text is stored in the message catalogue with the set identifier specified by the last \fB$set\fR directive, and with message identifier \fBm\fR. If the message-text is empty, and a blank character field separator is present, an empty string is stored in the message catalogue. If a message source line has a message number, but neither a field separator nor message-text, the existing message with that number (if any) is deleted from the catalogue. Message identifiers need not be contiguous. There are no \fImessage-text\fR length restrictions.
.RE
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
One or more specified jobs does not exist.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBmsggen\fR
.sp
.LP
The following example generates a message catalog \fBxxx\fR from the message file \fBxxx.msg\fR:
.sp
.in +2
.nf
example% msggen xxx xxx.msg
.fi
.in -2
.sp
.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitydeveloper/astdev
_
Interface StabilityVolatile
.TE
.SH SEE ALSO
.sp
.LP
\fBgencat\fR(1), \fBiconv\fR(1), \fBmsgcc\fR(1), \fBprintf\fR(3C), \fBattributes\fR(5)
components/ksh93/files/msgget.1
New file
@@ -0,0 +1,142 @@
'\" te
.\" Copyright (c) 2000-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc.
.TH msgget 1 "9 Oct 2007" "SunOS 5.11" "User Commands"
.SH NAME
msgget \- get a message from a message catalog
.SH SYNOPSIS
.LP
.nf
\fBmsgget\fR \fIlocale\fR [\fIcommand\fR\fB:\fR]\fIcatalog\fR [\fIset\fR.]\fInumber\fR [\fItext\fR]
.fi
.SH DESCRIPTION
.sp
.LP
\fBmsgget\fR gets the message corresponding to the parameters. See \fBOPERANDS\fR.
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.mk
.na
\fB\fIcatalog\fR\fR
.ad
.RS 16n
.rt
Specifies the message catalog name.
.RE
.sp
.ne 2
.mk
.na
\fB\fIcommand\fR\fR
.ad
.RS 16n
.rt
Specifies command-specific message.
.RE
.sp
.ne 2
.mk
.na
\fB\fIlocale\fR\fR
.ad
.RS 16n
.rt
Specifies the locale. If \fIlocale\fR is \fB-\fR then the current locale is used.
.RE
.sp
.ne 2
.mk
.na
\fB\fB[\fR\fIset\fR\fB].\fR\fInumber\fR\fR
.ad
.RS 16n
.rt
Identifies the message by message number and an optional message set. If specified as \fB-\fR , the message set and number are determined by looking up text in the corresponding C locale message catalog.
.RE
.sp
.ne 2
.mk
.na
\fB\fItext\fR\fR
.ad
.RS 16n
.rt
Specifies the text of the message to be output upon error.
.RE
.SH EXIT STATUS
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
An error occurred.
.RE
.SH EXAMPLES
.LP
\fBExample 1 \fRGetting a Message in the Current Locale
.sp
.LP
The following example gets \fBmsg 1\fR in the current locale from message catalog \fBhello\fR:
.sp
.in +2
.nf
example% msgget - hello 1
hello world
.fi
.in -2
.sp
.SH AUTHORS
.sp
.LP
Glenn Fowler, \fBgsf@research.att.com\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitydeveloper/astdev
_
Interface StabilityVolatile
.TE
.SH SEE ALSO
.sp
.LP
\fBiconv\fR(1), \fBmsgcc\fR(1), \fBmsggen\fR(1), \fBattributes\fR(5)
components/ksh93/files/popd.1
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/popd.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/pushd.1
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/pushd.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/cd.1
components/ksh93/files/rksh.1
New file
@@ -0,0 +1 @@
.so man1/ksh93.1
components/ksh93/files/rksh.1.ja_JP.UTF-8
New file
@@ -0,0 +1 @@
.so man1/ksh.1
components/ksh93/files/rksh.1.zh_CN.UTF-8
New file
@@ -0,0 +1 @@
.so man1/ksh.1
components/ksh93/files/sh.1
New file
@@ -0,0 +1,1732 @@
'\" te
.\" Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\"  Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at  http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.  This notice shall appear on any product containing this material.
.TH sh 1 "12 Jul 2011" "SunOS 5.11" "User Commands"
.SH NAME
sh, jsh \- standard and job control shell and command interpreter
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/sh\fR  [\fB-acefhiknprstuvx\fR] [\fIargument\fR]...
.fi
.LP
.nf
\fB/usr/xpg4/bin/sh\fR  [\(+- abCefhikmnoprstuvx]
     [\(+- o \fIoption\fR]... [\fB-c\fR \fIstring\fR] [\fIarg\fR]...
.fi
.LP
.nf
\fB/usr/bin/jsh\fR  [\fB-acefhiknprstuvx\fR] [\fIargument\fR]...
.fi
.SH DESCRIPTION
.sp
.LP
The \fB/usr/bin/sh\fR utility is a command programming language that executes commands read from a terminal or a file.
.sp
.LP
The \fB/usr/xpg4/bin/sh\fR utility is a standards compliant shell. This utility provides all the functionality of \fBksh88\fR(1), except in cases discussed in \fBksh88\fR(1) where differences in behavior exist.
.sp
.LP
The \fBjsh\fR utility is an interface to the shell that provides all of the functionality of \fBsh\fR and enables job control (see \fBJob Control\fR section below).
.sp
.LP
Arguments to the shell are listed in the \fBInvocation\fR section below.
.SS "Definitions"
.sp
.LP
A \fIblank\fR is a tab or a space. A \fIname\fR is a sequence of \fBASCII\fR letters, digits, or underscores, beginning with a letter or an underscore. A \fIparameter\fR is a name, a digit, or any of the characters \fB*\fR, \fB@\fR, \fB#\fR, \fB?\fR, \fB\(mi\fR, \fB$\fR, and \fB!\fR.
.SH USAGE
.SS "Commands"
.sp
.LP
A \fIsimple-command\fR is a sequence of non-blank \fIword\fRs separated by \fIblank\fRs. The first \fIword\fR specifies the name of the command to be executed. Except as specified below, the remaining \fIword\fRs are passed as arguments to the invoked command. The command name is passed as argument 0 (see \fBexec\fR(2)). The \fIvalue\fR of a \fIsimple-command\fR is its exit status if it terminates normally, or (octal) \fB200\fR+\fIstatus\fR if it terminates abnormally. See \fBsignal.h\fR(3HEAD) for a list of status values.
.sp
.LP
A \fIpipeline\fR is a sequence of one or more \fIcommand\fRs separated by \fB|\fR. The standard output of each \fIcommand\fR but the last is connected by a \fBpipe\fR(2) to the standard input of the next \fIcommand\fR. Each \fIcommand\fR is run as a separate process. The shell waits for the last \fIcommand\fR to terminate. The exit status of a \fIpipeline\fR is the exit status of the last command in the \fIpipeline\fR.
.sp
.LP
A \fIlist\fR is a sequence of one or more \fIpipeline\fRs separated by \fB;\fR, \fB&\fR, \fB&&\fR, or \fB|\||\fR, and optionally terminated by \fB;\fR or \fB&\fR\&. Of these four symbols, \fB;\fR and \fB&\fR have equal precedence, which is lower than that of \fB&&\fR and \fB|\||\fR. The symbols \fB&&\fR and \fB|\||\fR also have equal precedence. A semicolon (\fB;\fR) causes sequential execution of the preceding \fIpipeline\fR, that is, the shell waits for the \fIpipeline\fR to finish before executing any commands following the semicolon. An ampersand (\fB&\fR) causes asynchronous execution of the preceding pipeline, that is, the shell does \fBnot\fR wait for that pipeline to finish. The symbol \fB&&\fR (\|\fB|\||\fR) causes the \fIlist\fR following it to be executed only if the preceding pipeline returns a zero (non-zero) exit status. An arbitrary number of newlines can appear in a \fIlist\fR, instead of semicolons, to delimit commands.
.sp
.LP
A \fIcommand\fR is either a \fIsimple-command\fR or one of the following. Unless otherwise stated, the value returned by a command is that of the last \fIsimple-command\fR executed in the command.
.sp
.ne 2
.mk
.na
\fB\fBfor\fR \fIname\fR [ \fBin\fR \fIword\fR .\|.\|. ] \fBdo\fR \fIlist\fR \fBdone\fR\fR
.ad
.sp .6
.RS 4n
Each time a \fBfor\fR command is executed, \fIname\fR is set to the next \fIword\fR taken from the \fBin\fR \fIword\fR list. If \fBin\fR \fIword\fR .\|.\|. is omitted, then the \fBfor\fR command executes the \fBdo\fR \fIlist\fR once for each positional parameter that is set (see \fBParameter Substitution\fR section below). Execution ends when there are no more words in the list.
.RE
.sp
.ne 2
.mk
.na
\fB\fBcase\fR \fIword\fR \fBin\fR [ \fIpattern\fR [ | \fIpattern\fR ] \fB)\fR \fIlist\fR \fB;\|;\fR ] .\|.\|.  \fBesac\fR\fR
.ad
.sp .6
.RS 4n
A \fBcase\fR command executes the \fIlist\fR associated with the first \fIpattern\fR that matches \fIword\fR. The form of the patterns is the same as that used for file-name generation (see \fBFile Name Generation\fR section), except that a slash, a leading dot, or a dot immediately following a slash need not be matched explicitly.
.RE
.sp
.LP
\fBif\fR \fIlist\fR \fB; then\fR \fIlist\fR \fBelif\fR \fIlist\fR \fB; then\fR \fIlist\fR \fB;\fR ] .\|.\|. [ \fBelse\fR \fIlist\fR \fB;\fR ] \fBfi\fR
.sp
.LP
The \fIlist\fR following \fBif\fR is executed and, if it returns a zero exit status, the \fIlist\fR following the first \fBthen\fR is executed. Otherwise, the \fIlist\fR following \fBelif\fR is executed and, if its value is zero, the \fIlist\fR following the next \fBthen\fR is executed. Failing that, the \fBelse\fR \fIlist\fR is executed. If no \fBelse\fR \fIlist\fR or \fBthen\fR \fIlist\fR is executed, then the \fBif\fR command returns a zero exit status.
.sp
.ne 2
.mk
.na
\fB\fBwhile\fR \fIlist\fR \fBdo\fR \fIlist\fR \fBdone\fR\fR
.ad
.RS 27n
.rt
A \fBwhile\fR command repeatedly executes the \fBwhile\fR \fIlist\fR and, if the exit status of the last command in the list is zero, executes the \fBdo\fR \fIlist\fR; otherwise the loop terminates. If no commands in the \fBdo\fR \fIlist\fR are executed, then the \fBwhile\fR command returns a zero exit status; \fBuntil\fR can be used in place of \fBwhile\fR to negate the loop termination test.
.RE
.sp
.ne 2
.mk
.na
\fB\fB(\fR\fIlist\fR\fB)\fR\fR
.ad
.RS 27n
.rt
Execute \fIlist\fR in a sub-shell.
.RE
.sp
.ne 2
.mk
.na
\fB\fB{\fR \fIlist\fR\fB;}\fR\fR
.ad
.RS 27n
.rt
\fIlist\fR is executed in the current (that is, parent) shell. The \fB{\fR must be followed by a space.
.RE
.sp
.ne 2
.mk
.na
\fB\fIname\fR \fB(\|) {\fR \fIlist\fR\fB;}\fR\fR
.ad
.RS 27n
.rt
Define a function which is referenced by \fIname\fR. The body of the function is the \fIlist\fR of commands between \fB{\fR and \fB}\fR. The \fB{\fR must be followed by a space. Execution of functions is described below (see \fBExecution\fR section). The \fB{\fR and \fB}\fR are unnecessary if the body of the function is a \fIcommand\fR as defined above, under \fBCommands\fR.
.RE
.sp
.LP
The following words are only recognized as the first word of a command and when not quoted:
.sp
.LP
\fBif  then  else  elif  fi  case  esac  for  while  until  do  done  {  }\fR
.SS "Comments Lines"
.sp
.LP
A word beginning with \fB#\fR causes that word and all the following characters up to a newline to be ignored.
.SS "Command Substitution"
.sp
.LP
The shell reads commands from the string between two grave accents (\fB``\fR) and the standard output from these commands can be used as all or part of a word. Trailing newlines from the standard output are removed.
.sp
.LP
No interpretation is done on the string before the string is read, except to remove backslashes (\fB\e\fR) used to escape other characters. Backslashes can be used to escape a grave accent (\fB`\fR) or another backslash (\fB\e\fR) and are removed before the command string is read. Escaping grave accents allows nested command substitution. If the command substitution lies within a pair of double quotes (\fB" .\|.\|.\|` .\|.\|.\|` .\|.\|.\| "\fR), a backslash used to escape a double quote (\fB\e"\fR) is removed. Otherwise, it is left intact.
.sp
.LP
If a backslash is used to escape a newline character (\fB\enewline\fR), both the backslash and the newline are removed (see the later section on \fBQuoting\fR). In addition, backslashes used to escape dollar signs (\fB\e$\fR) are removed. Since no parameter substitution is done on the command string before it is read, inserting a backslash to escape a dollar sign has no effect. Backslashes that precede characters other than \fB\e\fR, \fB`\fR, \fB"\fR, \fBnewline\fR, and \fB$\fR are left intact when the command string is read.
.SS "Parameter Substitution"
.sp
.LP
The character \fB$\fR is used to introduce substitutable \fIparameter\fRs. There are two types of parameters, positional and keyword. If \fIparameter\fR is a digit, it is a positional parameter. Positional parameters can be assigned values by \fBset\fR. Keyword parameters (also known as variables) can be assigned values by writing:
.sp
.LP
\fIname\fR\fB=\fR\fIvalue\fR [ \fIname\fR\fB=\fR\fIvalue\fR ] .\|.\|.
.sp
.LP
Pattern-matching is not performed on \fIvalue\fR. There cannot be a function and a variable with the same \fIname\fR.
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB}\fR\fR
.ad
.RS 25n
.rt
The value, if any, of the parameter is substituted. The braces are required only when \fIparameter\fR is followed by a letter, digit, or underscore that is not to be interpreted as part of its name. If \fIparameter\fR is \fB*\fR or \fB@\fR, all the positional parameters, starting with \fB$1\fR, are substituted (separated by spaces). Parameter \fB$0\fR is set from argument zero when the shell is invoked.
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:\(mi\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
Use Default Values. If \fIparameter\fR is unset or null, the expansion of \fIword\fR is substituted; otherwise, the value of \fIparameter\fR is substituted.
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:=\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
Assign Default Values. If \fIparameter\fR is unset or null, the expansion of \fIword\fR is assigned to \fIparameter\fR. In all cases, the final value of \fIparameter\fR is substituted. Only variables, not positional parameters or special parameters, can be assigned in this way.
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:?\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
If \fIparameter\fR is set and is non-null, substitute its value; otherwise, print \fIword\fR and exit from the shell. If \fIword\fR is omitted, the message "parameter null or not set" is printed.
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:+\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
If \fIparameter\fR is set and is non-null, substitute \fIword\fR; otherwise substitute nothing.
.RE
.sp
.LP
In the above, \fIword\fR is not evaluated unless it is to be used as the substituted string, so that, in the following example, \fBpwd\fR is executed only if \fBd\fR is not set or is null:
.sp
.in +2
.nf
\fBecho  ${d:\(mi`pwd`}\fR
.fi
.in -2
.sp
.sp
.LP
If the colon (\fB:\fR) is omitted from the above expressions, the shell only checks whether \fIparameter\fR is set or not.
.sp
.LP
The following parameters are automatically set by the shell.
.sp
.ne 2
.mk
.na
\fB\fB#\fR\fR
.ad
.RS 8n
.rt
The number of positional parameters in decimal.
.RE
.sp
.ne 2
.mk
.na
\fB\fB\(mi\fR\fR
.ad
.RS 8n
.rt
Flags supplied to the shell on invocation or by the \fBset\fR command.
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fR
.ad
.RS 8n
.rt
The decimal value returned by the last synchronously executed command.
.RE
.sp
.ne 2
.mk
.na
\fB\fB$\fR\fR
.ad
.RS 8n
.rt
The process number of this shell.
.RE
.sp
.ne 2
.mk
.na
\fB\fB!\fR\fR
.ad
.RS 8n
.rt
The process number of the last background command invoked.
.RE
.sp
.LP
The following parameters are used by the shell. The parameters in this section are also referred to as environment variables.
.sp
.ne 2
.mk
.na
\fB\fBHOME\fR\fR
.ad
.RS 13n
.rt
The default argument (home directory) for the \fBcd\fR command, set to the user's login directory by \fBlogin\fR(1) from the password file (see \fBpasswd\fR(4)).
.RE
.sp
.ne 2
.mk
.na
\fB\fBPATH\fR\fR
.ad
.RS 13n
.rt
The search path for commands (see \fBExecution\fR section below).
.RE
.sp
.ne 2
.mk
.na
\fB\fBCDPATH\fR\fR
.ad
.RS 13n
.rt
The search path for the \fBcd\fR command.
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAIL\fR\fR
.ad
.RS 13n
.rt
If this parameter is set to the name of a mail file \fIand\fR the \fBMAILPATH\fR  parameter is not set, the shell informs the user of the arrival of mail in the specified file.
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAILCHECK\fR\fR
.ad
.RS 13n
.rt
This parameter specifies how often (in seconds) the shell checks for the arrival of mail in the files specified by the \fBMAILPATH\fR or \fBMAIL\fR parameters. The default value is \fB600\fR seconds (10 minutes). If set to 0, the shell checks before each prompt.
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAILPATH\fR\fR
.ad
.RS 13n
.rt
A colon-separated list of file names. If this parameter is set, the shell informs the user of the arrival of mail in any of the specified files. Each file name can be followed by % and a message that is e printed when the modification time changes. The default message is, \fByou have mail\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBPS1\fR\fR
.ad
.RS 13n
.rt
Primary prompt string, by default " $ \|".
.RE
.sp
.ne 2
.mk
.na
\fB\fBPS2\fR\fR
.ad
.RS 13n
.rt
Secondary prompt string, by default " > \|".
.RE
.sp
.ne 2
.mk
.na
\fB\fBIFS\fR\fR
.ad
.RS 13n
.rt
Internal field separators, normally \fBspace\fR, \fBtab\fR, and \fBnewline\fR (see \fBBlank Interpretation\fR section).
.RE
.sp
.ne 2
.mk
.na
\fB\fBSHACCT\fR\fR
.ad
.RS 13n
.rt
If this parameter is set to the name of a file writable by the user, the shell writes an accounting record in the file for each shell procedure executed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBSHELL\fR\fR
.ad
.RS 13n
.rt
When the shell is invoked, it scans the environment (see \fBEnvironment\fR section below) for this name.
.RE
.sp
.LP
See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBsh\fR: \fBLC_CTYPE\fR and \fBLC_MESSAGES\fR.
.sp
.LP
The shell gives default values to \fBPATH\fR, \fBPS1\fR, \fBPS2\fR, \fBMAILCHECK\fR, and \fBIFS\fR. Default values for \fBHOME\fR and \fBMAIL\fR are set by \fBlogin\fR(1).
.SS "Blank Interpretation"
.sp
.LP
After parameter and command substitution, the results of substitution are scanned for internal field separator characters (those found in \fBIFS\fR) and split into distinct arguments where such characters are found. Explicit null arguments (\fB""\fR or \fB\&''\fR) are retained. Implicit null arguments (those resulting from \fIparameter\fRs that have no values) are removed.
.SS "Input/Output Redirection"
.sp
.LP
A command's input and output can be redirected using a special notation interpreted by the shell. The following can appear anywhere in a \fIsimple-command\fR or can precede or follow a \fIcommand\fR and are \fBnot\fR passed on as arguments to the invoked command. \fBNote:\fR Parameter and command substitution occurs before \fIword\fR or \fIdigit\fR is used.
.sp
.ne 2
.mk
.na
\fB\fB<\fR\fIword\fR\fR
.ad
.RS 16n
.rt
Use file \fIword\fR as standard input (file descriptor 0).
.RE
.sp
.ne 2
.mk
.na
\fB\fB>\fR\fIword\fR\fR
.ad
.RS 16n
.rt
Use file \fIword\fR as standard output (file descriptor 1). If the file does not exist, it is created; otherwise, it is truncated to zero length.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>>\fR\fIword\fR\fR
.ad
.RS 16n
.rt
Use file \fIword\fR as standard output. If the file exists, output is appended to it by first seeking to the \fBEOF\fR. Otherwise, the file is created.
.RE
.sp
.ne 2
.mk
.na
\fB\fB<\|>\fR\fIword\fR\fR
.ad
.RS 16n
.rt
Open file \fIword\fR for reading and writing as standard input.
.RE
.sp
.ne 2
.mk
.na
\fB\fB<<\fR[\fB\(mi\fR]\fIword\fR\fR
.ad
.RS 16n
.rt
After parameter and command substitution is done on \fIword\fR, the shell input is read up to the first line that literally matches the resulting \fIword\fR, or to an \fBEOF\fR. If, however, the hyphen (\fB\(mi\fR) is appended to \fB<<\fR:
.RS +4
.TP
1.
leading tabs are stripped from \fIword\fR before the shell input is read (but after parameter and command substitution is done on \fIword\fR);
.RE
.RS +4
.TP
2.
leading tabs are stripped from the shell input as it is read and before each line is compared with \fIword\fR; and
.RE
.RS +4
.TP
3.
shell input is read up to the first line that literally matches the resulting \fIword\fR, or to an \fBEOF\fR.
.RE
If any character of \fIword\fR is quoted (see \fBQuoting\fR section later), no additional processing is done to the shell input. If no characters of \fIword\fR are quoted:
.RS +4
.TP
1.
parameter and command substitution occurs;
.RE
.RS +4
.TP
2.
(escaped) \fB\enewline\fRs are removed; and
.RE
.RS +4
.TP
3.
\fB\e\fR must be used to quote the characters \fB\e\fR, \fB$\fR, and \fB`\fR.
.RE
The resulting document becomes the standard input.
.RE
.sp
.ne 2
.mk
.na
\fB\fB<&\fR\fIdigit\fR\fR
.ad
.RS 16n
.rt
Use the file associated with file descriptor \fIdigit\fR as standard input. Similarly for the standard output using \fB>&\fR\fIdigit\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB<&\(mi\fR\fR
.ad
.RS 16n
.rt
The standard input is closed. Similarly for the standard output using \fB>&\(mi\fR.
.RE
.sp
.LP
If any of the above is preceded by a digit, the file descriptor which is associated with the file is that specified by the digit (instead of the default \fB0\fR or \fB1\fR). For example:
.sp
.in +2
.nf
\fB\&... 2>&1\fR
.fi
.in -2
.sp
.sp
.LP
associates file descriptor 2 with the file currently associated with file descriptor 1.
.sp
.LP
The order in which redirections are specified is significant. The shell evaluates redirections left-to-right. For example:
.sp
.in +2
.nf
\fB\&... 1>\fIxxx\fR 2>&1\fR
.fi
.in -2
.sp
.sp
.LP
first associates file descriptor 1 with file \fIxxx\fR. It associates file descriptor 2 with the file associated with file descriptor 1 (that is, \fIxxx\fR). If the order of redirections were reversed, file descriptor 2 would be associated with the terminal (assuming file descriptor 1 had been) and file descriptor 1 would be associated with file \fIxxx\fR.
.sp
.LP
Using the terminology introduced on the first page, under \fBCommands\fR, if a \fIcommand\fR is composed of several \fIsimple commands\fR, redirection is evaluated for the entire \fIcommand\fR before it is evaluated for each \fIsimple command\fR. That is, the shell evaluates redirection for the entire \fIlist\fR, then each \fIpipeline\fR within the \fIlist\fR, then each \fIcommand\fR within each \fIpipeline\fR, then each \fIlist\fR within each \fIcommand\fR.
.sp
.LP
If a command is followed by \fB&\fR, the default standard input for the command is the empty file, \fB/dev/null\fR. Otherwise, the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications.
.SS "File Name Generation"
.sp
.LP
Before a command is executed, each command \fIword\fR is scanned for the characters \fB*\fR, \fB?\fR, and \fB[\fR. If one of these characters appears the word is regarded as a \fIpattern\fR. The word is replaced with alphabetically sorted file names that match the pattern. If no file name is found that matches the pattern, the word is left unchanged. The character \fB\&.\fR at the start of a file name or immediately following a \fB/\fR, as well as the character \fB/\fR itself, must be matched explicitly.
.sp
.ne 2
.mk
.na
\fB\fB*\fR\fR
.ad
.RS 13n
.rt
Matches any string, including the null string.
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fR
.ad
.RS 13n
.rt
Matches any single character.
.RE
.sp
.ne 2
.mk
.na
\fB\fB[\fR.\|.\|.\fB]\fR\fR
.ad
.RS 13n
.rt
Matches any one of the enclosed characters. A pair of characters separated by \fB\(mi\fR matches any character lexically between the pair, inclusive. If the first character following the opening \fB[\fR is a \fB!\fR, any character not enclosed is matched.
.RE
.sp
.LP
Notice that all quoted characters (see below) must be matched explicitly in a filename.
.SS "Quoting"
.sp
.LP
The following characters have a special meaning to the shell and cause termination of a word unless quoted:
.sp
.LP
\fB;  &  (  )  |  ^  <  >  newline  space  tab\fR
.sp
.LP
A character can be \fIquoted\fR (that is, made to stand for itself) by preceding it with a backslash (\fB\e\fR) or inserting it between a pair of quote marks (\fB\|'\|'\fR or \fB""\fR). During processing, the shell can quote certain characters to prevent them from taking on a special meaning. Backslashes used to quote a single character are removed from the word before the command is executed. The pair \fB\enewline\fR is removed from a word before command and parameter substitution.
.sp
.LP
All characters enclosed between a pair of single quote marks (\fB\|'\|'\fR), except a single quote, are quoted by the shell. Backslash has no special meaning inside a pair of single quotes. A single quote can be quoted inside a pair of double quote marks (for example, \fB"\|'"\fR), but a single quote can not be quoted inside a pair of single quotes.
.sp
.LP
Inside a pair of double quote marks (\fB""\fR), parameter and command substitution occurs and the shell quotes the results to avoid blank interpretation and file name generation. If \fB$*\fR is within a pair of double quotes, the positional parameters are substituted and quoted, separated by quoted spaces (\fB"$1 \|$2\fR \|.\|.\|.\fB"\fR). However, if \fB$@\fR is within a pair of double quotes, the positional parameters are substituted and quoted, separated by unquoted spaces (\fB"$1"\|"$2"\fR \| .\|.\|. ). \fB\e\fR quotes the characters \fB\e\fR, \fB`\fR, \fB,\fR (comma), and \fB$\fR. The pair \fB\enewline\fR is removed before parameter and command substitution. If a backslash precedes characters other than \fB\e\fR, \fB`\fR, \fB,\fR (comma), \fB$\fR, and newline, then the backslash itself is quoted by the shell.
.SS "Prompting"
.sp
.LP
When used interactively, the shell prompts with the value of \fBPS1\fR before reading a command. If at any time a newline is typed and further input is needed to complete a command, the secondary prompt (that is, the value of \fBPS2\fR) is issued.
.SS "Environment"
.sp
.LP
The \fIenvironment\fR (see \fBenviron\fR(5)) is a list of name-value pairs that is passed to an executed program in the same way as a normal argument list. The shell interacts with the environment in several ways. On invocation, the shell scans the environment and creates a parameter for each name found, giving it the corresponding value. If the user modifies the value of any of these parameters or creates new parameters, none of these affects the environment unless the \fBexport\fR command is used to bind the shell's parameter to the environment (see also \fBset\fR \fB-a\fR). A parameter can be removed from the environment with the \fBunset\fR command. The environment seen by any executed command is thus composed of any unmodified name-value pairs originally inherited by the shell, minus any pairs removed by \fBunset\fR, plus any modifications or additions, all of which must be noted in \fBexport\fR commands.
.sp
.LP
The environment for any \fIsimple-command\fR can be augmented by prefixing it with one or more assignments to parameters. Thus:
.sp
.in +2
.nf
\fBTERM=450  \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
and
.sp
.in +2
.nf
\fB(export TERM; TERM=450;   \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
are equivalent as far as the execution of \fIcommand\fR is concerned if \fIcommand\fR is not a Special Command. If \fIcommand\fR is a Special Command, then
.sp
.in +2
.nf
\fBTERM=450   \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
modifies the \fBTERM\fR variable in the current shell.
.sp
.LP
If the \fB-k\fR flag is set, \fIall\fR keyword arguments are placed in the environment, even if they occur after the command name. The following example first prints \fBa=b c\fR and \fBc\fR:
.sp
.in +2
.nf
\fBecho a=b  c
a=b  c
set  \(mik
echo a=b  c
c\fR
.fi
.in -2
.sp
.SS "Signals"
.sp
.LP
The \fBINTERRUPT\fR and \fBQUIT\fR signals for an invoked command are ignored if the command is followed by \fB&\fR\&. Otherwise, signals have the values inherited by the shell from its parent, with the exception of signal 11 (but see also the \fBtrap\fR command below).
.SS "Execution"
.sp
.LP
Each time a command is executed, the command substitution, parameter substitution, blank interpretation, input/output redirection, and filename generation listed above are carried out. If the command name matches the name of a defined function, the function is executed in the shell process (note how this differs from the execution of shell script files, which require a sub-shell for invocation). If the command name does not match the name of a defined function, but matches one of the \fBSpecial Commands\fR listed below, it is executed in the shell process.
.sp
.LP
The positional parameters \fB$1\fR, \fB$2\fR, .\|.\|. are set to the arguments of the function. If the command name matches neither a \fBSpecial Command\fR nor the name of a defined function, a new process is created and an attempt is made to execute the command via \fBexec\fR(2).
.sp
.LP
The shell parameter \fBPATH\fR defines the search path for the directory containing the command. Alternative directory names are separated by a colon (\fB:\fR). The default path is \fB/usr/bin\fR. The current directory is specified by a null path name, which can appear immediately after the equal sign, between two colon delimiters anywhere in the path list, or at the end of the path list. If the command name contains a \fB/\fR the search path is not used. Otherwise, each directory in the path is searched for an executable file. If the file has execute permission but is not an \fBa.out\fR file, it is assumed to be a file containing shell commands. A sub-shell is spawned to read it. A parenthesized command is also executed in a sub-shell.
.sp
.LP
The location in the search path where a command was found is remembered by the shell (to help avoid unnecessary \fIexec\fRs later). If the command was found in a relative directory, its location must be re-determined whenever the current directory changes. The shell forgets all remembered locations whenever the \fBPATH\fR variable is changed or the \fBhash\fR \fB-r\fR command is executed (see below).
.SS "Special Commands"
.sp
.LP
Input/output redirection is now permitted for these commands. File descriptor 1 is the default output location. When Job Control is enabled, additional \fBSpecial Commands\fR are added to the shell's environment (see \fBJob Control\fR section below).
.sp
.ne 2
.mk
.na
\fB\fB:\fR\fR
.ad
.sp .6
.RS 4n
No effect; the command does nothing. A zero exit code is returned.
.RE
.sp
.ne 2
.mk
.na
\fB\fB\&.\|\fR \fIfilename\fR\fR
.ad
.sp .6
.RS 4n
Read and execute commands from \fIfilename\fR and return. The search path specified by \fBPATH\fR is used to find the directory containing \fIfilename\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBbg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
When Job Control is enabled, the \fBbg\fR command is added to the user's environment to manipulate jobs. Resumes the execution of a stopped job in the background. If \fB%\fR\fIjobid\fR is omitted the current job is assumed. (See \fBJob Control\fR section below for more detail.)
.RE
.sp
.ne 2
.mk
.na
\fB\fBbreak\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
Exit from the enclosing \fBfor\fR or \fBwhile\fR loop, if any. If \fIn\fR is specified, break \fIn\fR levels.
.RE
.sp
.ne 2
.mk
.na
\fB\fBcd\fR [ \fIargument\fR ]\fR
.ad
.sp .6
.RS 4n
Change the current directory to \fIargument\fR. The shell parameter \fBHOME\fR is the default \fIargument\fR. The shell parameter \fBCDPATH\fR defines the search path for the directory containing \fIargument\fR. Alternative directory names are separated by a colon (\fB:\fR). The default path is \fB<null>\fR (specifying the current directory). \fBNote:\fR The current directory is specified by a null path name, which can appear immediately after the equal sign or between the colon delimiters anywhere else in the path list. If \fIargument\fR begins with a \fB/\fR the search path is not used. Otherwise, each directory in the path is searched for \fIargument\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBchdir\fR [ \fIdir\fR ]\fR
.ad
.sp .6
.RS 4n
\fBchdir\fR changes the shell's working directory to directory \fIdir\fR. If no argument is given, change to the home directory of the user. If \fIdir\fR is a relative pathname not found in the current directory, check for it in those directories listed in the \fBCDPATH\fR variable. If \fIdir\fR is the name of a shell variable whose value starts with a \fB/\fR, change to the directory named by that value.
.RE
.sp
.ne 2
.mk
.na
\fB\fBcontinue\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
Resume the next iteration of the enclosing \fBfor\fR or \fBwhile\fR loop. If \fIn\fR is specified, resume at the \fIn\fR-th enclosing loop.
.RE
.sp
.ne 2
.mk
.na
\fB\fBecho\fR [ \fIarguments\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
The words in \fIarguments\fR are written to the shell's standard output, separated by space characters. See \fBecho\fR(1) for fuller usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBeval\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
The arguments are read as input to the shell and the resulting command(s) executed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBexec\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
The command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments can appear and, if no other arguments are given, cause the shell input/output to be modified.
.RE
.sp
.ne 2
.mk
.na
\fB\fBexit\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
Causes the calling shell or shell script to exit with the exit status specified by \fIn\fR. If \fIn\fR is omitted the exit status is that of the last command executed (an \fBEOF\fR also causes the shell to exit.)
.RE
.sp
.ne 2
.mk
.na
\fB\fBexport\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
The given \fIname\fRs are marked for automatic export to the \fIenvironment\fR of subsequently executed commands. If no arguments are given, variable names that have been marked for export during the current shell's execution are listed. (Variable names exported from a parent shell are listed only if they have been exported again during the current shell's execution.) Function names are \fBnot\fR exported.
.RE
.sp
.ne 2
.mk
.na
\fB\fBfg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
When Job Control is enabled, the \fBfg\fR command is added to the user's environment to manipulate jobs. This command resumes the execution of a stopped job in the foreground and also moves an executing background job into the foreground. If \fB%\fR\fIjobid\fR is omitted, the current job is assumed. (See \fBJob Control\fR section below for more detail.)
.RE
.sp
.ne 2
.mk
.na
\fB\fBgetopts\fR\fR
.ad
.sp .6
.RS 4n
Use in shell scripts to support command syntax standards (see \fBIntro\fR(1)). This command parses positional parameters and checks for legal options. See \fBgetoptcvt\fR(1) for usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBhash\fR [ \fB-r\fR ] [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
For each \fIname\fR, the location in the search path of the command specified by \fIname\fR is determined and remembered by the shell. The \fB-r\fR option causes the shell to forget all remembered locations. If no arguments are given, information about remembered commands is presented. \fIHits\fR is the number of times a command has been invoked by the shell process. \fICost\fR is a measure of the work required to locate a command in the search path. If a command is found in a "relative" directory in the search path, after changing to that directory, the stored location of that command is recalculated. Commands for which this are done are indicated by an asterisk (\fB*\fR) adjacent to the \fIhits\fR information. \fICost\fR is incremented when the recalculation is done.
.RE
.sp
.ne 2
.mk
.na
\fB\fBjobs\fR [\fB\fR\fB-p\fR\fB|\fR\fB-l\fR] [\fB%\fR\fIjobid ...\fR]\fR
.ad
.br
.na
\fB\fBjobs\fR \fB-x\fR \fIcommand\fR [\fIarguments\fR]\fR
.ad
.sp .6
.RS 4n
Reports all jobs that are stopped or executing in the background. If \fB%\fR\fIjobid\fR is omitted, all jobs that are stopped or running in the background are reported. (See \fBJob Control\fR section below for more detail.)
.RE
.sp
.ne 2
.mk
.na
\fB\fBkill\fR [ \fB-\fR\fIsig\fR ] \fB%\fR\fIjob\fR .\|.\|.\fR
.ad
.br
.na
\fB\fBkill\fR \fB-l\fR\fR
.ad
.sp .6
.RS 4n
Sends either the \fBTERM\fR (terminate) signal or the specified signal to the specified jobs or processes. Signals are either given by number or by names (as given in \fBsignal.h\fR(3HEAD) stripped of the prefix "SIG" with the exception that \fBSIGCHD\fR is named \fBCHLD\fR). If the signal being sent is \fBTERM\fR (terminate) or \fBHUP\fR (hangup), then the job or process is sent a \fBCONT\fR (continue) signal if it is stopped. The argument \fIjob\fR can be the process id of a process that is not a member of one of the active jobs. See \fBJob Control\fR section below for a description of the format of \fIjob\fR. In the second form, \fBkill\fR \fB-l\fR, the signal numbers and names are listed. (See \fBkill\fR(1)).
.RE
.sp
.ne 2
.mk
.na
\fB\fBlogin\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
Equivalent to `\fBexec\fR \fBlogin\fR \fIargument\fR.\|.\|.\|.' See \fBlogin\fR(1) for usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBnewgrp\fR [ \fIargument\fR ]\fR
.ad
.sp .6
.RS 4n
Equivalent to \fBexec\fR \fBnewgrp\fR \fIargument\fR. See \fBnewgrp\fR(1) for usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBpwd\fR\fR
.ad
.sp .6
.RS 4n
Print the current working directory. See \fBpwd\fR(1) for usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBread\fR \fIname\fR .\|.\|.\fR
.ad
.sp .6
.RS 4n
One line is read from the standard input and, using the internal field separator, \fBIFS\fR (normally space or tab), to delimit word boundaries, the first word is assigned to the first \fIname\fR, the second word to the second \fIname\fR, and so forth, with leftover words assigned to the last \fIname\fR. Lines can be continued using \fB\enewline\fR\&. Characters other than \fBnewline\fR can be quoted by preceding them with a backslash. These backslashes are removed before words are assigned to \fInames\fR, and no interpretation is done on the character that follows the backslash. The return code is \fB0\fR, unless an \fBEOF\fR is encountered.
.RE
.sp
.ne 2
.mk
.na
\fB\fBreadonly\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
The given \fIname\fRs are marked \fBreadonly\fR and the values of the these \fIname\fRs can not be changed by subsequent assignment. If no arguments are given, a list of all \fBreadonly\fR names is printed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBreturn\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
Causes a function to exit with the return value specified by \fIn\fR. If \fIn\fR is omitted, the return status is that of the last command executed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBset\fR [ \fB-aefhkntuvx\fR [ \fIargument\fR .\|.\|. ] ]\fR
.ad
.sp .6
.RS 4n
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
Mark variables which are modified or created for export.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-e\fR\fR
.ad
.RS 6n
.rt
Exit immediately if a command exits with a non-zero exit status.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
.rt
Disable file name generation.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-h\fR\fR
.ad
.RS 6n
.rt
Locate and remember function commands as functions are defined (function commands are normally located when the function is executed).
.RE
.sp
.ne 2
.mk
.na
\fB\fB-k\fR\fR
.ad
.RS 6n
.rt
All keyword arguments are placed in the environment for a command, not just those that precede the command name.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
.rt
Read commands but do not execute them.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
Exit after reading and executing one command.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-u\fR\fR
.ad
.RS 6n
.rt
Treat unset variables as an error when substituting.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
.rt
Print shell input lines as they are read.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
Print commands and their arguments as they are executed.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-\fR\fR
.ad
.RS 6n
.rt
Do not change any of the flags; useful in setting \fB$1\fR to \fB\(mi\fR\&.
.RE
Using \fB+\fR rather than \fB\(mi\fR causes these flags to be turned off. These flags can also be used upon invocation of the shell. The current set of flags can be found in \fB$\(mi\fR. The remaining arguments are positional parameters and are assigned, in order, to \fB$1\fR, \fB$2\fR, .\|.\|. If no arguments are given, the values of all names are printed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBshift\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
The positional parameters from \fB$\fR\fIn\fR\fB+1\fR .\|.\|. are renamed \fB$1\fR .\|.\|. . If \fIn\fR is not given, it is assumed to be 1.
.RE
.sp
.ne 2
.mk
.na
\fB\fBstop\fR \fIpid .\|.\|.\fR\fR
.ad
.sp .6
.RS 4n
Halt execution of the process number \fIpid\fR. (see \fBps\fR(1)).
.RE
.sp
.ne 2
.mk
.na
\fB\fBsuspend\fR\fR
.ad
.sp .6
.RS 4n
Stops the execution of the current shell (but not if it is the login shell).
.RE
.sp
.ne 2
.mk
.na
\fB\fBtest\fR\fR
.ad
.sp .6
.RS 4n
Evaluate conditional expressions. See \fBtest\fR(1) for usage and description.
.RE
.sp
.ne 2
.mk
.na
\fB\fBtimes\fR\fR
.ad
.sp .6
.RS 4n
Print the accumulated user and system times for processes run from the shell.
.RE
.sp
.ne 2
.mk
.na
\fB\fBtrap\fR [ \fIargument\fR \fIn\fR [ \fIn2\fR .\|.\|. ]]\fR
.ad
.sp .6
.RS 4n
The command \fIargument\fR is to be read and executed when the shell receives numeric or symbolic signal(s) (\fIn\fR). (\fBNote:\fR \fIargument\fR is scanned once when the trap is set and once when the trap is taken.) Trap commands are executed in order of signal number or corresponding symbolic names. Any attempt to set a trap on a signal that was ignored on entry to the current shell is ineffective. An attempt to trap on signal 11 (memory fault) produces an error. If \fIargument\fR is absent, all trap(s) \fIn\fR are reset to their original values. If \fIargument\fR is the null string, this signal is ignored by the shell and by the commands it invokes. If \fIn\fR is 0, the command \fIargument\fR is executed on exit from the shell. The \fBtrap\fR command with no arguments prints a list of commands associated with each signal number.
.RE
.sp
.ne 2
.mk
.na
\fB\fBtype\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
For each \fIname\fR, indicate how it would be interpreted if used as a command name.
.RE
.sp
.ne 2
.mk
.na
\fB\fBulimit\fR [ [\fB-HS\fR] [\fB-a\fR | \fB-cdfnstv\fR] ]\fR
.ad
.br
.na
\fB\fBulimit\fR [ [\fB-HS\fR] [\fB-c\fR | \fB-d\fR | \fB-f\fR | \fB-n\fR | \fB-s\fR | \fB-t\fR | \fB-v\fR] ] \fBlimit\fR\fR
.ad
.sp .6
.RS 4n
\fBulimit\fR prints or sets hard or soft resource limits. These limits are described in \fBgetrlimit\fR(2).
.sp
If \fIlimit\fR is not present, \fBulimit\fR prints the specified limits. Any number of limits can be printed at one time. The \fB-a\fR option prints all limits.
.sp
If \fIlimit\fR is present, \fBulimit\fR sets the specified limit to \fIlimit\fR. The string \fBunlimited\fR requests that the current limit, if any, be removed. Any user can set a soft limit  to any value less than or equal to  the hard limit. Any user can lower a hard limit.  Only a  user with appropriate privileges can raise or remove a hard limit.  See \fBgetrlimit\fR(2).
.sp
The \fB-H\fR option specifies a hard limit. The \fB-S\fR option specifies a soft limit. If neither option is specified, \fBulimit\fR sets both limits and print the soft limit.
.sp
The following options specify the resource whose limits are to be printed or set. If no option is specified, the file size limit is printed or set.
.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fR
.ad
.RS 6n
.rt
maximum core file size (in 512-byte blocks)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-d\fR\fR
.ad
.RS 6n
.rt
maximum size of data segment or heap (in kbytes)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
.rt
maximum file size (in 512-byte blocks)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
.rt
maximum file descriptor plus 1
.RE
.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.RS 6n
.rt
maximum size of stack segment (in kbytes)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
maximum CPU time (in seconds)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
.rt
maximum size of virtual memory (in kbytes)
.RE
Run the \fBsysdef\fR(1M) command to obtain the maximum possible limits for your system. The values reported are in hexadecimal, but can be translated into decimal numbers using the \fBbc\fR(1) utility. See \fBswap\fR(1M).)
.sp
As an example of \fBulimit\fR, to limit the size of a core file dump to 0 Megabytes, type the following:
.sp
.in +2
.nf
\fBulimit -c 0\fR
.fi
.in -2
.sp
.RE
.sp
.ne 2
.mk
.na
\fB\fBumask\fR [ \fInnn\fR ]\fR
.ad
.sp .6
.RS 4n
The user file-creation mask is set to \fInnn\fR (see \fBumask\fR(1)). If \fInnn\fR is omitted, the current value of the mask is printed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBunset\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
For each \fIname\fR, remove the corresponding variable or function value. The variables \fBPATH\fR, \fBPS1\fR, \fBPS2\fR, \fBMAILCHECK\fR, and \fBIFS\fR cannot be unset.
.RE
.sp
.ne 2
.mk
.na
\fB\fBwait\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
Wait for your background process whose process id is \fIn\fR and report its termination status. If \fIn\fR is omitted, all your shell's currently active background processes are waited for and the return code is zero.
.RE
.SS "Invocation"
.sp
.LP
If the shell is invoked through \fBexec\fR(2) and the first character of argument zero is \fB\(mi\fR, commands are initially read from \fB/etc/profile\fR and from \fB$HOME/.profile\fR, if such files exist. Thereafter, commands are read as described below, which is also the case when the shell is invoked as \fB/usr/bin/sh\fR. The flags below are interpreted by the shell on invocation only. \fBNote:\fR Unless the \fB-c\fR or \fB-s\fR flag is specified, the first argument is assumed to be the name of a file containing commands, and the remaining arguments are passed as positional parameters to that command file:
.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fI\| string\fR\fR
.ad
.RS 15n
.rt
If the \fB-c\fR flag is present commands are read from \fIstring\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-i\fR\fR
.ad
.RS 15n
.rt
If the \fB-i\fR flag is present or if the shell input and output are attached to a terminal, this shell is \fBinteractive\fR. In this case, TERMINATE is ignored (so that \fBkill 0\fR does not kill an interactive shell) and INTERRUPT is caught and ignored (so that \fBwait\fR is interruptible). In all cases, QUIT is ignored by the shell.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 15n
.rt
If the \fB-p\fR flag is present, the shell does not set the effective user and group IDs to the real user and group IDs.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-r\fR\fR
.ad
.RS 15n
.rt
If the \fB-r\fR flag is present the shell is a restricted shell (see \fBrsh\fR(1M)).
.RE
.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.RS 15n
.rt
If the \fB-s\fR flag is present or if no arguments remain, commands are read from the standard input. Any remaining arguments specify the positional parameters. Shell output (except for \fBSpecial Commands\fR) is written to file descriptor 2.
.RE
.sp
.LP
The remaining flags and arguments are described under the \fBset\fR command above.
.SS "Job Control (jsh)"
.sp
.LP
When the shell is invoked as \fBjsh\fR, Job Control is enabled in addition to all of the functionality described previously for \fBsh\fR. Typically, Job Control is enabled for the interactive shell only. Non-interactive shells typically do not benefit from the added functionality of Job Control.
.sp
.LP
With Job Control enabled, every command or pipeline the user enters at the terminal is called a \fIjob\fR. All jobs exist in one of the following states: foreground, background, or stopped. These terms are defined as follows:
.RS +4
.TP
1.
A job in the foreground has read and write access to the controlling terminal.
.RE
.RS +4
.TP
2.
A job in the background is denied read access and has conditional write access to the controlling terminal (see \fBstty\fR(1)).
.RE
.RS +4
.TP
3.
A stopped job is a job that has been placed in a suspended state, usually as a result of a \fBSIGTSTP\fR signal (see \fBsignal.h\fR(3HEAD)).
.RE
.sp
.LP
Every job that the shell starts is assigned a positive integer, called a \fIjob number\fR which is tracked by the shell and is used as an identifier to indicate a specific job. Additionally, the shell keeps track of the \fIcurrent\fR and \fIprevious\fR jobs. The \fIcurrent job\fR is the most recent job to be started or restarted. The \fIprevious job\fR is the first non-current job.
.sp
.LP
The acceptable syntax for a Job Identifier is of the form:
.sp
.LP
\fB%\fR\fIjobid\fR
.sp
.LP
where \fIjobid\fR can be specified in any of the following formats:
.sp
.ne 2
.mk
.na
\fB\fB%\fR or \fB+\fR\fR
.ad
.RS 13n
.rt
For the current job.
.RE
.sp
.ne 2
.mk
.na
\fB\fB\(mi\fR\fR
.ad
.RS 13n
.rt
For the previous job.
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fI<string>\fR\fR
.ad
.RS 13n
.rt
Specify the job for which the command line uniquely contains \fIstring\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fIn\fR\fR
.ad
.RS 13n
.rt
For job number \fIn\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fIpref\fR\fR
.ad
.RS 13n
.rt
Where \fIpref\fR is a unique prefix of the command name. For example, if the command \fBls\fR \fB-l\fR \fIname\fR were running in the background, it could be referred to as \fB%ls\fR. \fIpref\fR cannot contain blanks unless it is quoted.
.RE
.sp
.LP
When Job Control is enabled, the following commands are added to the user's environment to manipulate jobs:
.sp
.ne 2
.mk
.na
\fB\fBbg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
Resumes the execution of a stopped job in the background. If \fB%\fR\fIjobid\fR is omitted the current job is assumed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBfg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
Resumes the execution of a stopped job in the foreground, also moves an executing background job into the foreground. If \fB%\fR\fIjobid\fR is omitted the current job is assumed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBjobs\fR [\fB-p\fR|\fB-l\fR] [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.br
.na
\fB\fBjobs\fR \fB-x\fR \fBcommand\fR [\fIarguments\fR]\fR
.ad
.sp .6
.RS 4n
Reports all jobs that are stopped or executing in the background. If \fB%\fR\fIjobid\fR is omitted, all jobs that are stopped or running in the background is reported. The following options modify/enhance the output of \fBjobs\fR:
.sp
.ne 2
.mk
.na
\fB\fB-l\fR\fR
.ad
.RS 6n
.rt
Report the process group ID and working directory of the jobs.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
.rt
Report only the process group ID of the jobs.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
Replace any \fIjobid\fR found in \fIcommand\fR or \fIarguments\fR with the corresponding process group ID, and then execute \fIcommand\fR passing it \fIarguments\fR.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fBkill\fR [ \fB-signal\fR ] \fB%\fR\fIjobid\fR\fR
.ad
.sp .6
.RS 4n
Builtin version of \fBkill\fR to provide the functionality of the \fBkill\fR command for processes identified with a \fIjobid\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBstop\fR \fB%\fR\fIjobid .\|.\|.\fR\fR
.ad
.sp .6
.RS 4n
Stops the execution of a background job(s).
.RE
.sp
.ne 2
.mk
.na
\fB\fBsuspend\fR\fR
.ad
.sp .6
.RS 4n
Stops the execution of the current shell (but not if it is the login shell).
.RE
.sp
.ne 2
.mk
.na
\fB\fBwait\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
\fBwait\fR builtin accepts a job identifier. If \fB%\fR\fIjobid\fR is omitted \fBwait\fR behaves as described above under \fBSpecial Commands\fR.
.RE
.SS "Large File Behavior"
.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBsh\fR and \fBjsh\fR when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
.SH EXIT STATUS
.sp
.LP
Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status. If the shell is being used non-interactively execution of the shell file is abandoned. Otherwise, the shell returns the exit status of the last command executed (see also the \fBexit\fR command above).
.SS "jsh Only"
.sp
.LP
If the shell is invoked as \fBjsh\fR and an attempt is made to exit the shell while there are stopped jobs, the shell issues one warning:
.sp
.LP
\fBThere are stopped jobs.\fR
.sp
.LP
This is the only message. If another exit attempt is made, and there are still stopped jobs they are sent a \fBSIGHUP\fR signal from the kernel and the shell is exited.
.SH FILES
.sp
.LP
\fB$HOME/.profile\fR
.sp
.LP
\fB/dev/null\fR
.sp
.LP
\fB/etc/profile\fR
.sp
.LP
\fB/tmp/sh*\fR
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.SS "/usr/bin/sh, /usr/bin/jsh"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
CSIEnabled
.TE
.SS "/usr/xpg4/bin/sh"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
CSIEnabled
.TE
.SH SEE ALSO
.sp
.LP
\fBIntro\fR(1), \fBbc\fR(1), \fBecho\fR(1), \fBgetoptcvt\fR(1), \fBkill\fR(1), \fBksh88\fR(1), \fBlogin\fR(1), \fBnewgrp\fR(1), \fBpfsh\fR(1), \fBpfexec\fR(1), \fBps\fR(1), \fBpwd\fR(1), \fBset\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1), \fBtest\fR(1), \fBumask\fR(1), \fBwait\fR(1), \fBrsh\fR(1M), \fBsu\fR(1M), \fBswap\fR(1M), \fBsysdef\fR(1M), \fBdup\fR(2), \fBexec\fR(2), \fBfork\fR(2), \fBgetrlimit\fR(2), \fBpipe\fR(2), \fBulimit\fR(2), \fBsetlocale\fR(3C), \fBsignal.h\fR(3HEAD), \fBpasswd\fR(4), \fBprofile\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBXPG4\fR(5)
.SH WARNINGS
.sp
.LP
The use of \fBsetuid\fR shell scripts is \fBstrongly\fR discouraged.
.SH NOTES
.sp
.LP
Words used for filenames in input/output redirection are not interpreted for filename generation (see \fBFile Name Generation\fR section above). For example, \fBcat file1 >a*\fR createsa file named \fBa*\fR.
.sp
.LP
Because commands in pipelines are run as separate processes, variables set in a pipeline have no effect on the parent shell.
.sp
.LP
If the input or the output of a \fBwhile\fR or \fBuntil\fR loop is redirected, the commands in the loop are run in a sub-shell, and variables set or changed there have no effect on the parent process:
.sp
.in +2
.nf
   lastline=
   while read line
   do
           lastline=$line
   done < /etc/passwd
   echo "lastline=$lastline"       # lastline is empty!
.fi
.in -2
.sp
.sp
.LP
In these cases, the input or output can be redirected by using \fBexec\fR, as in the following example:
.sp
.in +2
.nf
   # Save standard input (file descriptor 0) as file
   # descriptor 3, and redirect standard input from the file
   /etc/passwd:
   exec 3<&0               # save standard input as fd 3
   exec </etc/passwd       # redirect input from file
   lastline=
   while read line
   do
           lastline=$line
   done
   exec 0<&3               # restore standard input
   exec 3<&-               # close file descriptor 3
   echo "$lastline"        # lastline
.fi
.in -2
.sp
.sp
.LP
If you get the error message, "\fBcannot fork, too many processes\fR", try using the \fBwait\fR(1) command to clean up your background processes. If this doesn't help, the system process table is probably full or you have too many active foreground processes. There is a limit to the number of process ids associated with your login, and to the number the system can keep track of.
.sp
.LP
Only the last process in a pipeline can be waited for.
.sp
.LP
If a command is executed, and a command with the same name is installed in a directory in the search path before the directory where the original command was found, the shell continues to \fBexec\fR the original command. Use the \fBhash\fR command to correct this situation.
.sp
.LP
The Bourne shell has a limitation on the effective \fBUID\fR for a process. If this \fBUID\fR is less than 100 (and not equal to the real UID of the process), then the \fBUID\fR is reset to the real UID of the process.
.sp
.LP
Because the shell implements both foreground and background jobs in the same process group, they all receive the same signals, which can lead to unexpected behavior. It is, therefore, recommended that other job control shells be used, especially in an interactive environment.
.sp
.LP
When the shell executes a shell script that attempts to execute a non-existent command interpreter, the shell returns an erroneous diagnostic message that the shell script file does not exist.
components/ksh93/files/sh.1.ja_JP.UTF-8
New file
@@ -0,0 +1,1732 @@
'\" te
.\" Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\"  Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material.
.TH sh 1 "2011 年 7 月 12 日" "SunOS 5.11" "ユーザーコマンド"
.SH 名前
sh, jsh \- 標準シェルとジョブ制御シェルおよびコマンドインタプリタ
.SH 形式
.LP
.nf
\fB/usr/bin/sh\fR  [\fB-acefhiknprstuvx\fR] [\fIargument\fR]...
.fi
.LP
.nf
\fB/usr/xpg4/bin/sh\fR  [\(+- abCefhikmnoprstuvx]
     [\(+- o \fIoption\fR]... [\fB-c\fR \fIstring\fR] [\fIarg\fR]...
.fi
.LP
.nf
\fB/usr/bin/jsh\fR  [\fB-acefhiknprstuvx\fR] [\fIargument\fR]...
.fi
.SH 機能説明
.sp
.LP
\fB/usr/bin/sh\fR ユーティリティは、端末またはファイルから読み取られたコマンドを 実行するコマンドおよびプログラミング言語です。
.sp
.LP
\fB/usr/xpg4/bin/sh\fR ユーティリティーは標準に準拠したシェルです。このユーティリティーは \fBksh88\fR(1) のすべての機能を提供します。ただし、\fBksh\fR(1) で説明しているように、動作が異なる場合を除きます。
.sp
.LP
\fBjsh\fR ユーティリティーは、\fBsh\fR のすべての機能を備えた、かつジョブ制御を可能にするシェルへのインタフェースです (下記の「ジョブ制御」を参照)。\fB\fR
.sp
.LP
シェルへの引数については、後述の「呼び出し」にリストされています。\fB\fR
.SS "定義"
.sp
.LP
ブランク (\fIblank\fR) はタブ (tab) またはスペース (space) です。名前 (\fIname\fR) は \fBASCII\fR 英文字、数字、または下線の並びで、先頭文字は英文字または下線です。パラメータ ( \fIparameter\fR) は、名前、複数、または \fB*\fR、\fB@\fR、\fB#\fR、\fB?\fR、\fB-\fR、\fB$\fR、\fB!\fR などの文字のいずれかです。
.SH 使用法
.SS "コマンド (Commands)"
.sp
.LP
単純コマンド (\fIsimple-command\fR) は、ブランクで区切られた、ブランクでないワードの並びです。先頭のワードは、実行するコマンド名を指定します。\fI\fR\fI\fR\fI\fR残りのワードは、次に述べる場合を除き、呼び出されたコマンドに引数として渡されます。\fI\fRコマンド名は引数 0 として渡されます (\fBexec\fR(2) を参照)。単純コマンドの値 (\fIvalue\fR) は、正常終了した場合は終了ステータス、異常終了した場合は \fB200\fR+\fIstatus\fR (8 進数) です。\fI\fRステータス値の一覧表については、\fBsignal.h\fR(3HEAD) を参照してください。
.sp
.LP
パイプライン (\fIpipeline\fR) は、パイプ (\fB|\fR) で区切られた 1 つ以上のコマンドの並びです。\fI\fR最後のコマンドを除き、各コマンドの標準出力は \fBpipe\fR(2) によってその次のコマンドの標準入力と結合されます。\fI\fR\fI\fR各コマンドは、別々のプロセスとして実行されます。\fI\fRシェルは最後のコマンドが終了するのを待ちます。\fI\fR最後のコマンドの終了ステータスがパイプライン全体の終了ステータスとなります。\fI\fR\fI\fR
.sp
.LP
リスト (\fIlist\fR) は、\fB;\fR、\fB&\fR、\fB&&\fR、または \fB|\||\fR で区切られた 1 つ以上のパイプラインの並びです。その並びの終わりに \fB;\fR または \fB&\fR を記述することもできます。\fI\fRこれら 4 つの記号の中で、\fB;\fR と \fB&\fR の優先度は同じで、\fB&&\fR と \fB|\||\fR の優先度より低くなります。\fB&&\fR と \fB|\||\fR の優先度は同じです。セミコロン (\fB;\fR) によって、直前のパイプラインが順次実行されます。つまりシェルはパイプラインが終了するのを待ってから、セミコロンの後のコマンドを実行します。\fI\fR\fI\fRアンパサンド記号 (\fB&\fR) によって、直前のパイプラインが非同期的に実行されます。つまりシェルはパイプラインが終了するのを待ちません。\fB\fR\fB&&\fR という記号は、直前のパイプラインの終了ステータスが 0 の場合にだけ、後続のリストを実行するものです。反対に (\|\fB|\||\fR) は、終了ステータスが 0 以外の場合にだけ、後続のリストを実行します。\fI\fRコマンドの区切りとして、セミコロンの代わりに任意の数の復帰改行を \fIlist\fR に指定できます。
.sp
.LP
コマンド (\fIcommand\fR) は、単純コマンドまたは次のいずれかです。\fI\fR特に断わりのないかぎり、コマンドが返す値は、そのコマンド中で最後に実行された単純コマンドの値です。\fI\fR
.sp
.ne 2
.mk
.na
\fB\fBfor\fR \fIname\fR [ \fBin\fR \fIword\fR .\|.\|. ] \fBdo\fR \fIlist\fR \fBdone\fR\fR
.ad
.sp .6
.RS 4n
\fBfor\fR コマンドが実行されるたびに、\fIname\fR は \fBin\fR \fIword\fR リストから次に得られる \fIword\fR に設定されます。If \fBin\fR \fIword\fR .\|.\|. を省略すると、\fBfor\fR コマンドは、設定された各定位値パラメータに対して、\fBdo\fR \fIlist\fR を 1 回実行します (後述の「パラメータ置換」を参照)。\fB\fRリストの word がなくなると、実行は終了します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBcase\fR \fIword\fR \fBin\fR [ \fIpattern\fR [ | \fIpattern\fR ] \fB)\fR \fIlist\fR \fB;\|;\fR ] .\|.\|. \fBesac\fR\fR
.ad
.sp .6
.RS 4n
\fBcase\fR コマンドは、\fIword\fR に一致する最初の \fIpattern\fR に対応した \fIlist\fR を実行します。パターンの形式は、ファイル名生成に使用される形式と同じです (「ファイル名の生成」の節を参照)。ただしスラッシュ、先行するドット、およびスラッシュ直後のドットは、明示的に一致しなくてもかまいません。\fB\fR
.RE
.sp
.LP
\fBif\fR \fIlist\fR \fB; then\fR \fIlist\fR \fBelif\fR \fIlist\fR \fB; then\fR \fIlist\fR \fB;\fR ] .\|.\|. [ \fBelse\fR \fI list\fR \fB;\fR ] \fBfi\fR
.sp
.LP
\fIif\fR の後の \fBlist\fR を実行後、\fIlist\fR が 0 の終了ステータスを返すと、最初の \fBthen\fR の後の list を実行します。それ以外の場合、\fBelif\fR の後の \fIlist\fR を実行します。この値が 0 の場合、次の \fBthen\fR の後の \fIlist\fR を実行します。これが失敗すると、\fBelse\fR \fIlist\fR を実行します。\fBelse\fR \fIlist\fR も \fBthen\fR \fIlist\fR も実行しない場合、\fBif\fR コマンドは 0 の終了ステータスを返します。
.sp
.ne 2
.mk
.na
\fB\fBwhile\fR \fIlist\fR \fBdo\fR \fIlist\fR \fBdone\fR\fR
.ad
.RS 27n
.rt
\fBwhile\fR コマンドは、\fBwhile\fR \fIlist\fR を繰り返し実行し、list 中の最後のコマンドの終了ステータスが 0 の場合、\fBdo\fR \fIlist\fR を実行します。それ以外の場合、ループは終了します。\fBdo\fR \fIlist\fR 中のコマンドを実行しない場合、\fBwhile\fR コマンドは 0 の終了ステータスを返します。ループ終了条件の判定を逆にするには、\fBwhile\fR の代わりに \fBuntil\fR を使用します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB(\fR\fIlist\fR\fB)\fR\fR
.ad
.RS 27n
.rt
サブシェル内の \fIlist\fR の実行
.RE
.sp
.ne 2
.mk
.na
\fB\fB{\fR \fIlist\fR\fB;}\fR\fR
.ad
.RS 27n
.rt
現在の (つまり、親) シェル内での \fIlist\fR の実行。記号 \fB{\fR の後にはスペースが必要です。
.RE
.sp
.ne 2
.mk
.na
\fB\fIname\fR \fB(\|) {\fR \fIlist\fR\fB;}\fR\fR
.ad
.RS 27n
.rt
\fIname\fR が参照する関数を定義します。\fB{\fR と \fB}\fR の間のコマンド群 (\fIlist\fR) が関数の本体となります (後述の「関数」参照)。記号 \fB{\fR の後にはスペースが必要です。関数の実行については「実行」の節で後述します。\fB\fR関数の本体が、前述の「コマンド」の節で定義したようなコマンドの場合、\fB{\fR および \fB}\fR は必要ではありません。\fI\fR\fB\fR
.RE
.sp
.LP
下記のワードは、コマンドの最初に現れたとき、およびクォートされずに記述されたときに認識されます。
.sp
.LP
\fBif then else elif fi case esac for while until do done { }\fR
.SS "注釈行"
.sp
.LP
\fB#\fR でワードを始めると、そのワードおよび以降の 復帰改行までの文字がすべて無視されます。
.SS "コマンド置換"
.sp
.LP
シェルは、2 つの逆引用符 (\fB``\fR) で囲まれた文字列からコマンドを読み取ります。これらのコマンドからの標準出力は、ワードの一部または全体として使用できます。標準出力上で最後につく復帰改行は削除されます。
.sp
.LP
文字列は、読み取られる前にはいっさい解釈されません。ただし例外として、文字のエスケープに使用されるバックスラッシュ (\fB\e\fR) の削除だけは行われます。バックスラッシュは、逆引用符 (\fB`\fR) または別のバックスラッシュ (\fB\e\fR) をエスケープするためにも使用され、コマンド文字列の読み取り前に削除されます。逆引用符をエスケープすることにより、コマンド置換のネストが可能になります。コマンド置換が、一対の二重引用符に囲まれている場合 (\fB" .\|.\|.\|` .\|.\|.\|` .\|.\|.\| "\fR)、二重引用符 (\fB\e"\fR) をエスケープするために使用されたバックスラッシュが削除されます。その他の場合は、変更がないままです。
.sp
.LP
復帰改行文字のエスケープにバックスラッシュを用いた場合は (\fB\enewline\fR)、バックスラッシュと復帰改行の両方が削除されます (後述の「クォート」の節の後半を参照)。\fB\fRさらに、ドル記号 (\fB\e$\fR) をエスケープしているバックスラッシュも削除されます。コマンド文字列に対するパラメータの置換は 読み取り前には行われないので、バックスラッシュでドル記号をエスケープしようとしても 無意味です。\fB\e\fR、\fB`\fR、\fB"\fR、復帰改行 (\fBnewline\fR)、および \fB$\fR 以外の文字の前に付くバックスラッシュは、コマンド文字列の読み取り時にもそのまま残ります。
.SS "パラメータ置換"
.sp
.LP
文字 \fB$\fR は、置換可能なパラメータ (\fIparameter\fR) を示します。パラメータには、定位置パラメータとキーワードパラメータの 2 種類があります。パラメータが数字の場合、これは定位置パラメータです。\fI\fR定位置パラメータには、\fBset\fR によって値を割り当てることができます。キーワードパラメータ (変数とも呼ばれる) には、次の記述により値を代入することもできます。
.sp
.LP
\fIname\fR\fB=\fR\fIvalue\fR [ \fIname\fR\fB=\fR\fIvalue\fR ] .\|.\|.
.sp
.LP
\fIvalue\fR に対しては、パターンマッチングは行われません。同じ \fIname\fR を持つ関数と変数が存在することはできません。
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB}\fR\fR
.ad
.RS 25n
.rt
パラメータの値 ( もしあれば ) は置換されます。中括弧が必要となるのは、パラメータの後に、その名前の一部として解釈すべきでない文字、数字、または下線を指定するときだけです。\fI\fR\fIparameter\fR が \fB*\fR または \fB@\fR の場合、\fB$1\fR で始まる定位値パラメータはすべて (スペースで区切られて) 置換されます。パラメータ \fB$0\fR は、シェルが呼び出されたときに、引数 0 から設定されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:\(mi\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
デフォルト値の使用。\fIparameter\fR が未設定または NULL の場合は、\fIword\fR の展開結果に置換されます。それ以外の場合は、\fIparameter\fR の値に置換されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:=\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
デフォルト値の割り当て。\fIparameter\fR が未設定または NULL の場合は、\fIword\fR の展開結果が \fIparameter\fR に割り当てられます。どのような場合でも、\fIparameter\fR の最終的な値に置換されます。この割り当て方法は変数だけに使用可能で、定位置パラメータや特殊パラメータには使用できません。
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:?\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
\fIparameter\fR が NULL 以外の値に設定されている場合、その値に置き換えられます。その他の場合、\fIword\fR を出力しシェルを終了します。\fIword\fR を省略すると、メッセージ "parameter null or not set" が出力されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB${\fR\fIparameter\fR\fB:+\fR\fIword\fR\fB}\fR\fR
.ad
.RS 25n
.rt
\fIparameter\fR が NULL 以外の値に設定されている場合、\fIword\fR に置き換えられます。その他の場合は置換を行いません。
.RE
.sp
.LP
前述にあるように、\fIword\fR は、代入用文字列として使用する場合にだけ評価されます。たとえば次の例では、\fBpwd\fR が実行されるのは、\fBd\fR が設定されていないかあるいは NULL に設定されている場合だけです。
.sp
.in +2
.nf
\fBecho  ${d:\(mi`pwd`}\fR
.fi
.in -2
.sp
.sp
.LP
前述の式からコロン (\fB:\fR) を省略すると、シェルは \fIparameter\fR が設定されているかどうかだけをチェックします。
.sp
.LP
次のパラメータは、シェルが自動的に設定します。
.sp
.ne 2
.mk
.na
\fB\fB#\fR\fR
.ad
.RS 8n
.rt
定位置パラメータ数 (10 進数 )
.RE
.sp
.ne 2
.mk
.na
\fB\fB\(mi\fR\fR
.ad
.RS 8n
.rt
呼び出し時にまたは \fBset\fR コマンドによってシェルに与えられたフラグ
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fR
.ad
.RS 8n
.rt
最後に同期実行されたコマンドが返した 10 進数
.RE
.sp
.ne 2
.mk
.na
\fB\fB$\fR\fR
.ad
.RS 8n
.rt
このシェルのプロセス番号
.RE
.sp
.ne 2
.mk
.na
\fB\fB!\fR\fR
.ad
.RS 8n
.rt
最後に呼び出されたバックグラウンドコマンドのプロセス番号
.RE
.sp
.LP
次のパラメータはシェルによって使用されます。このセクションのパラメータは、環境変数とも呼ばれます。
.sp
.ne 2
.mk
.na
\fB\fBHOME\fR\fR
.ad
.RS 13n
.rt
\fBcd\fR コマンドのデフォルト引数 (ホームディレクトリ)。\fBlogin\fR(1) によって、パスワードファイルから ユーザーのログインディレクトリに設定されます (\fBpasswd\fR(4) を参照)。
.RE
.sp
.ne 2
.mk
.na
\fB\fBPATH\fR\fR
.ad
.RS 13n
.rt
コマンド用検索パス (後述の「実行」を参照)。\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBCDPATH\fR\fR
.ad
.RS 13n
.rt
\fBcd\fR コマンドの検索パスを指定します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAIL\fR\fR
.ad
.RS 13n
.rt
このパラメータにメールファイルの名前がセットされていて、かつ \fBMAILPATH\fR パラメータが設定されていない場合、シェルは指定されたファイルにメールが到着するとユーザーに通知します。\fI\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAILCHECK\fR\fR
.ad
.RS 13n
.rt
このパラメータは、\fBMAILPATH\fR または \fBMAIL\fR パラメータで指定されたファイルへメールが到着したか否かを、シェルが何秒ごとにチェックするかを指定します。デフォルト値は \fB600\fR 秒 (10 分) です。0 が設定された場合、シェルは各プロンプトを出す前にチェックを行います。
.RE
.sp
.ne 2
.mk
.na
\fB\fBMAILPATH\fR\fR
.ad
.RS 13n
.rt
コロン (:) で区切ったファイル名のリスト。このパラメータが設定されると、指定されたいずれかのファイルにメールが到着するたびに、シェルはユーザーに通知します。各ファイル名の後には、% および更新時刻の変更時に出力されるメッセージを指定できます。デフォルトのメッセージは \fByou have mail\fR です。
.RE
.sp
.ne 2
.mk
.na
\fB\fBPS1\fR\fR
.ad
.RS 13n
.rt
1 次プロンプト文字列。デフォルトは " $ \|" です。
.RE
.sp
.ne 2
.mk
.na
\fB\fBPS2\fR\fR
.ad
.RS 13n
.rt
2 次プロンプト文字列。デフォルトは " > \|" です。
.RE
.sp
.ne 2
.mk
.na
\fB\fBIFS\fR\fR
.ad
.RS 13n
.rt
内部フィールドセパレータ。通常はスペース、タブ、および復帰改行です (「ブランクの解釈」を参照)。\fB\fR\fB\fR\fB\fR\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBSHACCT\fR\fR
.ad
.RS 13n
.rt
このパラメータにユーザーが書き込み可能なファイル名が設定された場合、シェルは、実行された各シェルプロシージャーごとのアカウンティングレコードをこのファイルに書き込みます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBSHELL\fR\fR
.ad
.RS 13n
.rt
シェルは、呼び出されると、このパラメータが示す名前が環境中に存在するかを確かめます (「環境」の節を参照)。\fB\fR
.RE
.sp
.LP
\fBsh\fR の実行に影響を与える次の環境変数についての詳細は、\fBenviron\fR(5) を参照してください。\fBLC_CTYPE\fR および \fBLC_MESSAGES\fR。
.sp
.LP
シェルは、\fBPATH\fR、\fBPS1\fR、\fBPS2\fR、\fBMAILCHECK\fR、および \fBIFS\fR にデフォルト値を割り当てます。\fBHOME\fR および \fBMAIL\fR のデフォルト値は \fBlogin\fR(1) で設定します。
.SS "ブランクの解釈"
.sp
.LP
パラメータとコマンドの置換後、置換の結果内でフィールドセパレータ文字 (\fBIFS\fR で発見されるもの) を検索し、その文字が現れた位置で分割します。分割された各々が引数となります。明示的な NULL 引数 (\fB""\fR または \fB\&''\fR) は保持されます。暗示的な NULL 引数 (値を持たないパラメータにより生ずるもの) は削除されます。\fI\fR
.SS "入出力のリダイレクト"
.sp
.LP
シェルが解釈する特殊表記法によって、入出力をリダイレクションできます。以下は、単純コマンド内の任意の位置およびコマンドの前後に指定することができ、起動されたコマンドには引数として引き渡されません。\fI\fR\fI\fR\fB\fR\fB注: \fR \fIword\fR または \fIdigit\fR を使用する前にコマンドとパラメータの置換が発生します。
.sp
.ne 2
.mk
.na
\fB\fB<\fR\fIword\fR\fR
.ad
.RS 13n
.rt
\fIword\fR というファイルを標準入力 ( ファイル記述子 0) として使用します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB>\fR\fIword\fR\fR
.ad
.RS 13n
.rt
\fIword\fR というファイルを標準出力 ( ファイル記述子 1) として使用します。ファイルが存在しない場合は作成します。ファイルが存在していれば、ファイルの長さを 0 にします。
.RE
.sp
.ne 2
.mk
.na
\fB\fB>>\fR\fIword\fR\fR
.ad
.RS 13n
.rt
\fIword\fR というファイルを標準出力として使用します。ファイルが存在する場合、(\fBEOF\fR までシークしたあと) そのファイルに出力を追加します。そうでない場合は、ファイルを作成します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB<\|>\fR\fIword\fR\fR
.ad
.RS 13n
.rt
\fIword\fR というファイルを標準入力として読み書き用に開きます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB<<\fR[\fB-\fR]\fIword\fR\fR
.ad
.RS 13n
.rt
\fIword\fR に対するパラメータおよびコマンド置換が行われた後、その結果得られた \fIword\fR と文字どおり一致する最初の行が現れるまで、または \fBEOF\fR に達するまでシェルへの入力が読み取られます。ただし \fB<<\fR に \fB\(mi\fR が付加されて指定された場合は、以下のようになります。
.RS +4
.TP
1.
まず、シェルへの入力の読み取り前に (ただしパラメータとコマンドの置換後) 、先行するタブを \fIword\fR から取り除きます。\fI\fR
.RE
.RS +4
.TP
2.
読み取ったシェルへの入力の各行を \fIword\fR と比較する前に、その行から先行するタブを取り除きます。そして、
.RE
.RS +4
.TP
3.
その結果得られた \fIword\fR と文字どおり一致する最初の行が現れるまで、または \fBEOF\fR に達するまでシェルへの入力が読み取られます。
.RE
\fIword\fR 中のいずれかの文字がクォートされている場合 (後述の「クォート」を参照) 、シェルへの入力に対して追加処理は行われません。\fB\fR\fIword\fR 中のどの文字もクォートされていない場合は、以下のようになります。
.RS +4
.TP
1.
まずパラメータとコマンドの置換を実施します。
.RE
.RS +4
.TP
2.
エスケープされた復帰改行 ( \fB\enewline\fR ) を削除します。
.RE
.RS +4
.TP
3.
文字 \fB\e\fR、\fB$\fR、および \fB`\fR に対しては、\fB\e\fR を使ってクォートしなければなりません。
.RE
その結果得られるドキュメントが標準入力となります。
.RE
.sp
.ne 2
.mk
.na
\fB\fB<&\fR\fIdigit\fR\fR
.ad
.RS 13n
.rt
ファイル記述子 \fIdigit\fR に対応するファイルを標準入力として使用します。同様に、標準出力の使用には \fB>&\fR\fIdigit\fR を指定します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB<&-\fR\fR
.ad
.RS 13n
.rt
標準入力をクローズします。同様に、標準出力については \fB>&\(mi\fR を使用します。
.RE
.sp
.LP
前述のいずれかの前に数字が付く場合、その値が (デフォルトの \fB0\fR または \fB1\fR の代わりに) 該当ファイルに対応したファイル記述子となります。例:
.sp
.in +2
.nf
\fB\&... 2>&1\fR
.fi
.in -2
.sp
.sp
.LP
この例では、現在ファイル記述子 1 に関連しているファイルに、ファイル記述子 2 を関連付けます。
.sp
.LP
リダイレクションを指定する場合、記述する順序が重要になります。シェルは、リダイレクション記述を左から右へ評価します。例:
.sp
.in +2
.nf
\fB\&... 1>\fIxxx\fR 2>&1\fR
.fi
.in -2
.sp
.sp
.LP
前述の例では、まず \fIxxx\fR というファイルにファイル記述子 1 を関連付けます。次に、ファイル記述子 1 に関連するファイル ( つまり \fIxxx\fR) に、ファイル記述子 2 を関連付けます。リダイレクションの向きが逆であれば、まずファイル記述子 2 を端末に関連付け (ファイルを記述子 1 が既に端末に関連付けられているとみなし)、次にファイル記述子 1 をファイル \fIxxx\fR に関連付けます。
.sp
.LP
最初のページの「コマンド」の節で述べた用語を使って説明すると、次のようになります。コマンドが複数の単純コマンドで構成される場合、リダイレクションは、個々の単純コマンドに対して行う前に、コマンド全体に対して評価されます。\fB\fR\fI\fR\fI\fR\fI\fR\fI\fRすなわち、シェルはまずリスト全体に対してリダイレクションを評価し、次にリスト内の各パイプラインに対して評価し、次にパイプライン内の各コマンドに対して評価し、最後にコマンド内の各単純コマンドに対して評価します。\fI\fR\fI\fR\fI\fR\fI\fR\fI\fR\fI\fR\fI\fR
.sp
.LP
コマンドの後に \fB&\fR を指定すると、コマンドにおけるデフォルトの標準入力は \fB/dev/null\fR という空ファイルになります。その他の場合、コマンドを実行するための環境には、起動側シェルのファイル記述子 ( 入出力指定で変更可能 ) が含まれます。
.SS "ファイル名の生成"
.sp
.LP
コマンド実行に先立ち、各コマンドワードは、\fB*\fR、\fB?\fR、および \fB[\fR を含んでいないかチェックされます。\fI\fRこれらの文字のいずれかがあると、そのワードはパターンとみなされます。\fI\fRこのワードは、パターンと一致する、辞書編集方式の順にソートされたファイル名に置換されます。パターンと一致するファイル名が見つからない場合、ワードは変更されません。ファイル名の先頭のピリオド (\fB\&.\fR) または スラッシュ (\fB/\fR) 直後のピリオドは、明示的に一致しなければなりません (後者の場合はスラッシュ自体をも含む)。\fB\fR
.sp
.ne 2
.mk
.na
\fB\fB*\fR\fR
.ad
.RS 13n
.rt
NULL 文字列を含め、任意の文字列と一致します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fR
.ad
.RS 13n
.rt
任意の単一文字と一致します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB[\fR.\|.\|.\fB]\fR\fR
.ad
.RS 13n
.rt
括弧内のいずれか 1 文字を表します。2 つの 文字を \fB-\fR で区切ると、その間にある任意の文字 (その 2 つの文字も含む) に一致します。先頭の \fB[\fR の次の文字が \fB!\fR である場合、[ ] で囲まれていない任意の文字と一致します。
.RE
.sp
.LP
クォートされているすべての文字 ( 下記「クォート」を参照 ) は、ファイル名において明示的に一致しなければなりませんので、ご注意ください。
.SS "クォート"
.sp
.LP
次の文字はシェルに対しては特別な意味を持ち、クォートしない ( 後述の説明を参照 ) 限り ワードの終わりを表します。
.sp
.LP
\fB;  &  (  )  |  ^  <  >\fR  復帰改行  スペース  タブ
.sp
.LP
これらの文字をクォートする、つまり文字自身を表すには、文字の前にバックスラッシュ (\fB\e\fR) を付けるか、または一対の引用符 (\fB\|'\|'\fR または \fB""\fR) で囲みます。\fI\fR処理中、シェルは、特定の文字をクォートして、それらが特別の意味を持たないようにすることができます。単一の文字をクォートするのに用いるバックスラッシュは、コマンド実行前にワードから取り除かれます。\fB\e\fR と復帰改行との組み合せは、コマンドとパラメータの置換前にワードから取り除かれます。
.sp
.LP
一対の単一引用符 (\fB\|'\|'\fR) で囲まれたすべての文字 ( ただし単一引用符は除く ) は、シェルによってクォートされます。バックスラッシュは、一対の単一引用符で囲まれていれば特殊な意味を持ちません。単一引用符は、一対の二重引用符で囲めばクォートされますが (例 \fB"\|'"\fR)、一対の単一引用符で囲んでもクォートされません。
.sp
.LP
一対の二重引用符 (\fB""\fR) の中では、パラメータとコマンドの置換が実施され、シェルは、その結果をクォートして、ブランクの解釈とファイル名の生成が行われないようにします。\fB$*\fR が一組の二重引用符で囲まれている場合、定位置パラメータは置換され、クォートされ、クォートされたスペースで分けられます (\fB"$1 \|$2\fR \|. \|.\|.\fB"\fR). しかし \fB$@\fR が一組の二重引用符で囲まれている場合は、定位置パラメータは置換され、クォートされ、クォートされていないスペースで分けられます (\fB"$1"\|"$2" \fR \| .\|.\|. )。\fB\e\fR は \fB\e\fR、\fB`\fR、\fB"\fR、\fB,\fR (コンマ)、$ といった文字をクォートします。\fB\e\fR と復帰改行との組み合せは、コマンドとパラメータの置換前にワードから取り除かれます。バックスラッシュが \fB\e\fR、\fB`\fR、\fB"\fR、\fB,\fR (コンマ)、$、および 復帰改行以外の文字の前に付く場合は、バックスラッシュ自体がシェルによってクォートされます。
.SS "プロンプト"
.sp
.LP
シェルは、対話的に使用すると、コマンドを読み取る前に \fBPS1\fR の値によるプロンプトを発行します。復帰改行を入力したあとで、コマンドを完了するためにさらに入力が必要な場合は、2 次プロンプト (\fBPS2\fR の値 ) が出力されます。
.SS "環境"
.sp
.LP
環境 (\fIenvironment\fR) は、通常の引数リストが実行されるプログラムに引き渡される場合と同様の方法で引き渡される、名前と値の対の集まりです (\fBenviron\fR(5) を参照) 。シェルが環境と対話する方法はいくつかあります。シェルは、呼び出されると、環境を走査して、見つけた名前ごとに変数を作成し、対応する値を設定します。ユーザーがこれらのパラメータの値を変更したり 新しいパラメータを作成したときには、\fBexport\fR コマンドを用いてシェルのパラメータを環境に関連付けなければ、これらのパラメータは環境に何の影響も与えません (\fBset\fR \fB-a\fR の説明を参照)。環境からパラメータを削除するには、\fBunset\fR コマンドを使用します。したがって、実行されるコマンドが参照する環境は、シェルが最初に引き継いだ「名前 = 値」の対のうち 変更されていないものから、\fBunset\fR によって削除された対を引き、変更または追加した対をくわえたものです。これらはいずれも \fBexport\fR コマンドで指定する必要があります。
.sp
.LP
単純コマンドの環境は、いくつかのパラメータ代入指定を先頭に付加すれば拡張できます。\fI\fRしたがって、
.sp
.in +2
.nf
\fBTERM=450  \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
および
.sp
.in +2
.nf
\fB(export TERM; TERM=450;   \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
は、\fIcommand\fR が特殊コマンドでなければ、\fIcommand\fR の実行に関するかぎり同じことを意味します。\fIcommand\fR が特殊コマンドの場合、
.sp
.in +2
.nf
\fBTERM=450   \fIcommand\fR\fR
.fi
.in -2
.sp
.sp
.LP
現在のシェル内の \fBTERM\fR 変数を修正します。
.sp
.LP
\fB-k\fR フラグを設定すると、すべてのキーワード引数は環境に格納されます。これらの引数がコマンド名の後に指定された場合も同様です。\fI\fR以下の例では、まず \fBa=b c\fR を、次に \fBc\fR を表示します。
.sp
.in +2
.nf
\fBecho a=b  c
a=b  c
set  \(mik
echo a=b  c
c\fR
.fi
.in -2
.sp
.SS "シグナル"
.sp
.LP
起動されたコマンドに対する \fBINTERRUPT\fR シグナルと \fBQUIT\fR シグナルは、コマンドの後に \fB&\fR が付く場合には無視されます。その他の場合、シグナルは、シェルが親から引き継いだ値を持ちます。ただし、シグナル 11 だけは例外です ( 後述の \fBtrap\fR コマンドの説明を参照 ) 。
.SS "実行"
.sp
.LP
コマンド実行のたびに、前述の コマンドの置換、パラメータの置換、ブランクの解釈、入出力のリダイレクション、およびファイル名の生成が行われます。コマンド名が定義済みの関数名と一致する場合、その関数がシェルプロセスで実行されます ( これと実行時にサブシェルを要求する シェルスクリプトファイルの実行の違いに注意 ) 。定義済み関数名とは一致しないが、後述の特殊コマンドのいずれかと一致するコマンド名の場合、そのコマンドがシェルプロセスで実行されます。\fB\fR
.sp
.LP
定位置パラメータの \fB$1\fR、\fB$2\fR、. \|.\|.  は関数の引数に設定されます。コマンド名が特殊コマンドとも定義済み関数の名前とも一致しない場合、新しいプロセスが作成され、\fBexec\fR(2) を用いてそのコマンドの実行が試みられます。\fB\fR
.sp
.LP
\fBPATH\fR というシェルパラメータは、コマンドを含んでいる ディレクトリの検索パスを定義します。2 つのディレクトリ名は、コロン (\fB:\fR) で区切ります。デフォルトのパスは \fB/usr/bin\fR です。現在のディレクトリは NULL パス名によって指定されます。これは等号の直後、パスリスト内の任意の場所にある 2 つの区切り文字のコロンの間、またはパスリストの最後に記述できます。コマンド名に \fB/\fR が含まれている場合は、検索パスは使用されません。そうでない場合は、パスにおける各ディレクトリに実行可能ファイルがあるか検索します。ファイルが実行権を有するが、それが \fBa.out\fR ファイルでない場合、シェルコマンドの入ったファイルとみなされます。そのファイルを読み取るときは、サブシェルが生成されます。括弧で囲まれたコマンドもサブシェル内で実行されます。
.sp
.LP
シェルは、(あとで不必要な \fIexec\fR を行わなくてもいいように) 検索パス内のコマンドの位置を記憶します。コマンドが相対ディレクトリにあった場合、その位置を 現在のディレクトリの変更のたびに再決定しなければなりません。シェルは、\fBPATH\fR 変数が変更されるか \fBhash\fR \fB-r\fR コマンドが実行されるたびに、記憶していたすべての位置を忘れてしまいます ( 下記参照 ) 。
.SS "特殊コマンド"
.sp
.LP
以下に示す特殊コマンドに対しては、入出力のリダイレクションが可能です。ファイル記述子 1 は、デフォルトの出力位置です。ジョブ制御が可能なときには、さらにいくつかの特殊コマンドがシェル環境に追加されます (「ジョブ制御」の節を参照)。\fB\fR\fB\fR
.sp
.ne 2
.mk
.na
\fB\fB:\fR\fR
.ad
.sp .6
.RS 4n
コマンドは何もせず、実行による影響は何もありません。終了ステータス 0 が返されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB\&.\|\fR \fIfilename\fR\fR
.ad
.sp .6
.RS 4n
\fIfilename\fR からコマンドを読み取り実行し、戻ります。\fBPATH\fR によって指定された検索パスを用いて、\fIfilename\fR を含むディレクトリを探します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBbg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
ジョブ制御が可能なとき、\fBbg\fR コマンドはジョブの操作用に ユーザー環境に追加されます。停止状態のジョブをバックグラウンドで再び実行します。\fB%\fR\fIjobid\fR を省略すると、現在のジョブとみなされます。 (詳細については後述の「ジョブ制御」の節を参照)。\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBbreak\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
\fBfor\fR または \fBwhile\fR ループがあれば抜け出します。\fIn\fR を指定すると、\fIn\fR レベル分ブレークします。
.RE
.sp
.ne 2
.mk
.na
\fB\fBcd\fR [ \fIargument\fR ]\fR
.ad
.sp .6
.RS 4n
現在のディレクトリを \fIargument\fR に変更します。シェルパラメータ \fBHOME\fR は、\fIargument\fR のデフォルト値です。シェルパラメータ \fBCDPATH\fR は、\fIargument\fR を含むディレクトリの検索パスを定義します。2 つのディレクトリ名は、コロン (\fB:\fR) で区切ります。デフォルトのパスは空の文字列です (現在のディレクトリの指定)。\fB\fR\fBなお \fR現在のディレクトリは 空のパス名で指定します。このパス名は、等号の直後か、パスリスト内の区切り文字のコロンの間に指定します。\fIargument\fR の先頭文字が \fB/\fR の場合、検索パスは使用しません。それ以外の場合は、パス中の各ディレクトリで \fIargument\fR を検索します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBchdir\fR [ \fIdir\fR ]\fR
.ad
.sp .6
.RS 4n
\fBchdir\fR はシェルの作業用ディレクトリを \fIdir\fR が示すディレクトリに変更します。引数を指定しないと、そのユーザーのホームディレクトリに変更します。\fIdir\fR が現在のディレクトリからは見つからない相対パス名の場合、変数 \fBCDPATH\fR 環境内のディレクトリリストを検索します。\fIdir\fR が \fB/\fR で始まる値を持つシェル変数の名前である場合、その変数の値が示すディレクトリに変更します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBcontinue\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
\fBfor\fR または \fBwhile\fR ループの次の繰り返しを実行します。\fIn\fR を指定すると、\fIn\fR 番目のループから実行します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBecho\fR [ \fIarguments\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
\fIarguments\fR の文字列が スペース文字に区切られて、シェルの標準出力に書かれます。使用法と説明については \fBecho\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBeval\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
引数をシェルへの入力として読み取り、生成されるコマンドを実行します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBexec\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
このシェルの代わりに、引数で指定されたコマンドを (新規プロセスは生成せずに) 実行します。入出力引数が指定可能で、その他の引数が指定されない場合は、これによってシェルの入出力が変更されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBexit\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
呼び出し元のシェルまたはシェルスクリプトを \fIn\fR で指定した終了ステータスで終了させます。\fIn\fR を省略すると、最後に実行されたコマンドの終了ステータスがシェルの終了ステータスになります (\fBEOF\fR によっても、シェルは終了します)。
.RE
.sp
.ne 2
.mk
.na
\fB\fBexport\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
指定された \fIname\fR 群に対し、後で実行されるコマンドの環境へ自動的にエクスポートされるようにマークを付けます。\fI\fR引数を省略すると、現在のシェル実行中にエクスポートのマークが付けられた 変数名を一覧表示します。親シェルからエクスポートされた変数名は、現在のシェル実行中に再びエクスポートされた場合にだけ 一覧表示されます。関数名はエクスポートされません。\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBfg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
ジョブ制御が可能なとき、\fBfg\fR はジョブの操作用に ユーザー環境に追加されます。このコマンドは、フォアグラウンド状態の停止ジョブを再び実行します。また、実行中のバックグラウンドジョブをフォアグラウンドへ移します。\fB%\fR\fIjobid\fR を省略すると、現在のジョブとみなされます。(詳細については後述の「ジョブ制御」の節を参照。)\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBgetopts\fR\fR
.ad
.sp .6
.RS 4n
コマンドシンタクス標準のサポート用に、シェルスクリプト内で使用されるコマンドです (\fBIntro\fR(1) を参照)。このコマンドは、定位置パラメータを構文解析し、オプションの正当性をチェックします。使用法と説明については、\fBgetoptcvt\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBhash\fR [ \fB-r\fR ] [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
シェルは、各 \fIname\fR ごとに、それが示すコマンドの検索パス内の位置を決定し、記憶します。\fI\fR\fB-r\fR オプションを指定すると、シェルは記憶したすべての位置を忘れます。引数をまったく指定しないと、記憶されたコマンドに関する情報が表示されます。この出力表示において、\fIhits\fR はシェルプロセスによってコマンドが呼び出された回数を表します。\fIcost\fR は、検索パスのコマンドを見つけるのに必要な作業です。コマンドが検索パスの「相対」ディレクトリにある場合、そのディレクトリの変更後にそのコマンドが格納された位置が再計算されます。これが行われるコマンドに対しては、\fIhits\fR 情報の隣にアスタリスク (\fB*\fR) が示されます。\fICost\fR の値は、再計算が行われるたびに増加されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBjobs\fR [\fB\fR\fB-p\fR\fB|\fR\fB-l\fR] [\fB%\fR\fIjobid ...\fR]\fR
.ad
.br
.na
\fB\fBjobs\fR \fB-x\fR \fIcommand\fR [\fIarguments\fR] \fR
.ad
.sp .6
.RS 4n
停止中またはバックグラウンドで実行中の すべてのジョブを報告します。\fB%\fR\fIjobid\fR を省略すると、停止中またはバックグラウンドで稼動中のすべてのジョブが報告されます。(詳細については後述の「ジョブ制御」の節を参照。)\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBkill\fR [ \fB-\fR\fIsig\fR ] \fB%\fR\fIjob\fR .\|.\|.\fR
.ad
.br
.na
\fB\fBkill\fR \fB-l\fR\fR
.ad
.sp .6
.RS 4n
\fBTERM\fR (終了) シグナルまたは指定されたシグナルのいずれかを、指定されたジョブまたはプロセスに送信します。シグナルは、番号または名前 (\fBsignal.h\fR(3HEAD) に示されるもので、ただし「SIG」という接頭辞を取り除いたもの (\fBCHLD\fR と名付けられる \fBSIGCHD\fR 以外)) で指定します。送信するシグナルが \fBTERM\fR (終了) または \fBHUP\fR (ハングアップ) の場合、停止中のジョブまたはプロセスには \fBCONT\fR (継続) シグナルを送信します。\fIjob\fR という引数は、活動中のジョブではないプロセスのプロセス ID を指定することもできます。後述の「ジョブ制御」の節を参照してください。\fB\fR\fI\fR第 2 の形式の \fBkill\fR \fB-l\fR は、シグナル番号とシグナル名をリスト表示します。(\fBkill\fR(1) 参照)。
.RE
.sp
.ne 2
.mk
.na
\fB\fBlogin\fR [ \fIargument\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
`\fBexec\fR \fBlogin\fR \fIargument\fR.\|.\|.\|' と同機能です。使用法と説明については、\fBlogin\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBnewgrp\fR [ \fIargument\fR ]\fR
.ad
.sp .6
.RS 4n
\fBexec\fR \fBnewgrp\fR\fI argument\fR と同機能です。使用法と説明については、\fBnewgrp\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBpwd\fR\fR
.ad
.sp .6
.RS 4n
現在の作業用ディレクトリを表示します。使用法と説明については、\fBpwd\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBread\fR \fIname\fR .\|.\|.\fR
.ad
.sp .6
.RS 4n
標準入力から 1 行を読み取り、内部フィールドセパレータの \fBIFS\fR (通常はスペースまたはタブ) を用いてワード境界を区切り、最初のワードを最初の \fIname\fR に割り当て、2 番目のワードを 2 番目の \fIname\fR に割り当て、続くワードも順次割り当てます。残ったワードは最後の \fIname\fR に割り当てます。\fB\e \fR に続いて復帰改行を入力すれば、行を継続できます。復帰改行以外の文字の前にバックスラッシュを付加すれば、その文字をクォートできます。\fB\fRこのバックスラッシュは、ワードが \fIname\fR に割り当てられる前に削除され、バックスラッシュの後に位置する文字は解釈されません。\fBEOF\fR に到達した場合を除き、リターンコードは \fB0\fR となります。
.RE
.sp
.ne 2
.mk
.na
\fB\fBreadonly\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
指定された各 \fIname\fR に「読み取り専用」のマークを付け、これらの名前が後続の割り当てでは変更できないようにします。\fB\fR\fI\fR引数を省略すると、読み取り専用と指定された名前がすべて一覧表示されます。\fB\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fBreturn\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
関数を、\fIn\fR が示すリターンステータスで終了させます。\fIn\fR を省略すると、リターンステータスは最後に実行された コマンドのリターンステータスになります。
.RE
.sp
.ne 2
.mk
.na
\fB\fBset\fR [ \fB-aefhkntuvx\fR [ \fIargument\fR .\|.\|. ] ]\fR
.ad
.sp .6
.RS 4n
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
エクスポート用に修正または作成された変数にマークを付けます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-e\fR\fR
.ad
.RS 6n
.rt
コマンドが 0 以外の終了ステータスで終了した場合、直ちに終了します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
.rt
ファイル名を生成しないようにします。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-h\fR\fR
.ad
.RS 6n
.rt
関数の定義時に、関数コマンドを検索しその位置を記憶します ( 通常、関数コマンドは関数実行時に検索されます ) 。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-k\fR\fR
.ad
.RS 6n
.rt
コマンド名の前にあるキーワード引数だけでなく、すべてのキーワード引数がコマンド用の環境に置かれます。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
.rt
コマンドを読み取るが、実行しません。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
1 つのコマンドを読み取り、実行し、終了します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-u\fR\fR
.ad
.RS 6n
.rt
未設定の変数を置換時にエラーとして扱います。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
.rt
シェルへの入力行の読み取り時に、その内容を表示出力します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
コマンドおよび引数の実行時に、その内容を表示出力します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-\fR\fR
.ad
.RS 6n
.rt
どのフラグも変更しません。\fB$1\fR に \fB-\fR を設定する際に便利です。
.RE
\fB-\fR の代わりに \fB+\fR を使用すると、 これらのフラグは無効になります。これらのフラグはシェル起動時にも使用できます。現在セットされているフラグは、\fB$-\fR で見つけられます。残りの引数は定位置パラメータで、次の順に割り当てられます。\fB$1\fR、\fB$2\fR、. \|.\|. 引数が指定されない場合、すべての名前の値が出力されます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBshift\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
\fB$\fR\fIn\fR\fB+1\fR .\|.\|. から始まる一連の定位置パラメータを、次の名前に変更します。\fB$1\fR .\|.\|. 。 \fIn\fR を省略すると、1 と見なされます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBstop\fR \fIpid .\|.\|.\fR\fR
.ad
.sp .6
.RS 4n
\fIpid\fR (プロセス ID 番号) の実行を停止します (\fBps\fR(1) を参照)。
.RE
.sp
.ne 2
.mk
.na
\fB\fBsuspend\fR\fR
.ad
.sp .6
.RS 4n
現在のシェルがログインシェルでない場合、その実行を中断します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBtest\fR\fR
.ad
.sp .6
.RS 4n
条件式を評価します。使用法と説明については、\fBtest\fR(1) を参照してください。
.RE
.sp
.ne 2
.mk
.na
\fB\fBtimes\fR\fR
.ad
.sp .6
.RS 4n
シェルから実行されたプロセスの、 ユーザー時間およびシステム時間の累計値を表示します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBtrap\fR [ \fIargument\fR \fIn\fR [ \fIn2\fR .\|.\|. ]]\fR
.ad
.sp .6
.RS 4n
\fIargument\fR が示すコマンドを、シェルが数値または記号シグナル (\fIn\fR) を受信した時に読み取り実行します。(\fB注:\fR \fIargument\fR は、トラップ設定時に一度、トラップ取り出し時に一度検索されます。)トラップコマンドは、シグナル番号または対応するシンボリック名の順序で実行されます。現在のシェルへの入力時に無視されたシグナルにトラップを 設定しようとしても無効となります。シグナル 11 ( メモリフォールト ) にトラップを指定しようとすると、エラーになります。\fIargument\fR を省略すると、すべてのトラップ \fIn\fR は元の値に再設定されます。\fIargument\fR が NULL 文字列の場合、シェルおよびシェルが呼び出したコマンドは、このシグナルを無視します。\fIn\fR が 0 の場合、\fIargument\fR が示すコマンドはシェル終了時に実行されます。引数なしの \fBtrap\fR コマンドは、コマンドの一覧を各々が対応しているシグナル番号とともに表示します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBtype\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
各 \fIname\fR ごとに、コマンド名として使用される場合に どのように解釈されるかを指示します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBulimit\fR [ [\fB-HS\fR] [\fB-a\fR | \fB-cdfnstv\fR] ]\fR
.ad
.br
.na
\fB\fBulimit\fR [ [\fB-HS\fR] [\fB-c\fR | \fB-d\fR | \fB-f\fR | \fB-n\fR | \fB-s\fR | \fB-t\fR | \fB- v\fR] ] \fBlimit\fR\fR
.ad
.sp .6
.RS 4n
\fBulimit\fR は、リソースの強い制限値または弱い制限値を 表示または設定します。これらの制限値については \fBgetrlimit\fR(2) の説明を参照してください。
.sp
\fIlimit\fR 引数を省略すると、\fBulimit\fR は指定されている制限値を表示します。制限値は一度にいくつでも表示できます。\fB-a\fR オプションは制限値すべてを表示します。
.sp
\fIlimit\fR 引数を指定すると、\fBulimit\fR は指定されたフラグに対応する制限値をその引数の値に設定します。\fI\fR文字列 \fBunlimited\fR は、現在の制限値 (ある場合) の削除を要求します。ユーザーはだれでも、強い制限値以下の値に弱い制限値を設定できます。ユーザーはだれでも、強い制限値を下げることができます。適切な特権を持ったユーザーだけが、強い制限値を上げたり、削除したりできます。\fBgetrlimit\fR(2) を参照してください。
.sp
\fB-H\fR オプションは強い制限値を表し、\fB-S\fR オプションは弱い制限値を表します。どちらのオプションも指定しない場合、\fBulimit\fR は両方の制限値を設定し、弱い制限値を表示します。
.sp
次のオプションは、制限値を表示または設定するリソースを指定します。オプションを一切指定しないと、ファイルサイズ限界値を表示または設定します。
.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fR
.ad
.RS 6n
.rt
最大 core ファイルサイズ (512 バイトブロック単位)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-d\fR\fR
.ad
.RS 6n
.rt
データセグメントまたはヒープの最大サイズ (K バイト単位)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-f\fR\fR
.ad
.RS 6n
.rt
最大ファイルサイズ (512 バイトブロック単位)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
.rt
最大ファイル記述子プラス 1
.RE
.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.RS 6n
.rt
スタックセグメントの最大サイズ (K バイト単位)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-t\fR\fR
.ad
.RS 6n
.rt
最大 CPU 時間 (秒単位)
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
.rt
仮想メモリーの最大サイズ (K バイト単位)
.RE
システムで利用可能な最大上限値を 調べるには \fBsysdef\fR(1M) コマンドを実行してください。表示される値は 16 進数ですが、\fBbc\fR(1) コマンドを使って 10 進数に変換できます。\fBswap\fR(1M) を参照してください。)
.sp
たとえば、0M バイトにコアファイルダンプのサイズを制限するには次のように入力します。\fB\fR
.sp
.in +2
.nf
\fBulimit -c 0\fR
.fi
.in -2
.sp
.RE
.sp
.ne 2
.mk
.na
\fB\fBumask\fR [ \fInnn\fR ]\fR
.ad
.sp .6
.RS 4n
ユーザーファイル作成マスクを \fInnn\fR が示す値に設定します (\fBumask\fR(1) を参照)。\fInnn\fR を省略すると、マスクの現在の値を出力します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBunset\fR [ \fIname\fR .\|.\|. ]\fR
.ad
.sp .6
.RS 4n
\fIname\fR ごとに、対応する変数または関数値を削除します。変数 \fBPATH\fR、\fBPS1\fR、\fBPS2\fR、\fBMAILCHECK\fR、および \fBIFS\fR は設定解除できません。
.RE
.sp
.ne 2
.mk
.na
\fB\fBwait\fR [ \fIn\fR ]\fR
.ad
.sp .6
.RS 4n
当該ユーザーのバックグラウンドプロセスのうち ID が \fIn\fR のプロセスを待ち、その終了ステータスを報告します。\fIn\fR が省略された場合、当該ユーザーの現在活動中のすべてのバックグラウンドプロセスを待ち、リターンコードは 0 になります。
.RE
.SS "呼び出し"
.sp
.LP
\fBexec\fR(2) を介してシェルが呼び出される場合で、引数 0 の先頭文字が \fB\(mi\fR のとき、コマンドは、まず \fB/etc/profile\fR から読み込まれ、次に \fB$HOME/.profile\fR から読み込まれます (これらのファイルがある場合)。その後、コマンドは後述のように読み込まれます。シェルが \fB/usr/bin/sh\fR として呼び出される場合にも、このようになります。以下に述べるフラグは、呼び出し時にのみ、シェルによって解釈されます。\fBなお \fR \fB-c\fR または \fB-s\fR フラグが指定されないかぎり、先頭引数はコマンドを含むファイルの名前であるとみなされ、残りの引数は定位置パラメータとして そのコマンドファイルに引き渡されます。
.sp
.ne 2
.mk
.na
\fB\fB-c\fR\fI\| string\fR\fR
.ad
.RS 15n
.rt
このフラグが指定されると、\fIstring\fR からコマンドを読み取ります。\fB-\fR
.RE
.sp
.ne 2
.mk
.na
\fB\fB-i\fR\fR
.ad
.RS 15n
.rt
このフラグが指定された場合あるいはシェル入出力が端末に接続されている場合、このシェルは対話型となります。\fB-\fR\fB\fRこの場合、\fBkill 0\fR が対話型シェルを終了しないように TERM を無視し、\fBwait\fR が割り込み可能になるように INTERRUPT を捕え、無視します。いずれの場合も、シェルは QUIT を無視します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 15n
.rt
\fB-p\fR フラグが指定されると、シェルは実効ユーザーおよびグループ ID に、実ユーザーおよびグループ ID を設定しません。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-r\fR\fR
.ad
.RS 15n
.rt
\fB-r\fR フラグを指定すると、シェルは制限付きシェルになります (\fBrsh\fR(1M) を参照)。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-s\fR\fR
.ad
.RS 15n
.rt
このフラグが指定された場合または引数が残っていない場合、標準入力からコマンドを読み取ります。\fB-\fR引数が残っていれば、それらは定位置パラメータを指定します。前述の特殊コマンドの出力を除くシェル出力は、ファイル記述子 2 に書き込まれます。\fB\fR
.RE
.sp
.LP
他のフラグと引数については、前述の \fBset\fR コマンドの箇所で説明されています。
.SS "ジョブ制御 (jsh)"
.sp
.LP
シェルを \fBjsh\fR として呼び出すと、\fBsh\fR の説明で述べたすべての機能に加えて、ジョブ制御が可能になります。通常、ジョブ制御は対話型シェルに対してだけ可能です。非対話型シェルは、ジョブ制御の機能が追加されても、その恩恵を受けないのが通常です。
.sp
.LP
ジョブ制御が可能な場合、ユーザーが端末から入力したコマンドまたはパイプラインは、すべてジョブ ( \fIjob\fR) と呼ばれます。どのジョブも、必ず次のいずれかの状態にあります。 フォアグラウンド、バックグラウンド、または停止です。これらの用語の定義を次に示します。
.RS +4
.TP
1.
フォアグラウンド状態にある ジョブは、制御している端末への読み取り および書き込み権を持っています。
.RE
.RS +4
.TP
2.
バックグラウンド状態にあるジョブは、制御している端末への読み取り権を拒否されていますが、条件付き書き込み権は持っています (\fBstty\fR(1) を参照)。
.RE
.RS +4
.TP
3.
停止ジョブは保留状態に置かれた ジョブであり、通常は \fBSIGTSTP\fR シグナルにより、この状態になります (\fBsignal.h\fR(3HEAD) を参照)。
.RE
.sp
.LP
シェルが起動するすべてのジョブには、ジョブ番号 (\fIjob number\fR) と呼ばれる正の整数が割り当てられます。シェルはこの番号を把握し、特定のジョブを示す識別子として使用します。また、シェルは現在 (\fIcurrent\fR) および直前 (\fIprevious\fR) のジョブも把握しています。現在のジョブとは、最後に起動または再起動されたジョブです。\fI\fR前回のジョブとは、その直前のジョブです。\fI\fR
.sp
.LP
ジョブ識別子の正しい構文は次のような形式です。
.sp
.LP
\fB%\fR\fIjobid\fR
.sp
.LP
このうち \fIjobid\fR は、次のいずれかの形式で指定できます。
.sp
.ne 2
.mk
.na
\fB\fB%\fR または \fB+\fR\fR
.ad
.RS 17n
.rt
現在のジョブ
.RE
.sp
.ne 2
.mk
.na
\fB\fB\(mi\fR\fR
.ad
.RS 17n
.rt
前回のジョブ
.RE
.sp
.ne 2
.mk
.na
\fB\fB?\fR\fI<string>\fR\fR
.ad
.RS 17n
.rt
コマンド行が \fIstring\fR を含んでいるジョブ
.RE
.sp
.ne 2
.mk
.na
\fB\fIn\fR\fR
.ad
.RS 17n
.rt
ジョブ番号が \fIn\fR のジョブ
.RE
.sp
.ne 2
.mk
.na
\fB\fIpref\fR\fR
.ad
.RS 17n
.rt
コマンド名の先頭が \fIpref\fR のコマンド。たとえば \fBls\fR \fB-l\fR \fIname\fR がバックグラウンドで実行中だった場合、\fB%ls\fR と指定すればこのコマンドを示すことができます。\fIpref\fR は、クォートしない限り、ブランクを含めることができません。
.RE
.sp
.LP
ジョブ制御が可能なとき、ジョブの操作用に 次のコマンドがユーザー環境に追加されます。
.sp
.ne 2
.mk
.na
\fB\fBbg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
停止状態のジョブをバックグラウンドで再び実行します。\fB%\fR\fIjobid\fR を省略すると、現在のジョブとみなされます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBfg\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
停止状態のジョブをフォアグラウンドで再び実行します。また、実行中のバックグラウンドジョブをフォアグラウンドへ移します。\fB%\fR\fIjobid\fR を省略すると、現在のジョブとみなされます。
.RE
.sp
.ne 2
.mk
.na
\fB\fBjobs\fR [\fB-p\fR|\fB-l\fR] [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.br
.na
\fB\fBjobs\fR \fB-x\fR \fBcommand\fR [\fIarguments\fR]\fR
.ad
.sp .6
.RS 4n
停止中またはバックグラウンドで実行中の すべてのジョブを報告します。\fB%\fR\fIjobid\fR を省略すると、停止中またはバックグラウンドで稼動中のすべてのジョブが報告されます。次のオプションは、\fBjobs\fR の出力を変更または拡張するために使用します。
.sp
.ne 2
.mk
.na
\fB\fB-l\fR\fR
.ad
.RS 6n
.rt
ジョブのプロセスグループ ID および作業ディレクトリを報告します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 6n
.rt
ジョブのプロセスグループ ID のみを報告します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-x\fR\fR
.ad
.RS 6n
.rt
コマンドまたは引数中に見つかった \fIjobid\fR を、対応するプロセスグループ ID に置き換え、コマンドに引数を渡して実行します。\fI\fR\fI\fR\fI\fR\fI\fR
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fBkill\fR [ \fB-signal\fR ] \fB%\fR\fIjobid\fR\fR
.ad
.sp .6
.RS 4n
\fBkill\fR コマンドの組み込みバージョン。\fBjobid\fR で示すプロセスに対して \fIkill\fR コマンドの機能を提供します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBstop\fR \fB%\fR\fIjobid .\|.\|.\fR\fR
.ad
.sp .6
.RS 4n
バックグラウンドジョブの実行を停止します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBsuspend\fR\fR
.ad
.sp .6
.RS 4n
現在のシェルがログインシェルでない場合、その実行を中断します。
.RE
.sp
.ne 2
.mk
.na
\fB\fBwait\fR [\fB%\fR\fIjobid .\|.\|.\fR]\fR
.ad
.sp .6
.RS 4n
\fBwait\fR コマンドの組み込みバージョンで、ジョブ識別子の指定を受け入れます。\fB%\fR\fIjobid\fR が省略された場合、\fBwait\fR は、前述の「特殊コマンド」で説明したように動作します。\fB\fR
.RE
.SS "大規模ファイルの動作"
.sp
.LP
ファイルが 2G バイト (2^31 バイト) 以上ある場合の \fBsh\fR と \fBjsh\fR の動作については、\fBlargefile\fR(5) を参照してください。
.SH 終了ステータス
.sp
.LP
構文エラーなどのエラーを検出すると、シェルは 0 以外の終了ステータスを返します。シェルを非対話型で使用している場合、シェルファイルの実行は中止されます。そうでない場合は、シェルは最後に実行されたコマンドの 終了ステータスを返します ( 前述の \fBexit\fR コマンドの説明を参照 ) 。
.SS "jsh のみ"
.sp
.LP
シェルが \fBjsh\fR として呼び出された場合、停止ジョブがあるのにシェルを終了させようとすると、シェルは次のような警告を出します。
.sp
.LP
\fBThere are stopped jobs.\fR
.sp
.LP
これが唯一のメッセージです。もう一度終了が試みられ、停止ジョブがまだ存在している場合、これらのジョブにカーネルから \fBSIGHUP\fR シグナルが送られ、シェルは終了します。
.SH ファイル
.sp
.LP
\fB$HOME/.profile\fR
.sp
.LP
\fB/dev/null\fR
.sp
.LP
\fB/etc/profile\fR
.sp
.LP
\fB/tmp/sh*\fR
.SH 属性
.sp
.LP
属性についての詳細は、\fBattributes\fR(5) を参照してください。
.SS "/usr/bin/sh, /usr/bin/jsh"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性タイプ属性値
_
使用条件system/core-os
_
CSI有効
.TE
.SS "/usr/xpg4/bin/sh"
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性タイプ属性値
_
使用条件system/core-os
_
CSI有効
.TE
.SH 関連項目
.sp
.LP
\fBIntro\fR(1), \fBbc\fR(1), \fBecho\fR(1), \fBgetoptcvt\fR(1), \fBkill\fR(1), \fBksh88\fR(1), \fBlogin\fR(1), \fBnewgrp\fR(1), \fBpfsh\fR(1), \fBpfexec\fR(1), \fBps\fR(1), \fBpwd\fR(1), \fBset\fR(1), \fBshell_builtins\fR(1), \fBstty\fR(1), \fBtest\fR(1), \fBumask\fR(1), \fBwait\fR(1), \fBrsh\fR(1M), \fBsu\fR(1M), \fBswap\fR(1M), \fBsysdef\fR(1M), \fBdup\fR(2), \fBexec\fR(2), \fBfork\fR(2), \fBgetrlimit\fR(2), \fBpipe\fR(2), \fBulimit\fR(2), \fBsetlocale\fR(3C), \fBsignal.h\fR(3HEAD), \fBpasswd\fR(4), \fBprofile\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBXPG4\fR(5)
.SH 警告
.sp
.LP
シェルスクリプトを \fBsetuid\fR して使用することは避けてください。\fB\fR
.SH 注意事項
.sp
.LP
入出力のリダイレクションでファイル名に使用されたワードは、ファイル名生成では解釈されません (前述の「ファイル名の生成」の節を参照)。\fB\fRたとえば \fBcat file1 >a*\fR という指定は、\fBa*\fR という名前のファイルを生成します。
.sp
.LP
パイプラインにあるコマンド群は それぞれ別個のプロセスとして稼動するので、パイプラインに設定された変数は親シェルには何の影響も与えません。
.sp
.LP
\fBwhile\fR ループまたは \fBuntil\fR ループの入力または出力をリダイレクトする場合、ループ内のコマンドはサブシェルで実行されます。サブシェル内で設定または変更された変数は、親プロセスでは効力を失います。
.sp
.in +2
.nf
   lastline=
   while read line
   do
           lastline=$line
   done < /etc/passwd
   echo "lastline=$lastline"       # lastline is empty!
.fi
.in -2
.sp
.sp
.LP
このような場合、入力または出力をリダイレクトするには、次の例のように \fBexec\fR を使用します。
.sp
.in +2
.nf
   # Save standard input (file descriptor 0) as file
   # descriptor 3, and redirect standard input from the file
   /etc/passwd:
   exec 3<&0               # save standard input as fd 3
   exec </etc/passwd       # redirect input from file
   lastline=
   while read line
   do
           lastline=$line
   done
   exec 0<&3               # restore standard input
   exec 3<&-               # close file descriptor 3
   echo "$lastline"        # lastline
.fi
.in -2
.sp
.sp
.LP
\fBcannot fork, too many processes\fR というエラーメッセージを受け取った場合には、\fBwait\fR(1) コマンドを用いてユーザーのバックグラウンドプロセスをクリーンアップしてください。これを行なっても問題が解決しない場合には、システムのプロセステーブルが一杯になっていること、または実行中のフォアグラウンドプロセスの数が多すぎることが考えられます。ユーザーログインに結合するプロセス ID の数、およびシステムが把握できる数には 限度があります。
.sp
.LP
パイプラインの最後のプロセスだけが、待つ対象になり得ます。
.sp
.LP
あるコマンドを実行し、そのあとで同一名のコマンドが、検索パスにおいて元のコマンドがあるディレクトリの前に位置するディレクトリにインストールされた場合、シェルは元のコマンドの方を実行し続けます。\fB\fR新しい方のコマンドを実行させたければ、\fBhash\fR コマンドを使用してください。
.sp
.LP
Bourne シェルにはプロセスの実効ユーザー \fBID\fR に対して制限があります。このユーザー ID が 100 よりも小さい (さらにプロセスの実ユーザー ID と同等ではない) 場合には、ユーザー ID はプロセスの実ユーザー ID にリセットされます。\fB\fR\fB\fR
.sp
.LP
同じプロセスグループで フォアグラウンドジョブと バックグラウンドジョブの両方を シェルが実行しているため、ジョブは同じシグナルを受け取り、予期しない結果を招くことがあります。したがって、特に対話型のシェルを動作している場合は、他のジョブ制御のシェルを使用することを おすすめします。
.sp
.LP
存在しないコマンドのインタプリタを実行しようとするシェルスクリプトを、シェルが処理した場合、シェルはシェルスクリプトが存在しないという間違った診断メッセージを 返します。
components/ksh93/files/shcomp.1
New file
@@ -0,0 +1,160 @@
'\" te
.\" Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
.TH shcomp 1 "12 Jul 2011" "SunOS 5.11" "User Commands"
.SH NAME
shcomp \- compile a ksh shell script
.SH SYNOPSIS
.LP
.nf
\fBshcomp\fR [\fB-nv\fR] [\fIinfile\fR [\fIoutfile\fR]]
.fi
.LP
.nf
\fBshcomp\fR \fB-D\fR [\fIinfile\fR [\fIoutfile\fR]]
.fi
.SH DESCRIPTION
.sp
.LP
If the \fB-D\fR option is not specified, \fBshcomp\fR takes a shell script, \fIinfile\fR, and creates a binary format file, \fIoutfile\fR, that \fBksh\fR reads and executes with the same effect as the original script.
.sp
.LP
Aliases are processed as the script is read. Alias definitions whose value requires variable expansion will not work correctly.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-D\fR\fR
.ad
.br
.na
\fB\fB--dictionary\fR\fR
.ad
.RS 16n
.rt
Generate a list of strings that need to be placed in a message catalog for internationalization.
.sp
With this option, all double quoted strings that are preceded by \fB$\fR are printed, one literal per line. A literal \fB$"foo"\fR prints \fB"foo"\fR in the output. These are the messages that need to be translated to locale specific versions for internationalization.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.br
.na
\fB\fB--noexec\fR\fR
.ad
.RS 16n
.rt
Display warning messages for obsolete or non-conforming constructs.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.br
.na
\fB\fB--verbose\fR\fR
.ad
.RS 16n
.rt
Display input from \fIinfile\fR onto standard error as it reads it.
.RE
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.mk
.na
\fB\fIinfile\fR\fR
.ad
.RS 11n
.rt
Specifies the name of the file that contains the shell script to be used as input.
.sp
If \fIinfile\fR is omitted, the shell script is read from standard input.
.RE
.sp
.ne 2
.mk
.na
\fB\fIoutfile\fR\fR
.ad
.RS 11n
.rt
Specifies the name of the output file.
.sp
If \fIoutfile\fR is omitted, both modes write their results to standard output.
.RE
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
Successful completion.
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
An error occurred.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
CSIEnabled
_
Interface StabilitySee below.
.TE
.sp
.LP
The command-line interface and the system variables are Committed. The compiled shell code format is Private. The output of the \fB-D\fR option is Volatile.
.SH SEE ALSO
.sp
.LP
\fBksh\fR(1), \fBattributes\fR(5)
components/ksh93/files/shcomp.1.ja_JP.UTF-8
New file
@@ -0,0 +1,160 @@
'\" te
.\" Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
.TH shcomp 1 "2011 7 月 12 日" "SunOS 5.11" "ユーザーコマンド"
.SH 名前
shcomp \- ksh シェルスクリプトのコンパイル
.SH 形式
.LP
.nf
\fBshcomp\fR [\fB-nv\fR] [\fIinfile\fR [\fIoutfile\fR]]
.fi
.LP
.nf
\fBshcomp\fR \fB-D\fR [\fIinfile\fR [\fIoutfile\fR]]
.fi
.SH 機能説明
.sp
.LP
\fB-D\fR オプションが指定されていない場合、\fBshcomp\fR はシェルスクリプト \fIinfile\fR を使用して、\fBksh\fR が元のスクリプトと同様に読み取りおよび実行を行うバイナリ形式ファイル \fIoutfile\fR を作成します。
.sp
.LP
スクリプトが読み込まれると別名が処理されます。変数の展開が必要な値を持つ別名定義は正常に動作しません。
.SH オプション
.sp
.LP
次のオプションがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fB-D\fR\fR
.ad
.br
.na
\fB\fB--dictionary\fR\fR
.ad
.RS 16n
.rt
国際化のためにメッセージカタログに格納する必要がある文字列のリストが生成されます。
.sp
このオプションを指定すると、\fB$\fR が前に付いた二重引用符で囲まれているすべての文字列が、1 行に 1 つのリテラルという形式で出力されます。リテラル \fB$"foo"\fR は、出力に \fB"foo"\fR と書き込まれます。これらは、国際化のためにロケール固有のバージョンに変換する必要があるメッセージです。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.br
.na
\fB\fB--noexec\fR\fR
.ad
.RS 16n
.rt
廃止された構成または準拠していない構成に対する警告メッセージを表示します。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.br
.na
\fB\fB--verbose\fR\fR
.ad
.RS 16n
.rt
\fIinfile\fR から読み込んだ入力内容を標準エラー出力に書き込みます。
.RE
.SH オペランド
.sp
.LP
次のオペランドがサポートされています。
.sp
.ne 2
.mk
.na
\fB\fIinfile\fR\fR
.ad
.RS 11n
.rt
入力として使用される、シェルスクリプトを含むファイルの名前を指定します。
.sp
\fIinfile\fR を省略した場合、シェルスクリプトは標準入力から読み込まれます。
.RE
.sp
.ne 2
.mk
.na
\fB\fIoutfile\fR\fR
.ad
.RS 11n
.rt
出力ファイルの名前を指定します。
.sp
\fIoutfile\fR を省略した場合、いずれのモードでも結果は標準出力に書き込まれます。
.RE
.SH 終了ステータス
.sp
.LP
次の終了値が返されます。
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
正常終了。
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
エラーが発生しました。
.RE
.SH 属性
.sp
.LP
属性についての詳細は、\fBattributes\fR(5) を参照してください。
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性タイプ属性値
_
使用条件system/core-os
_
CSI有効
_
インタフェースの安定性下記を参照。
.TE
.sp
.LP
コマンド行インタフェースとシステム変数は「確実」です。コンパイルされたシェルコードの形式は「非公開」です。\fB-D\fR オプションの出力は「流動的」です。
.SH 関連項目
.sp
.LP
\fBksh\fR(1), \fBattributes\fR(5)
components/ksh93/files/shcomp.1.zh_CN.UTF-8
New file
@@ -0,0 +1,160 @@
'\" te
.\" Copyright (c) 1982-2007 AT&T Knowledge Ventures
.\" To view license terms, see http://www.opensource.org/licenses/cpl1.0.txt
.\" Portions Copyright (c) 2009, 2011, Oracle and/or its affiliates. 保留所有权利。
.TH shcomp 1 "2011 年 7 月 12 日" "SunOS 5.11" "用户命令"
.SH 名称
shcomp \- 编译 ksh shell 脚本
.SH 用法概要
.LP
.nf
\fBshcomp\fR [\fB-nv\fR] [\fIinfile\fR [\fIoutfile\fR]]
.fi
.LP
.nf
\fBshcomp\fR \fB-D\fR [\fIinfile\fR [\fIoutfile\fR]]
.fi
.SH 描述
.sp
.LP
如果未指定 \fB-D\fR 选项,\fBshcomp\fR 会采用 shell 脚本 \fIinfile\fR,并且会创建二进制格式的文件 \fIoutfile\fR,\fBksh\fR 读取和执行该文件的效果与使用原始脚本的效果相同。
.sp
.LP
读取脚本时处理别名。如果别名定义的值需要变量扩展,该定义将不能正常工作。
.SH 选项
.sp
.LP
支持下列选项:
.sp
.ne 2
.mk
.na
\fB\fB-D\fR\fR
.ad
.br
.na
\fB\fB--dictionary\fR\fR
.ad
.RS 16n
.rt
生成需要放置在消息目录中以实现国际化的字符串列表。
.sp
使用该选项,会打印字符串前有 \fB$\fR 的所有双引号括起来的字符串,每行一个字符串型。字符串型 \fB$"foo"\fR 会在输出中打印出 \fB"foo"\fR。这些消息需要转换为国际化的语言环境特定版本。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-n\fR\fR
.ad
.br
.na
\fB\fB--noexec\fR\fR
.ad
.RS 16n
.rt
显示有关过时或尚未确认的结构的警告信息。
.RE
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.br
.na
\fB\fB--verbose\fR\fR
.ad
.RS 16n
.rt
读取时将来自 \fIinfile\fR 的输入显示为标准错误。
.RE
.SH 操作数
.sp
.LP
支持下列操作数:
.sp
.ne 2
.mk
.na
\fB\fIinfile\fR\fR
.ad
.RS 11n
.rt
指定包含要用作输入的 shell 脚本的文件名称。
.sp
如果省略 \fIinfile\fR,将从标准输入读取 shell 脚本。
.RE
.sp
.ne 2
.mk
.na
\fB\fIoutfile\fR\fR
.ad
.RS 11n
.rt
指定输出文件的名称。
.sp
如果省略 \fIoutfile\fR,则这两种模式都会将其结果写入标准输出。
.RE
.SH 退出状态
.sp
.LP
将返回以下退出值:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 6n
.rt
成功完成。
.RE
.sp
.ne 2
.mk
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
.rt
出现错误。
.RE
.SH 属性
.sp
.LP
有关下列属性的描述,请参见 \fBattributes\fR(5):
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
属性类型属性值
_
可用性system/core-os
_
CSIEnabled(已启用)
_
接口稳定性请参见下文。
.TE
.sp
.LP
命令行界面和系统变量是 "Committed"(已确定)。编译的 shell 代码格式是 "Private"(专用)。\fB-D\fR 选项的输出是 "Volatile"(可变)。
.SH 另请参见
.sp
.LP
\fBksh\fR(1)、\fBattributes\fR(5)
components/ksh93/ksh.kshrc
New file
@@ -0,0 +1,62 @@
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#
# This file is sourced by interactive ksh93 shells before ${HOME}/.kshrc
#
# Enable "gmacs"+"multiline" editor mode if the user did not set an
# input mode yet (for example via ${EDITOR}, ${VISUAL} or any
# "set -o" flag)
if [[ "$(set +o)" != ~(Er)--(gmacs|emacs|vi)( .*|) ]] ; then
    set -o gmacs
    # enable multiline input mode
    set -o multiline
    # enable globstar mode (match subdirs with **/)
    set -o globstar
fi
# Set a default prompt (<username>@<hostname>:<path><"($|#) ">) if
# then variable does not exist in the environment.
#
# Algorithm:
# 1. Define "ellipsis", either Unicode #2026 for unicode locales
# and "..." otherwise
# ([[ "${LC_ALL}/${LANG}" = ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]]
# ensures that the pattern matches the leftmost sequence
# containing *.UTF-8, allowing to match either LC_ALL or
# LANG when LC_ALL is not set)
# 2. If PWD is within HOME replace value of HOME with '~'
# If the PWD is longer than 30 charatcers shorten it to 30 chars
# print '#' for user "root" and '$' for normal users
# Notes:
# - printf "%*s\r%s" COLUMNS "") # is used at the beginning to
#   work around a bug in the "multiline" handling code which
#   causes the shell to override its own prompt when the edit
#   line overflows (this happens if the terminal cursor
#   position is not 0 when PS1 is printed).
# - PS1 will initially be empty until either...
#   a) ... someone sets the variable
#       or
#   b) ... the prompt is displayed for the first time (default is
#     '$ ' for normal users and '# ' for user "root")
# - The statement below will not work if someone sources /etc/ksh.kshrc
#   unless PS1 gets "unset" first.
# - Make sure to use absolute paths (e.g. /usr/bin/hostname) to make
#   sure PS1 works in cases where PATH does not contain /usr/bin/
if [[ "$(set)" != ~(E)PS1= && "${PS1}" == '' ]] ; then
    PS1='$(set +o xtrace +o errexit
                printf "%*s\r%s" COLUMNS ""
                printf "%s@%s:" "${LOGNAME}" "$(/usr/bin/hostname)"
        ellip="${
            [[ "${LC_ALL}/${LANG}" == ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] &&
                printf "\u[2026]\n" || print "..." ; }"
        p="${PWD/~(El)${HOME}/\~}"
        (( ${#p} > 30 )) &&
            print -r -n -- "${ellip}${p:${#p}-30:30}" ||
            print -r -n -- "${p}"
        [[ "${LOGNAME}" == "root" ]] && print -n "# " || print -n "\$ "
        )'
fi
components/ksh93/ksh93.license
New file
@@ -0,0 +1,215 @@
Common Public License Version 1.0
[OSI Approved License]
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and
documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates' from a
Contributor if it was added to the Program by such Contributor itself or anyone
acting on such Contributor's behalf. Contributions do not include additions to
the Program which: (i) are separate modules of software distributed in
conjunction with the Program under their own license agreement, and (ii) are not
derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
    including all Contributors.
    2. GRANT OF RIGHTS
    a) Subject to the terms of this Agreement, each Contributor hereby grants
    Recipient a non-exclusive, worldwide, royalty-free copyright license to
    reproduce, prepare derivative works of, publicly display, publicly perform,
    distribute and sublicense the Contribution of such Contributor, if any, and such
    derivative works, in source code and object code form.
    b) Subject to the terms of this Agreement, each Contributor hereby grants
    Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
    Patents to make, use, sell, offer to sell, import and otherwise transfer the
    Contribution of such Contributor, if any, in source code and object code form.
    This patent license shall apply to the combination of the Contribution and the
    Program if, at the time the Contribution is added by the Contributor, such
    addition of the Contribution causes such combination to be covered by the
    Licensed Patents. The patent license shall not apply to any other combinations
    which include the Contribution. No hardware per se is licensed hereunder.
    c) Recipient understands that although each Contributor grants the licenses
    to its Contributions set forth herein, no assurances are provided by any
    Contributor that the Program does not infringe the patent or other intellectual
    property rights of any other entity. Each Contributor disclaims any liability to
    Recipient for claims brought by any other entity based on infringement of
    intellectual property rights or otherwise. As a condition to exercising the
    rights and licenses granted hereunder, each Recipient hereby assumes sole
    responsibility to secure any other intellectual property rights needed, if any.
    For example, if a third party patent license is required to allow Recipient to
    distribute the Program, it is Recipient's responsibility to acquire that license
    before distributing the Program.
    d) Each Contributor represents that to its knowledge it has sufficient
    copyright rights in its Contribution, if any, to grant the copyright license set
    forth in this Agreement.
    3. REQUIREMENTS
    A Contributor may choose to distribute the Program in object code form under its
    own license agreement, provided that:
    a) it complies with the terms and conditions of this Agreement; and
    b) its license agreement:
    i) effectively disclaims on behalf of all Contributors all warranties and
    conditions, express and implied, including warranties or conditions of title and
    non-infringement, and implied warranties or conditions of merchantability and
    fitness for a particular purpose;
    ii) effectively excludes on behalf of all Contributors all liability for
    damages, including direct, indirect, special, incidental and consequential
    damages, such as lost profits;
    iii) states that any provisions which differ from this Agreement are offered
    by that Contributor alone and not by any other party; and
    iv) states that source code for the Program is available from such
    Contributor, and informs licensees how to obtain it in a reasonable manner on or
    through a medium customarily used for software exchange.
    When the Program is made available in source code form:
    a) it must be made available under this Agreement; and
    b) a copy of this Agreement must be included with each copy of the Program.
    Contributors may not remove or alter any copyright notices contained within the
    Program.
    Each Contributor must identify itself as the originator of its Contribution, if
    any, in a manner that reasonably allows subsequent Recipients to identify the
    originator of the Contribution.
    4. COMMERCIAL DISTRIBUTION
    Commercial distributors of software may accept certain responsibilities with
    respect to end users, business partners and the like. While this license is
    intended to facilitate the commercial use of the Program, the Contributor who
    includes the Program in a commercial product offering should do so in a manner
    which does not create potential liability for other Contributors. Therefore, if
    a Contributor includes the Program in a commercial product offering, such
    Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
    every other Contributor ("Indemnified Contributor") against any losses, damages
    and costs (collectively "Losses") arising from claims, lawsuits and other legal
    actions brought by a third party against the Indemnified Contributor to the
    extent caused by the acts or omissions of such Commercial Contributor in
    connection with its distribution of the Program in a commercial product
    offering. The obligations in this section do not apply to any claims or Losses
    relating to any actual or alleged intellectual property infringement. In order
    to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
    Contributor in writing of such claim, and b) allow the Commercial Contributor to
    control, and cooperate with the Commercial Contributor in, the defense and any
    related settlement negotiations. The Indemnified Contributor may participate in
    any such claim at its own expense.
    For example, a Contributor might include the Program in a commercial product
    offering, Product X. That Contributor is then a Commercial Contributor. If that
    Commercial Contributor then makes performance claims, or offers warranties
    related to Product X, those performance claims and warranties are such
    Commercial Contributor's responsibility alone. Under this section, the
    Commercial Contributor would have to defend claims against the other
    Contributors related to those performance claims and warranties, and if a court
    requires any other Contributor to pay any damages as a result, the Commercial
    Contributor must pay those damages.
    5. NO WARRANTY
    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
    IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
    NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
    Recipient is solely responsible for determining the appropriateness of using and
    distributing the Program and assumes all risks associated with its exercise of
    rights under this Agreement, including but not limited to the risks and costs of
    program errors, compliance with applicable laws, damage to or loss of data,
    programs or equipment, and unavailability or interruption of operations.
    6. DISCLAIMER OF LIABILITY
    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
    CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
                                                  PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
    GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    7. GENERAL
    If any provision of this Agreement is invalid or unenforceable under applicable
    law, it shall not affect the validity or enforceability of the remainder of the
    terms of this Agreement, and without further action by the parties hereto, such
    provision shall be reformed to the minimum extent necessary to make such
    provision valid and enforceable.
    If Recipient institutes patent litigation against a Contributor with respect to
    a patent applicable to software (including a cross-claim or counterclaim in a
                                     lawsuit), then any patent licenses granted by that Contributor to such Recipient
    under this Agreement shall terminate as of the date such litigation is filed. In
    addition, if Recipient institutes patent litigation against any entity
    (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
    itself (excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted under
Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and does
not cure such failure in a reasonable period of time after becoming aware of
such noncompliance. If all Recipient's rights under this Agreement terminate,
     Recipient agrees to cease use and distribution of the Program as soon as
     reasonably practicable. However, Recipient's obligations under this Agreement
     and any licenses granted by Recipient relating to the Program shall continue and
     survive.
     Everyone is permitted to copy and distribute copies of this Agreement, but in
     order to avoid inconsistency the Agreement is copyrighted and may only be
     modified in the following manner. The Agreement Steward reserves the right to
     publish new versions (including revisions) of this Agreement from time to time.
     No one other than the Agreement Steward has the right to modify this Agreement.
     IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
     as the Agreement Steward to a suitable separate entity. Each new version of the
     Agreement will be given a distinguishing version number. The Program (including
                                                                           Contributions) may always be distributed subject to the version of the Agreement
     under which it was received. In addition, after a new version of the Agreement
     is published, Contributor may elect to distribute the Program (including its
                                                                    Contributions) under the new version. Except as expressly stated in Sections
     2(a) and 2(b) above, Recipient receives no rights or licenses to the
     intellectual property of any Contributor under this Agreement, whether
     expressly, by implication, estoppel or otherwise. All rights in the Program not
     expressly granted under this Agreement are reserved.
     This Agreement is governed by the laws of the State of New York and the
     intellectual property laws of the United States of America. No party to this
     Agreement will bring a legal action under this Agreement more than one year
     after the cause of action arose. Each party waives its rights to a jury trial in
     any resulting litigation.
components/ksh93/ksh93.p5m
New file
@@ -0,0 +1,110 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
# The man pages are all at the top of a "files" directory; setting the hash to
# point to the files therein.
<transform file path=usr/share/man/man.+/(.+)$ -> set action.hash %<\1> >
# Bypassing the mangler for these files because they are pre-Solarified.
<transform file path=usr/share/man/.+$ -> add mangler.bypass true >
set name=pkg.fmri \
    value=pkg:/shell/ksh@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.description \
    value="Korn Shell 93: A command and programming language that executes commands read from a terminal or a file"
set name=pkg.summary value="Ksh93 - The AT&T Korn Shell"
set name=info.classification value=org.opensolaris.category.2008:System/Shells
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream \
    value="AT&T Software Technology (AST) OpenSource Software Collection"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=org.opensolaris.arc-caseid value=PSARC/2012/002
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
dir path=usr group=sys
dir path=usr/include
dir path=usr/share group=sys
dir path=usr/share/doc group=other
dir path=usr/share/doc/ksh
dir path=usr/share/man/ja_JP.UTF-8/man1
dir path=usr/share/man/man1
dir path=usr/share/man/zh_CN.UTF-8/man1
file path=etc/ksh.kshrc group=sys original_name=SUNWcs:etc/ksh.kshrc \
    preserve=renameold
file $(MACH32)/bin/ksh path=usr/bin/$(MACH32)/ksh mode=0555
file $(MACH32)/bin/shcomp path=usr/bin/$(MACH32)/shcomp mode=0555
file $(MACH64)/bin/alias path=usr/bin/alias mode=0555
file $(MACH64)/bin/ksh path=usr/bin/$(MACH64)/ksh mode=0555
file $(MACH64)/bin/shcomp path=usr/bin/$(MACH64)/shcomp mode=0555
file alias.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/alias.1
file jsh.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/jsh.1
file ksh.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/ksh.1
file ksh93.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/ksh93.1
file rksh.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/rksh.1
file sh.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/sh.1
file shcomp.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/shcomp.1
file path=usr/share/man/man1/alias.1
file path=usr/share/man/man1/jsh.1
file path=usr/share/man/man1/ksh.1
file path=usr/share/man/man1/ksh93.1
file path=usr/share/man/man1/rksh.1
file path=usr/share/man/man1/sh.1
file path=usr/share/man/man1/shcomp.1
file ksh.1.zh_CN.UTF-8 path=usr/share/man/zh_CN.UTF-8/man1/ksh.1
file ksh93.1.zh_CN.UTF-8 path=usr/share/man/zh_CN.UTF-8/man1/ksh93.1
file rksh.1.zh_CN.UTF-8 path=usr/share/man/zh_CN.UTF-8/man1/rksh.1
file shcomp.1.zh_CN.UTF-8 path=usr/share/man/zh_CN.UTF-8/man1/shcomp.1
hardlink path=usr/bin/$(MACH32)/ksh93 target=ksh
hardlink path=usr/bin/$(MACH32)/rksh target=ksh
hardlink path=usr/bin/$(MACH32)/rksh93 target=ksh
hardlink path=usr/bin/$(MACH64)/ksh93 target=ksh
hardlink path=usr/bin/$(MACH64)/rksh target=ksh
hardlink path=usr/bin/$(MACH64)/rksh93 target=ksh
hardlink path=usr/bin/bg target=alias
hardlink path=usr/bin/cd target=alias
hardlink path=usr/bin/command target=alias
hardlink path=usr/bin/fc target=alias
hardlink path=usr/bin/fg target=alias
hardlink path=usr/bin/getopts target=alias
hardlink path=usr/bin/hash target=alias
hardlink path=usr/bin/jobs target=alias
hardlink path=usr/bin/kill target=alias
hardlink path=usr/bin/ksh target=../lib/isaexec
hardlink path=usr/bin/ksh93 target=../lib/isaexec
hardlink path=usr/bin/pfksh target=pfexec
hardlink path=usr/bin/pfksh93 target=pfexec
hardlink path=usr/bin/pfrksh target=pfexec
hardlink path=usr/bin/pfrksh93 target=pfexec
hardlink path=usr/bin/print target=alias
hardlink path=usr/bin/read target=alias
hardlink path=usr/bin/rksh target=../lib/isaexec
hardlink path=usr/bin/rksh93 target=../lib/isaexec
hardlink path=usr/bin/test target=alias
hardlink path=usr/bin/type target=alias
hardlink path=usr/bin/ulimit target=alias
hardlink path=usr/bin/umask target=alias
hardlink path=usr/bin/unalias target=alias
hardlink path=usr/bin/wait target=alias
license ksh93.license license=CPL
link path=usr/bin/jsh target=ksh93
link path=usr/bin/sh target=$(MACH32)/ksh93
link path=usr/lib/rsh target=../bin/ksh93
link path=usr/sbin/jsh target=../bin/ksh93
link path=usr/sbin/sh target=../bin/$(MACH32)/ksh93
components/ksh93/patches/CR6919590.patch
New file
@@ -0,0 +1,24 @@
--- a/src/cmd/ksh93/sh/args.c    Thu Sep  2 22:38:27 2010
+++ b/src/cmd/ksh93/sh/args.c    Tue Sep 27 10:48:45 2011
@@ -26,6 +26,9 @@
  * AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    "path.h"
@@ -302,6 +305,11 @@
         }
         else
         {
+            if ((o == SH_RESTRICTED) &&
+                sh_isoption(SH_RESTRICTED)) {
+                errormsg(SH_DICT, ERROR_exit(1),
+                    e_restricted, "r");
+            }
             if(o==SH_XTRACE)
                 trace = 0;
             off_option(&newflags,o);
components/ksh93/patches/CR6964621.patch
New file
@@ -0,0 +1,553 @@
--- a/src/cmd/ksh93/sh/io.c    Tue Feb  8 17:15:45 2011
+++ b/src/cmd/ksh93/sh/io.c    Tue Sep 27 10:48:45 2011
@@ -26,6 +26,9 @@
  *   AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    <fcin.h>
@@ -596,8 +599,10 @@
         ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
         errormsg(SH_DICT,ERROR_system(1),e_toomany);
     }
-    if(f2 >= shp->gd->lim.open_max)
-        sh_iovalidfd(shp,f2);
+
+    VALIDATE_FD(shp, fd);
+    VALIDATE_FD(shp, f2);
+
     if(shp->fdptrs[fd]=shp->fdptrs[f2])
     {
         if(f2==job.fd)
@@ -623,7 +628,12 @@
  */
 int sh_iorenumber(Shell_t *shp, register int f1,register int f2)
 {
-    register Sfio_t *sp = shp->sftable[f2];
+    register Sfio_t *sp;
+
+    VALIDATE_FD(shp, f1);
+    VALIDATE_FD(shp, f2);
+
+    sp = shp->sftable[f2];
     if(f1!=f2)
     {
         /* see whether file descriptor is in use */
@@ -663,8 +673,7 @@
         if(f2<=2)
             sfset(sp,SF_SHARE|SF_PUBLIC,1);
     }
-    if(f2>=shp->gd->lim.open_max)
-        sh_iovalidfd(shp,f2);
+    VALIDATE_FD(shp, f2);
     return(f2);
 }
@@ -678,8 +687,9 @@
     register int r = 0;
     if(fd<0)
         return(-1);
-    if(fd >= shp->gd->lim.open_max)
-        sh_iovalidfd(shp,fd);
+
+    VALIDATE_FD(shp, fd);
+
     if(!(sp=shp->sftable[fd]) || sfclose(sp) < 0)
     {
         if(fdnotify)
@@ -835,6 +845,9 @@
         mode = (IOREAD|IOWRITE);
     else
         mode = IOREAD;
+
+    VALIDATE_FD(shp, fd);
+
     shp->fdstatus[fd] = mode;
     return(fd);
 }
@@ -858,9 +871,15 @@
 {
     Shell_t *shp = sh_getinterp();
     register int fdnew;
+
+    VALIDATE_FD(shp, fdold);
+
     if(fdold<0 || fdold>2)
         return(fdold);
     fdnew = sh_iomovefd(dup(fdold));
+
+    VALIDATE_FD(shp, fdnew);
+
     shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
     close(fdold);
     shp->fdstatus[fdold] = IOCLOSE;
@@ -878,6 +897,8 @@
         errormsg(SH_DICT,ERROR_system(1),e_pipe);
     pv[0] = sh_iomovefd(pv[0]);
     pv[1] = sh_iomovefd(pv[1]);
+    VALIDATE_FD(shp, pv[0]);
+    VALIDATE_FD(shp, pv[1]);
     shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
     shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
     sh_subsavefd(pv[0]);
@@ -897,6 +918,9 @@
         sh_close(fd);
     else
         pv[out] = sh_iomovefd(fd);
+
+    VALIDATE_FD(shp, pv[out]);
+
     if(fcntl(pv[out],F_SETFD,FD_CLOEXEC) >=0)
         shp->fdstatus[pv[out]] |= IOCLEX;
     shp->fdstatus[pv[out]] = (out?IOWRITE:IOREAD);
@@ -929,6 +953,9 @@
         errormsg(SH_DICT,ERROR_system(1),e_pipe);
     }
     fcntl(pv[out],F_SETFD,FD_CLOEXEC);
+
+    VALIDATE_FD(shp, pv[out]);
+
     shp->fdstatus[pv[out]] |= IOCLEX;
     pv[1-out] = -1;
     pv[2] = port;
@@ -958,9 +985,13 @@
 static int io_patseek(Shell_t *shp, regex_t *rp, Sfio_t* sp, int flags)
 {
     char    *cp, *match;
-    int    r, fd=sffileno(sp), close_exec = shp->fdstatus[fd]&IOCLEX;
+    int    r, fd, close_exec;
     int    was_share,s=(PIPE_BUF>SF_BUFSIZE?SF_BUFSIZE:PIPE_BUF);
     size_t    n,m;
+
+    fd = sffileno(sp);
+    VALIDATE_FD(shp, fd);
+    close_exec = shp->fdstatus[fd]&IOCLEX;
     shp->fdstatus[sffileno(sp)] |= IOCLEX;
     if(fd==0)
         was_share = sfset(sp,SF_SHARE,1);
@@ -994,12 +1025,17 @@
 static Sfoff_t    file_offset(Shell_t *shp, int fn, char *fname)
 {
-    Sfio_t        *sp = shp->sftable[fn];
+    Sfio_t        *sp;
     char        *cp;
     Sfoff_t        off;
     struct Eof    endf;
     Namval_t    *mp = nv_open("EOF",shp->var_tree,0);
     Namval_t    *pp = nv_open("CUR",shp->var_tree,0);
+
+    VALIDATE_FD(shp, fn);
+
+    sp = shp->sftable[fn];
+
     memset(&endf,0,sizeof(struct Eof));
     endf.fd = fn;
     endf.hdr.disc = &EOF_disc;
@@ -1169,7 +1205,7 @@
             if((iof&IOLSEEK) || ((iof&IOMOV) && *fname=='-'))
                 fn = nv_getnum(np);
         }
-        if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
+        if (!VALIDATE_FD(shp, fn))
             errormsg(SH_DICT,ERROR_system(1),e_file+4);
         if(iof&IOLSEEK)
         {
@@ -1212,6 +1248,7 @@
                         message = e_file;
                         goto fail;
                     }
+                    VALIDATE_FD(shp, dupfd);
                     if(shp->subshell && dupfd==1)
                     {
                         if(sfset(sfstdout,0,0)&SF_STRING)
@@ -1248,8 +1285,7 @@
                     goto traceit;
                 if((fd=sh_fcntl(dupfd,F_DUPFD,3))<0)
                     goto fail;
-                if(fd>= shp->gd->lim.open_max)
-                    sh_iovalidfd(shp,fd);
+                VALIDATE_FD(shp, fd);
                 sh_iocheckfd(shp,dupfd);
                 shp->fdstatus[fd] = (shp->fdstatus[dupfd]&~IOCLEX);
                 if(toclose<0 && shp->fdstatus[fd]&IOREAD)
@@ -1362,7 +1398,11 @@
             }
             if(iof&IOLSEEK)
             {
-                Sfio_t *sp = shp->sftable[fn];
+                Sfio_t *sp;
+
+                VALIDATE_FD(shp, fn);
+
+                sp = shp->sftable[fn];
                 r = shp->fdstatus[fn];
                 if(!(r&(IOSEEK|IONOSEEK)))
                     r = sh_iocheckfd(shp,fn);
@@ -1443,6 +1483,7 @@
             }
             if(fd<0)
             {
+                VALIDATE_FD(shp, fn);
                 if(sh_inuse(shp,fn) || (fn && fn==shp->infd))
                 {
                     if(fn>9 || !(shp->inuse_bits&(1<<fn)))
@@ -1462,7 +1503,7 @@
                     {
                         if((fn=fcntl(fd,F_DUPFD,10)) < 0)
                             goto fail;
-                        if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
+                        if (!VALIDATE_FD(shp, fn))
                             goto fail;
                         shp->fdstatus[fn] = shp->fdstatus[fd];
                         sh_close(fd);
@@ -1622,7 +1663,12 @@
     filemap[shp->topfd++].save_fd = savefd;
     if(savefd >=0)
     {
-        register Sfio_t* sp = shp->sftable[origfd];
+        register Sfio_t* sp;
+
+        VALIDATE_FD(shp, origfd);
+        VALIDATE_FD(shp, savefd);
+
+        sp = shp->sftable[origfd];
         /* make saved file close-on-exec */
         sh_fcntl(savefd,F_SETFD,FD_CLOEXEC);
         if(origfd==job.fd)
@@ -1655,6 +1701,7 @@
             filemap[newfd++] = filemap[fd];
         else
         {
+            VALIDATE_FD(shp, savefd);
             shp->sftable[savefd] = 0;
             sh_close(savefd);
         }
@@ -1678,6 +1725,7 @@
         {
             if ((savefd = filemap[fd].save_fd) >= 0)
             {
+                VALIDATE_FD(shp, savefd);
                 shp->sftable[savefd] = 0;
                 sh_close(savefd);
             }
@@ -1684,10 +1732,12 @@
             continue;
         }
         origfd = filemap[fd].orig_fd;
+        VALIDATE_FD(shp, origfd);
         if(origfd<0)
         {
             /* this should never happen */
             savefd = filemap[fd].save_fd;
+            VALIDATE_FD(shp, savefd);
             shp->sftable[savefd] = 0;
             sh_close(savefd);
             return;
@@ -1699,6 +1749,7 @@
         sh_close(origfd);
         if ((savefd = filemap[fd].save_fd) >= 0)
         {
+            VALIDATE_FD(shp, savefd);
             sh_fcntl(savefd, F_DUPFD, origfd);
             if(savefd==job.fd)
                 job.fd=origfd;
@@ -1954,6 +2005,9 @@
 int sh_iocheckfd(Shell_t *shp, register int fd)
 {
     register int flags, n;
+
+    VALIDATE_FD(shp, fd);
+
     if((n=shp->fdstatus[fd])&IOCLOSE)
         return(n);
     if(!(n&(IOREAD|IOWRITE)))
@@ -2145,7 +2199,7 @@
         return;
     }
 #endif
-    if(fd<0 || (fd>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fd)))
+    if (fd < 0 || !VALIDATE_FD(shp, fd))
         return;
     if(sh_isstate(SH_NOTRACK))
         return;
@@ -2413,6 +2467,8 @@
 {
     Shell_t *shp = sh_getinterp();
     register Sfio_t *sp;
+
+    VALIDATE_FD(shp, fd);
     if(sp=shp->sftable[fd])
         return(sfread(sp,buff,n));
     else
@@ -2427,6 +2483,8 @@
 {
     Shell_t *shp = sh_getinterp();
     register Sfio_t *sp;
+
+    VALIDATE_FD(shp, fd);
     if(sp=shp->sftable[fd])
         return(sfwrite(sp,buff,n));
     else
@@ -2441,6 +2499,8 @@
 {
     Shell_t *shp = sh_getinterp();
     register Sfio_t *sp;
+
+    VALIDATE_FD(shp, fd);
     if((sp=shp->sftable[fd]) && (sfset(sp,0,0)&(SF_READ|SF_WRITE)))
         return(sfseek(sp,offset,whence));
     else
@@ -2452,6 +2512,9 @@
 {
     Shell_t *shp = sh_getinterp();
     register int fd = dup(old);
+
+    VALIDATE_FD(shp, old);
+    VALIDATE_FD(shp, fd);
     if(fd>=0)
     {
         if(shp->fdstatus[old] == IOCLOSE)
@@ -2473,13 +2536,15 @@
     arg =  va_arg(ap, int) ;
     va_end(ap);
     newfd = fcntl(fd,op,arg);
+
+    VALIDATE_FD(shp, fd);
+    VALIDATE_FD(shp, newfd);
+
     if(newfd>=0) switch(op)
     {
         case F_DUPFD:
         if(shp->fdstatus[fd] == IOCLOSE)
             shp->fdstatus[fd] = 0;
-        if(newfd>=shp->gd->lim.open_max)
-            sh_iovalidfd(shp,newfd);
         shp->fdstatus[newfd] = (shp->fdstatus[fd]&~IOCLEX);
         if(fdnotify)
             (*fdnotify)(fd,newfd);
@@ -2548,6 +2613,7 @@
         return(iop);
     if(mode==SF_READ && !(n&IOREAD))
         return(iop);
+    VALIDATE_FD(shp, fd);
     if(!(iop = shp->sftable[fd]))
         iop=sh_iostream(shp,fd);
     return(iop);
@@ -2567,7 +2633,10 @@
 {
     Shell_t    *shp = sh_getinterp();
     register int status;
-    Sfio_t *sp = shp->sftable[fd];
+    Sfio_t *sp;
+
+    VALIDATE_FD(shp, fd);
+    sp = shp->sftable[fd];
     if(!sp  && (status = sh_iocheckfd(shp,fd))!=IOCLOSE)
     {
         register int flags=0;
--- a/src/cmd/ksh93/include/io.h    Mon Nov 29 15:02:53 2010
+++ b/src/cmd/ksh93/include/io.h    Tue Aug 30 13:06:36 2011
@@ -23,6 +23,9 @@
  *    David Korn
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    <ast.h>
 #include    <sfio.h>
@@ -84,6 +87,12 @@
 extern int    sh_isdevfd(const char*);
 extern int    sh_source(Shell_t*, Sfio_t*, const char*);
+extern int    VALIDATE_FD(Shell_t *, int);
+
+#define    VALIDATE_FD(shp, fd) \
+    (((fd) >= (shp)->gd->lim.open_max) ? sh_iovalidfd(shp, fd) : 1)
+
+
 /* the following are readonly */
 extern const char    e_pexists[];
 extern const char    e_query[];
@@ -123,4 +132,5 @@
 extern const char    e_stdprompt[];
 extern const char    e_supprompt[];
 extern const char    e_ambiguous[];
+
 #endif /* KSHELL */
--- a/src/cmd/ksh93/sh/lex.c    Fri Jan  7 16:37:35 2011
+++ b/src/cmd/ksh93/sh/lex.c    Tue Aug 30 13:06:36 2011
@@ -25,6 +25,9 @@
  * AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    <ast.h>
 #include    <stak.h>
@@ -2053,6 +2056,7 @@
     else
         lp->lastline = shp->inlineno;
     tokstr = fmttoken(lp,tok,tokbuf);
+    VALIDATE_FD(shp, shp->infd);
     if((sp=fcfile()) || (shp->infd>=0 && (sp=shp->sftable[shp->infd])))
     {
         /* clear out any pending input */
--- a/src/cmd/ksh93/sh/main.c    Wed Dec  1 22:10:07 2010
+++ b/src/cmd/ksh93/sh/main.c    Tue Aug 30 13:06:36 2011
@@ -396,8 +401,10 @@
         if(fno > 0)
         {
             int r;
+            VALIDATE_FD(shp, fno);
             if(fno < 10 && ((r=sh_fcntl(fno,F_DUPFD,10))>=10))
             {
+                VALIDATE_FD(shp, r);
                 shp->fdstatus[r] = shp->fdstatus[fno];
                 sh_close(fno);
                 fno = r;
--- a/src/cmd/ksh93/sh/path.c    Mon Nov 22 20:55:38 2010
+++ b/src/cmd/ksh93/sh/path.c    Tue Sep 27 10:48:45 2011
@@ -23,6 +23,9 @@
  * AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    <fcin.h>
@@ -562,6 +565,7 @@
     if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
     {
         fcntl(fd,F_SETFD,FD_CLOEXEC);
+        VALIDATE_FD(shp, fd);
         shp->fdstatus[fd] |= IOCLEX;
     }
     return(fd);
@@ -1239,6 +1243,7 @@
     if(sp=fcfile())
         while(sfstack(sp,SF_POPSTACK));
     job_clear();
+    VALIDATE_FD(shp, shp->infd);
     if(shp->infd>0 && (shp->fdstatus[shp->infd]&IOCLEX))
         sh_close(shp->infd);
     sh_setstate(sh_state(SH_FORKED));
--- a/src/cmd/ksh93/sh/xec.c    Tue Feb  8 19:08:15 2011
+++ b/src/cmd/ksh93/sh/xec.c    Tue Aug 30 13:06:36 2011
@@ -25,6 +25,9 @@
  *   AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    <fcin.h>
@@ -94,6 +97,8 @@
     usepipe++;
     fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
     subpipe[2] = fcntl(1,F_DUPFD,10);
+    VALIDATE_FD(shp, subpipe[1]);
+    VALIDATE_FD(shp, subpipe[2]);
     shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
     close(1);
     fcntl(subpipe[1],F_DUPFD,1);
@@ -117,6 +122,7 @@
     usepipe = 0;
     close(1);
     fcntl(subpipe[2], F_DUPFD, 1);
+    VALIDATE_FD(shp, subpipe[2]);
     shp->fdstatus[1] = shp->fdstatus[subpipe[2]];
     if(subdup) for(n=0; n < 10; n++)
     {
@@ -583,7 +589,10 @@
     if(lineno)
         shp->inlineno = lineno;
     if(io_save)
+    {
         sfclose(io_save);
+        io_save = 0;
+    }
     sh_freeup(shp);
     shp->st.staklist = saveslp;
     shp->fn_reset = 0;
@@ -844,6 +853,7 @@
             if(filt > 2)
             {
                 shp->coutpipe = shp->inpipe[1];
+                VALIDATE_FD(shp, shp->coutpipe);
                 shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
             }
         }
@@ -1487,6 +1497,7 @@
                         if(shp->cpipe[0]<0 || shp->cpipe[1] < 0)
                         {
                             sh_copipe(shp,shp->outpipe=shp->cpipe,0);
+                            VALIDATE_FD(shp, shp->cpipe[0]);
                             shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
                         }
                         sh_copipe(shp,shp->inpipe=pipes,0);
@@ -3419,6 +3430,8 @@
         if((outfd=shp->cpipe[1]) < 10)
         {
                 int fd=fcntl(shp->cpipe[1],F_DUPFD,10);
+            VALIDATE_FD(shp, outfd);
+            VALIDATE_FD(shp, fd);
             if(fd>=10)
             {
                     shp->fdstatus[fd] = (shp->fdstatus[outfd]&~IOCLEX);
@@ -3427,6 +3440,9 @@
                 shp->cpipe[1] = fd;
             }
         }
+        VALIDATE_FD(shp, shp->cpipe[0]);
+        VALIDATE_FD(shp, shp->cpipe[1]);
+
         if(fcntl(*shp->cpipe,F_SETFD,FD_CLOEXEC)>=0)
             shp->fdstatus[shp->cpipe[0]] |= IOCLEX;
         shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
@@ -3437,7 +3453,9 @@
     shp->outpipe = shp->cpipe;
     sh_pipe(shp->inpipe=pipes);
     shp->coutpipe = shp->inpipe[1];
+    VALIDATE_FD(shp, shp->coutpipe);
     shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
+    VALIDATE_FD(shp, shp->outpipe[0]);
     if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
         shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
 }
@@ -3608,6 +3626,7 @@
                 int fd = shp->inpipe[1];
                 sh_iosave(shp,0,buff.topfd,(char*)0);
                 sh_iorenumber(shp,shp->inpipe[0],0);
+                VALIDATE_FD(shp, fd);
                 if(fd>=0 && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(fd,F_SETFD,FD_CLOEXEC)>=0)
                     shp->fdstatus[fd] |= IOCLEX;
             }
@@ -3619,6 +3638,7 @@
 #endif /* SHOPT_COSHELL */
                 sh_iosave(shp,1,buff.topfd,(char*)0);
                 sh_iorenumber(shp,sh_dup(shp->outpipe[1]),1);
+                VALIDATE_FD(shp, shp->outpipe[0]);
                 if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
                     shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
             }
@@ -3658,6 +3678,7 @@
             signal(SIGQUIT,sh_fault);
             signal(SIGINT,sh_fault);
         }
+        VALIDATE_FD(shp, shp->inpipe[1]);
         if((otype&FPIN) && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(shp->inpipe[1],F_SETFD,FD_CLOEXEC)>=0)
             shp->fdstatus[shp->inpipe[1]] &= ~IOCLEX;
         if(t->fork.forkio || otype)
components/ksh93/patches/CR7025778.patch
New file
@@ -0,0 +1,44 @@
--- a/src/lib/libcmd/cmp.c    Mon Apr 12 15:39:53 2010
+++ b/src/lib/libcmd/cmp.c    Tue Jun 28 13:59:47 2011
@@ -1,3 +1,7 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
 /***********************************************************************
 *                                                                      *
 *               This software is part of the ast package               *
@@ -164,6 +168,10 @@
                 return ret;
             if (!(p1 = (unsigned char*)sfreserve(f1, SF_UNBOUND, 0)) || (c1 = sfvalue(f1)) <= 0)
             {
+                if (sferror(f1)) {
+                    error(ERROR_exit(2),
+                        "read error on %s", file1);
+                }
                 if ((e2 - p2) > 0 || sfreserve(f2, SF_UNBOUND, 0) && sfvalue(f2) > 0)
                 {
                     ret = 1;
@@ -170,6 +178,10 @@
                     if (!(flags & CMP_SILENT))
                         error(ERROR_exit(1), "EOF on %s", file1);
                 }
+                if (sferror(f2)) {
+                    error(ERROR_exit(2),
+                        "read error on %s", file2);
+                }
                 return ret;
             }
             if (count > 0 && c1 > count)
@@ -181,6 +193,10 @@
         {
             if (!(p2 = (unsigned char*)sfreserve(f2, SF_UNBOUND, 0)) || (c2 = sfvalue(f2)) <= 0)
             {
+                if (sferror(f2)) {
+                    error(ERROR_exit(2),
+                        "read error on %s", file2);
+                }
                 if (!(flags & CMP_SILENT))
                     error(ERROR_exit(1), "EOF on %s", file2);
                 return 1;
components/ksh93/patches/CR7026179.patch
New file
@@ -0,0 +1,49 @@
--- a/src/lib/libcmd/wclib.c    Tue Dec  1 17:10:57 2009
+++ b/src/lib/libcmd/wclib.c    Wed Jun 29 15:22:42 2011
@@ -18,6 +18,9 @@
 *                  David Korn <dgk@research.att.com>                   *
 *                                                                      *
 ***********************************************************************/
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #pragma prototyped
 /*
  * David Korn
@@ -341,7 +344,9 @@
         int        xspace;
         int        wasspace = 1;
         unsigned char*    start;
+        int             flagm = 0;
+
         lastchar = 0;
         start = (endbuff = side) + 1;
         xspace = iswspace(0xa0) || iswspace(0x85);
@@ -367,6 +372,7 @@
             if(mbc(lasttype))
             {
                 c = lasttype;
+                flagm = 1;
                 goto mbyte;
             }
             if(!lasttype && spc(type[*cp]))
@@ -415,6 +421,18 @@
                             skip = (c&7);
                             adjust += skip;
                             state = 0;
+                            if (flagm == 1) {
+                                flagm = 0;
+                                oldc = *cp;
+                                if (xspace && (
+                                    iswspace
+                                    (*cp)
+                                    == 1)) {
+                                    state
+                                        = 8;
+                                }
+                                continue;
+                            }
                             if(skip==2 && (cp[-1]&0xc)==0 && (state=(cp[-1]&0x3)))
                                 oldc = *cp;
                             else if(xspace && cp[-1]==0xc2)
components/ksh93/patches/CR7032821.patch
New file
@@ -0,0 +1,11 @@
--- a/src/cmd/ksh93/bltins/typeset.c    Fri Dec 31 00:15:57 2010
+++ b/src/cmd/ksh93/bltins/typeset.c    Tue Jun 28 13:59:53 2011
@@ -608,7 +608,7 @@
             }
             if(!nv_isarray(np) && !strchr(name,'=') && !(shp->envlist  && nv_onlist(shp->envlist,name)))
             {
-                if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&NV_EXPORT) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
+                if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
 {
                     _nv_unset(np,0);
 }
components/ksh93/patches/CR7036535.patch
New file
@@ -0,0 +1,68 @@
--- a/src/cmd/ksh93/sh/path.c    Mon Nov 22 20:55:38 2010
+++ b/src/cmd/ksh93/sh/path.c    Tue Sep 27 10:48:45 2011
@@ -1430,7 +1435,7 @@
         len = strlen(name);
     for(pp=first; pp; pp=pp->next)
     {
-        if(memcmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
+        if(strncmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
         {
             pp->flags |= flag;
             return(first);
@@ -1740,7 +1745,7 @@
     register Pathcomp_t *pp=first;
     while(pp)
     {
-        if(memcmp(name,pp->name,pp->len)==0 && name[pp->len]==c)
+        if(strncmp(name,pp->name,pp->len)==0 && name[pp->len]==c)
             return(pp);
         pp = pp->next;
     }
--- a/src/cmd/ksh93/sh/nvtree.c    Sun Jan  2 17:45:14 2011
+++ b/src/cmd/ksh93/sh/nvtree.c    Fri Jul 22 00:30:31 2011
@@ -26,6 +26,9 @@
  *   AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    "name.h"
@@ -188,7 +191,7 @@
         {
             char *cp = nv_name(dp->hp);
             c = strlen(cp);
-            if(memcmp(name,cp,c) || name[c]!='[')
+            if(strncmp(name,cp,c) || name[c]!='[')
                 dp->hp = (Namval_t*)dtnext(dp->root,dp->hp);
             else
             {
@@ -266,7 +269,7 @@
 {
     if(dp->nextnode)
         return((*dp->nextnode)(dp->hp,dp->root,dp->fun));
-    if(dp->len && memcmp(dp->data, dp->hp->nvname, dp->len))
+    if(dp->len && strncmp(dp->data, dp->hp->nvname, dp->len))
         return(0);
     return((Namval_t*)dtnext(dp->root,dp->hp));
 }
@@ -311,7 +314,7 @@
                     dp->hp = (*dp->nextnode)(np,(Dt_t*)0,dp->fun);
             }
             sh.last_table = last_table;
-            if(!dp->len || memcmp(cp,dp->data,dp->len)==0)
+            if(!dp->len || strncmp(cp,dp->data,dp->len)==0)
             {
                 if((nfp=nextdisc(np)) && (nfp->disc->getval||nfp->disc->getnum) && nv_isvtree(np) && strcmp(cp,dp->data))
                     nfp = 0;
@@ -861,7 +864,7 @@
                     continue;
                 break;
             }
-            else if(outfile && !wp->nofollow && argv[1] && memcmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
+            else if(outfile && !wp->nofollow && argv[1] && strncmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
             {
                 int    k=1;
                 Namarr_t *ap=0;
components/ksh93/patches/CR7057565.patch
New file
@@ -0,0 +1,12 @@
diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
--- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile    2012-04-11 17:48:34.919720887 +0100
+++ INIT.2011-02-08/src/cmd/ksh93/Makefile    2012-04-11 17:51:33.474974484 +0100
@@ -40,7 +40,7 @@ SHOPT_NAMESPACE == 1        /* allow namespace
 SHOPT_OLDTERMIO ==        /* support both TCGETA and TCGETS */
 SHOPT_OPTIMIZE == 1        /* optimize loop invariants */
 SHOPT_PFSH == 1            /* solaris exec_attr(4) profile execution */
-SHOPT_P_SUID ==            /* real uid's that require -p for set[ug]id */
+SHOPT_P_SUID == 1        /* real uid's that require -p for set[ug]id */
 SHOPT_RAWONLY == 1        /* make viraw the only vi mode */
 SHOPT_REGRESS ==        /* enable __regress__ builtin and instrumented intercepts for testing */
 SHOPT_REMOTE ==            /* enable --rc if running as a remote shell */
components/ksh93/patches/CR7065478.patch
New file
@@ -0,0 +1,46 @@
--- a/src/lib/libast/comp/setlocale.c    Mon Dec 27 04:23:49 2010
+++ b/src/lib/libast/comp/setlocale.c    Fri Jul 22 00:30:31 2011
@@ -19,6 +19,9 @@
 *                   Phong Vo <kpv@research.att.com>                    *
 *                                                                      *
 ***********************************************************************/
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #pragma prototyped
 /*
@@ -2236,6 +2239,24 @@
 typedef int (*Isw_f)(wchar_t);
+static int
+wide_wctomb(char* u, wchar_t w)
+{
+    int size = 0;
+
+    if (u)
+    {
+        size = wctomb(u, w);
+        if (size < 0)
+        {
+            *u = (char)(w & 0xff);
+            size = 1;
+        }
+    }
+
+    return size;
+}
+
 /*
  * called when LC_CTYPE initialized or changes
  */
@@ -2280,7 +2301,7 @@
     {
         if (!(ast.mb_width = wcwidth))
             ast.mb_width = default_wcwidth;
-        ast.mb_conv = wctomb;
+        ast.mb_conv = wide_wctomb;
 #ifdef mb_state
         {
             /*
components/ksh93/patches/CR7065900.patch
New file
@@ -0,0 +1,11 @@
--- a/src/cmd/ksh93/data/builtins.c    Tue Dec  7 19:23:04 2010
+++ b/src/cmd/ksh93/data/builtins.c    Mon Jul 18 12:08:50 2011
@@ -108,7 +108,6 @@
     "printf",    NV_BLTIN|BLT_ENV,        bltin(printf),
     "pwd",        NV_BLTIN,            bltin(pwd),
     "read",        NV_BLTIN|BLT_ENV,        bltin(read),
-    "sleep",    NV_BLTIN,            bltin(sleep),
     "alarm",    NV_BLTIN,            bltin(alarm),
     "ulimit",    NV_BLTIN|BLT_ENV,        bltin(ulimit),
     "umask",    NV_BLTIN|BLT_ENV,        bltin(umask),
components/ksh93/patches/CR7071431.patch
New file
@@ -0,0 +1,11 @@
--- a/src/cmd/ksh93/include/ulimit.h    Tue Oct 26 16:25:26 2010
+++ b/src/cmd/ksh93/include/ulimit.h    Thu Aug 25 10:19:37 2011
@@ -157,7 +157,7 @@
 typedef struct Limit_s
 {
-    const char    name[8];
+    const char*    name;
     const char*    description;
     int        index;
     const char*    conf;
components/ksh93/patches/CR7105086.patch
New file
@@ -0,0 +1,46 @@
diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/jobs.c
--- a/src/cmd/ksh93/sh/jobs.c    Sun Mar 25 23:19:46 2012 -0700
+++ b/src/cmd/ksh93/sh/jobs.c    Mon Mar 26 05:09:19 2012 -0700
@@ -28,6 +28,9 @@
  *  Rewritten April, 1988
  *  Revised January, 1992
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #include    "defs.h"
 #include    <wait.h>
@@ -57,6 +60,7 @@
 {
     struct jobsave    *next;
     pid_t        pid;
+    short        curenv;
     unsigned short    exitval;
 };
@@ -232,6 +236,7 @@
         jp->pid = pid;
         jp->next = bck.list;
         bck.list = jp;
+        jp->curenv = 0;
         jp->exitval = 0;
     }
     return(jp);
@@ -1790,6 +1795,7 @@
             /* save status for future wait */
             if(jp = jobsave_create(pw->p_pid))
             {
+                jp->curenv = pw->p_env;
                 jp->exitval = pw->p_exit;
                 if(pw->p_flag&P_SIGNALLED)
                     jp->exitval |= SH_EXITSIG;
@@ -1967,7 +1973,7 @@
     for(jp=bck.list; jp; jp=jpnext)
     {
         jpnext = jp->next;
-        if(jp->pid==sh.spid)
+        if(jp->curenv != sh.curenv || jp->pid==sh.spid)
         {
             jp->next = bp->list;
             bp->list = jp;
components/ksh93/patches/CR7110983.patch
New file
@@ -0,0 +1,24 @@
diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/name.c
--- a/src/cmd/ksh93/sh/name.c    Sun Mar 25 23:19:46 2012 -0700
+++ b/src/cmd/ksh93/sh/name.c    Mon Mar 26 05:09:19 2012 -0700
@@ -22,6 +22,9 @@
  * AT&T Labs
  *
  */
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
 #define putenv    ___putenv
@@ -1832,7 +1835,10 @@
             else
 #endif
             if(size==0 && nv_isattr(np,NV_HOST)!=NV_HOST &&nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL))
+            {
                 nv_setsize(np,size=dot);
+                tofree = up->cp;
+            }
             else if(size > dot)
                 dot = size;
             else if(nv_isattr(np,NV_LJUST|NV_RJUST)==NV_LJUST && dot>size)
components/ksh93/patches/CRXXX_Error_Catalog.patch
New file
@@ -0,0 +1,11 @@
--- a/src/cmd/builtin/asa.c    Wed Nov  1 16:47:27 2006
+++ b/src/cmd/builtin/asa.c    Tue Jun 28 13:59:47 2011
@@ -110,7 +110,7 @@
     register Sfio_t    *fp;
     register int    n, reclen=0;
-    cmdinit(argc, argv,(void*)0,(const char*)0,0);
+    cmdinit(argc, argv, context, ERROR_CATALOG, 0);
     while (n = optget(argv, usage)) switch (n)
     {
         case 'r':
components/ksh93/patches/build_cflags.patch
New file
@@ -0,0 +1,36 @@
diff -rupN a/src/cmd/cs/Makefile b/src/cmd/cs/Makefile
--- a/src/cmd/cs/Makefile    2000-05-12 20:08:02.000000000 +0000
+++ b/src/cmd/cs/Makefile    2011-11-02 13:55:16.327160444 +0000
@@ -22,9 +22,9 @@ pid udp :SERVICE: pid.c
 rsh tcp :SERVICE: rsh.c
-tst-old tcp :SERVICE: CCFLAGS=-g tst-old.c
+tst-old tcp :SERVICE: CCFLAGS+=-g tst-old.c
-tst tcp :SERVICE: CCFLAGS=-g tst.c
+tst tcp :SERVICE: CCFLAGS+=-g tst.c
 6263 tcp :SERVICE: 6263.c
diff -rupN a/src/cmd/cs/Mamfile b/src/cmd/cs/Mamfile
--- a/src/cmd/cs/Mamfile    2011-02-09 05:47:50.000000000 +0000
+++ b/src/cmd/cs/Mamfile    2011-11-02 13:31:23.512475642 +0000
@@ -335,7 +335,7 @@ prev ${PACKAGE_ast_INCLUDE}/cs.h implici
 done tst-old.c
 meta tst-old.o %.c>%.o tst-old.c tst-old
 prev tst-old.c
-exec - ${CC} -g -I${PACKAGE_ast_INCLUDE} -D_PACKAGE_ast -c tst-old.c
+exec - ${CC}  ${mam_cc_FLAGS} ${CCFLAGS} -g -I${PACKAGE_ast_INCLUDE} -D_PACKAGE_ast -c tst-old.c
 done tst-old.o generated
 exec - ${CC} ${CCLDFLAGS} -g ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -o tst-old.svc tst-old.o ${mam_libcs} ${mam_libast}
 done tst-old.svc generated
@@ -350,7 +350,7 @@ meta tst.o %.c>%.o tst.c tst
 prev tst.c
 exec - ${CC} -g -I${PACKAGE_ast_INCLUDE} -D_PACKAGE_ast -c tst.c
 done tst.o generated
-exec - ${CC} ${CCLDFLAGS} -g ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -o tst.svc tst.o ${mam_libcs} ${mam_libast}
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} ${CCLDFLAGS} -g ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -o tst.svc tst.o ${mam_libcs} ${mam_libast}
 done tst.svc generated
 make 6263.svc
 make 6263.o
components/ksh93/patches/disable_dll.patch
New file
@@ -0,0 +1,16 @@
diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
--- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile    2012-04-11 17:12:31.210695651 +0100
+++ INIT.2011-02-08/src/cmd/ksh93/Makefile    2012-04-11 17:19:23.339887285 +0100
@@ -167,12 +167,6 @@ shell$(RELEASE) $(VERSION) id=shell :LIB
 "sol*.i386*"    :NOOPTIMIZE: main.c
 "win32*"    :NOOPTIMIZE: strdata.c trestore.c
-if CC.HOSTTYPE == "win32*"
-:DLL: $(CC.DEBUG)
-else
-:DLL: $(CC.OPTIMIZE)
-end
-
 :READONLY: $(DATAFILES)
 $(INCLUDEDIR) :INSTALLPROTO: nval.h shell.h history.h
components/ksh93/patches/multi_lang_arith.patch
New file
@@ -0,0 +1,12 @@
diff -rupN a/src/lib/libast/sfio/sfstrtof.h b/src/lib/libast/sfio/sfstrtof.h
--- a/src/lib/libast/sfio/sfstrtof.h    2010-12-24 14:32:27.000000000 +0000
+++ b/src/lib/libast/sfio/sfstrtof.h    2011-10-25 12:21:57.749942750 +0100
@@ -414,7 +414,7 @@ S2F_function(str, end) char* str; char**
             m = 0;
             fraction = digits;
         }
-        else if (c != thousand)
+        else if (c != thousand || (c == thousand && decimal == -1)
             break;
         else if (!(m = digits))
         {
components/ksh93/patches/package-pax-suid.patch
New file
@@ -0,0 +1,78 @@
diff -ru clean/bin/package patched/bin/package
--- clean/bin/package    Thu Feb  3 15:45:18 2011
+++ patched/bin/package    Wed Sep 21 13:21:39 2011
@@ -5111,7 +5111,7 @@
                         export INSTALLROOT VPATH
                         echo lib/$command
                         $MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
-                        ) | sort -u | pax -drw -ps $dest
+                        ) | sort -u | pax -drw $dest
                     )
                 fi
             fi
@@ -5916,7 +5916,7 @@
                     ;;
                 esac
             elif    test "" != "$PAX"
-            then    $exec pax -L --from=ascii --local -m -ps -rvf "$f" || {
+            then    $exec pax -L --from=ascii --local -m -rvf "$f" || {
                     code=1
                     continue
                 }
@@ -6010,7 +6010,7 @@
                     esac
                 }
                 # -m with delta bug fixed 2005-02-08
-                $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
+                $exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
                     code=1
                     continue
                 }
@@ -6052,7 +6052,7 @@
                     esac
                 }
                 # -m with delta bug fixed 2005-02-08
-                $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
+                $exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
                     code=1
                     continue
                 }
diff -ru clean/src/cmd/INIT/package.sh patched/src/cmd/INIT/package.sh
--- clean/src/cmd/INIT/package.sh    Thu Feb  3 15:45:16 2011
+++ patched/src/cmd/INIT/package.sh    Wed Sep 21 13:22:04 2011
@@ -5129,7 +5129,7 @@
                         export INSTALLROOT VPATH
                         echo lib/$command
                         $MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
-                        ) | sort -u | pax -drw -ps $dest
+                        ) | sort -u | pax -drw $dest
                     )
                 fi
             fi
@@ -5934,7 +5934,7 @@
                     ;;
                 esac
             elif    test "" != "$PAX"
-            then    $exec pax -L --from=ascii --local -m -ps -rvf "$f" || {
+            then    $exec pax -L --from=ascii --local -m -rvf "$f" || {
                     code=1
                     continue
                 }
@@ -6028,7 +6028,7 @@
                     esac
                 }
                 # -m with delta bug fixed 2005-02-08
-                $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
+                $exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
                     code=1
                     continue
                 }
@@ -6070,7 +6070,7 @@
                     esac
                 }
                 # -m with delta bug fixed 2005-02-08
-                $exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
+                $exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
                     code=1
                     continue
                 }
components/ksh93/patches/path_utmp.patch
New file
@@ -0,0 +1,24 @@
diff -rupN a/src/cmd/ss/ssd.c b/src/cmd/ss/ssd.c
--- a/src/cmd/ss/ssd.c    2010-06-09 16:06:54.000000000 +0100
+++ b/src/cmd/ss/ssd.c    2011-10-24 15:46:09.321811427 +0100
@@ -118,9 +118,6 @@ struct whod
 #if    !defined(UTMP_PATHNAME) && defined(UTMPX_PATHNAME)
 #define UTMP_PATHNAME    UTMPX_PATHNAME
 #endif
-#if    !defined(_PATH_UTMP) && defined(_PATH_UTMPX)
-#define _PATH_UTMP    _PATH_UTMPX
-#endif
 #else
@@ -142,8 +139,8 @@ static char*        usrfiles[] =
 #ifdef    UTMP_PATHNAME
     UTMP_PATHNAME,
 #endif
-#ifdef    _PATH_UTMP
-    _PATH_UTMP,
+#ifdef    _PATH_UTMPX
+    _PATH_UTMPX,
 #endif
 #if _hdr_utmpx
     "/etc/utmpx",
components/ksh93/patches/solaris_alias.patch
New file
@@ -0,0 +1,363 @@
diff -rupN b/lib/package/ast-base.pkg a/lib/package/ast-base.pkg
--- b/lib/package/ast-base.pkg    2009-09-21 20:35:51.000000000 +0000
+++ a/lib/package/ast-base.pkg    2011-11-10 16:24:52.515495613 +0000
@@ -3,7 +3,7 @@ ast-base :PACKAGE: \
         libdll libexpr libodelta librecsort libsum libuu libvdelta \
         libbz libz tests 3d coshell cpp cs mam msgcc nmake probe ss \
         libcoshell libcs libmam libpp libcodex paxlib codexlib \
-        libdss libpz dsslib
+        libdss libpz dsslib alias
 :COVERS: ast-make ast-ksh ast-ast
diff -rupN b/src/cmd/alias/alias.c a/src/cmd/alias/alias.c
--- b/src/cmd/alias/alias.c    1970-01-01 00:00:00.000000000 +0000
+++ a/src/cmd/alias/alias.c    2011-11-10 16:24:28.356925339 +0000
@@ -0,0 +1,255 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * alias.c is a C version of the alias.sh wrapper (which links ksh
+ * builtins to commands in /usr/bin/, e.g. calling this wrapper as
+ * /usr/bin/alias will call the ksh "alias" builtin, running it as
+ * /usr/bin/cut will call the ksh "cut" builtin etc.
+ */
+
+#include <shell.h>
+#include <nval.h>
+#include <stdio.h>
+#include <alias.h>
+
+typedef struct {
+    const char *name;
+    int (* func)(int, char **, void *);
+} bfastpathrec;
+
+/*
+ * We've disabled the "fastpath" codepath for some commands below
+ * because it causes a paradoxon for large input files (as used by
+ * ON PerfPIT for testing). For /usr/bin/rev (where the issue was
+ * first discovered) it looks like this:
+ * - for small files like /etc/profile the fastpath is faster in a loop
+ *   with 1000 iterations (8 seconds with fastpath, 14 seconds without
+ *   fastpath)
+ * - for large files (/usr/pub/UTF-8 replicated until the test file
+ *   reaches 24884706 bytes) the benchmark reverses: The fastpath now
+ *   needs 40 seconds and without fastpath it needs 30 seconds (for 100
+ *   iterations).
+ */
+#if 0
+#define    ENABLE_PERFORMANCE_PARADOXON 1
+#endif
+
+/*
+ * List of libcmd builtins which do not require a |Shell_t| context.
+ * This list was automatically generated from <ast/cmdext.h>
+ */
+static const
+bfastpathrec fastpath_builtins[] =
+{
+    /* This list must be alphabetically sorted for |strcmp()| usage */
+    { "basename",    b_basename    },
+    { "cat",    b_cat        },
+    { "chgrp",    b_chgrp        },
+    { "chmod",    b_chmod        },
+    { "chown",    b_chown        },
+#ifdef ENABLE_PERFORMANCE_PARADOXON
+    { "cksum",    b_cksum        },
+#endif /* ENABLE_PERFORMANCE_PARADOXON */
+    { "cmp",    b_cmp        },
+    { "comm",    b_comm        },
+    { "cp",        b_cp        },
+    { "cut",    b_cut        },
+    { "date",    b_date        },
+    { "dirname",    b_dirname    },
+    { "expr",    b_expr        },
+    { "fds",    b_fds        },
+    { "fmt",    b_fmt        },
+    { "fold",    b_fold        },
+    { "getconf",    b_getconf    },
+    { "head",    b_head        },
+    { "id",        b_id        },
+    { "join",    b_join        },
+    { "ln",        b_ln        },
+    { "logname",    b_logname    },
+    { "md5sum",    b_md5sum    },
+    { "mkdir",    b_mkdir        },
+    { "mkfifo",    b_mkfifo    },
+    { "mktemp",    b_mktemp    },
+    { "mv",        b_mv        },
+    { "paste",    b_paste     },
+    { "pathchk",    b_pathchk    },
+    { "pids",    b_pids        },
+#ifdef ENABLE_PERFORMANCE_PARADOXON
+    { "rev",    b_rev        },
+#endif /* ENABLE_PERFORMANCE_PARADOXON */
+    { "rm",        b_rm        },
+    { "rmdir",    b_rmdir        },
+    { "stty",    b_stty        },
+#ifdef ENABLE_PERFORMANCE_PARADOXON
+    { "sum",    b_sum        },
+#endif /* ENABLE_PERFORMANCE_PARADOXON */
+    { "sync",    b_sync        },
+    { "tail",    b_tail        },
+    { "tee",    b_tee        },
+    { "tty",    b_tty        },
+    { "uname",    b_uname        },
+    { "uniq",    b_uniq        },
+    { "wc",        b_wc        },
+    { NULL,     (int (*)(int, char **, void *))NULL }
+};
+
+static inline
+const bfastpathrec *
+find_bfastpathrec(const char *name)
+{
+    unsigned int i;
+    signed int cmpres;
+    for (i = 0; fastpath_builtins[i].name != NULL; i++) {
+        cmpres = strcmp(fastpath_builtins[i].name, name);
+        if (cmpres == 0)
+            return (&fastpath_builtins[i]);
+        else if (cmpres > 0)
+            return (NULL);
+
+    }
+    return (NULL);
+}
+
+static inline
+int
+fastpath_builtin_main(const bfastpathrec *brec, int argc, char *argv[])
+{
+    setlocale(LC_ALL, ""); /* calls |_ast_setlocale()| */
+
+    return ((*brec->func)(argc, argv, NULL));
+}
+
+
+/* Builtin script, original derived from alias.sh */
+static const char *script = "\n"
+/* Get name of builtin */
+"typeset cmd=\"${0##*/}\"\n"
+/*
+ * If the requested command is not an alias load it explicitly
+ * to make sure it is not bound to a path (those built-ins which
+ * are mapped via shell aliases point to commands which are
+ * "special shell built-ins" which cannot be bound to a specific
+ * PATH element) - otherwise we may execute the wrong command
+ * if an executable with the same name sits in a PATH element
+ * before /usr/bin (e.g. /usr/xpg4/bin/ls would be executed
+ * before /usr/bin/ls if the path was something like
+ * PATH=/usr/xpg4/bin:/usr/bin).
+ */
+"if [[ \"${cmd}\" != ~(Elr)(alias|unalias|command) ]] && "
+    "! alias \"${cmd}\" >/dev/null 2>&1 ; then\n"
+    "PATH='' builtin \"${cmd}\"\n"
+"fi\n"
+/* command is a keyword and needs to be handled separately */
+"if [[ \"${cmd}\" == \"command\" ]] ; then\n"
+    "command \"$@\"\n"
+"else\n"
+#ifdef WORKAROUND_FOR_ALIAS_CRASH
+/*
+ * Work around a crash in /usr/bin/alias when invalid options are
+ * passed (e.g. $ /usr/bin/alias -c #). The shell code will call
+ * an error handler which does a |longjmp()| but somehow the code
+ * failed to do the |setjmp()| before this point.
+ * Putting the "alias" command in a subshell avoids the crash.
+ * Real cause of the issue is under investigation and a fix be
+ * delivered with the next ast-ksh update.
+ */
+    "( \"${cmd}\" \"$@\" )\n"
+#else
+    "\"${cmd}\" \"$@\"\n"
+#endif /* WORKAROUND_FOR_ALIAS_CRASH */
+"fi\n"
+"exitval=$?";
+
+
+static inline
+int
+script_builtin_main(int argc, char *argv[])
+{
+    int i;
+    Shell_t *shp;
+    Namval_t *np;
+    int exitval;
+
+    /*
+     * Create copy of |argv| array shifted by one position to
+     * emulate $ /usr/bin/sh <scriptname> <args1> <arg2> ... #.
+     * First position is set to "/usr/bin/sh" since other
+     * values may trigger special shell modes (e.g. *rsh* will
+     * trigger "restricted" shell mode etc.).
+     */
+    char *xargv[argc+2];
+    xargv[0] = "/usr/bin/sh";
+    xargv[1] = "scriptname";
+    for (i = 0; i < argc; i++) {
+        xargv[i+1] = argv[i];
+    }
+    xargv[i+1] = NULL;
+
+    shp = sh_init(argc+1, xargv, 0);
+    if (!shp)
+        error(ERROR_exit(1), "shell initialisation failed.");
+    (void) sh_trap(script, 0);
+
+    np = nv_open("exitval", shp->var_tree, 0);
+    if (!np)
+        error(ERROR_exit(1), "variable %s not found.", "exitval");
+    exitval = (int)nv_getnum(np);
+    nv_close(np);
+
+    return (exitval);
+}
+
+int
+main(int argc, char *argv[])
+{
+    const char *progname;
+    const bfastpathrec *brec;
+    char execnamebuff[PATH_MAX+1];
+
+    /* Get program name */
+    if (pathprog(argv[0], execnamebuff, sizeof (execnamebuff)) <= 0)
+        error(ERROR_exit(1), "could not determinate exec name.");
+
+    progname = (const char *)strrchr(execnamebuff, '/');
+    if (progname != NULL) {
+        progname++;
+    }
+    else
+    {
+        progname = execnamebuff;
+    }
+
+    /* Execute command... */
+    if (brec = find_bfastpathrec(progname)) {
+        /* ... either via a fast path (calling the code directly) ... */
+        return (fastpath_builtin_main(brec, argc, argv));
+    }
+    else
+    {
+        /* ... or from within a full shell. */
+        return (script_builtin_main(argc, argv));
+    }
+}
diff -rupN b/src/cmd/alias/alias.h a/src/cmd/alias/alias.h
--- b/src/cmd/alias/alias.h    1970-01-01 00:00:00.000000000 +0000
+++ a/src/cmd/alias/alias.h    2011-11-10 16:24:28.357387725 +0000
@@ -0,0 +1,79 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*          Copyright (c) 1992-2011 AT&T Intellectual Property          *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                    by AT&T Intellectual Property                     *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf@research.att.com>                  *
+*                  David Korn <dgk@research.att.com>                   *
+*                                                                      *
+***********************************************************************/
+
+extern int b_asa (int, char**, void *);
+extern int b_basename (int, char**, void *);
+extern int b_cat (int, char**, void *);
+extern int b_chgrp (int, char**, void *);
+extern int b_chmod (int, char**, void *);
+extern int b_chown (int, char**, void *);
+extern int b_cksum (int, char**, void *);
+extern int b_cmp (int, char**, void *);
+extern int b_comm (int, char**, void *);
+extern int b_cp (int, char**, void *);
+extern int b_cut (int, char**, void *);
+extern int b_date (int, char**, void *);
+extern int b_dirname (int, char**, void *);
+extern int b_egrep (int, char**, void *);
+extern int b_expr (int, char**, void *);
+extern int b_fds (int, char**, void *);
+extern int b_fgrep (int, char**, void *);
+extern int b_find (int, char**, void *);
+extern int b_fmt (int, char**, void *);
+extern int b_fold (int, char**, void *);
+extern int b_getconf (int, char**, void *);
+extern int b_grep (int, char**, void *);
+extern int b_head (int, char**, void *);
+extern int b_id (int, char**, void *);
+extern int b_join (int, char**, void *);
+extern int b_line (int, char**, void *);
+extern int b_ln (int, char**, void *);
+extern int b_logname (int, char**, void *);
+extern int b_ls (int, char**, void *);
+extern int b_md5sum (int, char**, void *);
+extern int b_mkdir (int, char**, void *);
+extern int b_mkfifo (int, char**, void *);
+extern int b_mktemp (int, char**, void *);
+extern int b_mv (int, char**, void *);
+extern int b_paste (int, char**, void *);
+extern int b_od (int, char**, void *);
+extern int b_pathchk (int, char**, void *);
+extern int b_pids (int, char**, void *);
+extern int b_pr (int, char**, void *);
+extern int b_rev (int, char**, void *);
+extern int b_readlink (int, char**, void *);
+extern int b_rm (int, char**, void *);
+extern int b_rmdir (int, char**, void *);
+extern int b_stty (int, char**, void *);
+extern int b_sum (int, char**, void *);
+extern int b_sync (int, char**, void *);
+extern int b_strings (int, char**, void *);
+extern int b_tail (int, char**, void *);
+extern int b_tee (int, char**, void *);
+extern int b_tr (int, char**, void *);
+extern int b_tty (int, char**, void *);
+extern int b_uname (int, char**, void *);
+extern int b_uniq (int, char**, void *);
+extern int b_vmstate (int, char**, void *);
+extern int b_wc (int, char**, void *);
+extern int b_who (int, char**, void *);
+extern int b_xgrep (int, char**, void *);
+extern int b_xargs (int, char**, void *);
diff -rupN b/src/cmd/alias/Makefile a/src/cmd/alias/Makefile
--- b/src/cmd/alias/Makefile    1970-01-01 00:00:00.000000000 +0000
+++ a/src/cmd/alias/Makefile    2011-11-10 16:24:28.357746164 +0000
@@ -0,0 +1,5 @@
+:PACKAGE: ast:static
+
+LICENSE = cddl
+libtype = :static
+alias :: RELEASE alias.c +lshell
components/ksh93/source-demo-ksh.p5m
New file
@@ -0,0 +1,58 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
# The man pages are all at the top of a "files" directory; setting the hash to
# point to the files therein.
<transform file path=usr/share/man/man.+/(.+)$ -> set action.hash %<\1> >
# Bypassing the mangler for these files because they are pre-Solarified.
<transform file path=usr/share/man/.+$ -> add mangler.bypass true >
set name=pkg.fmri \
    value=pkg:/source/demo/ksh@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.description value="Source code to demonstrate the KornShell"
set name=pkg.summary value="KornShell demos"
set name=info.classification value=org.opensolaris.category.2008:System/Core
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=info.upstream \
    value="AT&T Software Technology (AST) OpenSource Software Collection"
set name=info.upstream-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.arc-caseid value=PSARC/2012/002
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
dir path=usr group=sys
dir path=usr/demo
dir path=usr/demo/ksh
dir path=usr/demo/ksh/fun
dir path=usr/share/man/ja_JP.UTF-8/man1
dir path=usr/share/man/man1
file $(MACH64)/fun/dirs path=usr/demo/ksh/fun/dirs mode=0755 preserve=true
file $(MACH64)/fun/popd path=usr/demo/ksh/fun/popd mode=0755 preserve=true
file $(MACH64)/fun/pushd path=usr/demo/ksh/fun/pushd mode=0755 preserve=true
file $(MACH64)/fun/title path=usr/demo/ksh/fun/title mode=0755 preserve=true
file dirs.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/dirs.1
file popd.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/popd.1
file pushd.1.ja_JP.UTF-8 path=usr/share/man/ja_JP.UTF-8/man1/pushd.1
file path=usr/share/man/man1/dirs.1
file path=usr/share/man/man1/popd.1
file path=usr/share/man/man1/pushd.1
license ksh93.license license=CPL
make-rules/attpackagemake.mk
New file
@@ -0,0 +1,95 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#
#
# Rules and Macros for building opens source software that uses AT&T's package
# tool.
#
# To use these rules, include ../make-rules/attpackagemake.mk in your Makefile
# and define "build", "install" targets appropriate to building your component.
# Ex:
#
#     build:        $(BUILD_32) \
#             $(BUILD_64)
#
#    install:    $(INSTALL_32) \
#             $(INSTALL_64)
#
# Any additional pre/post configure, build, or install actions can be specified
# in your Makefile by setting them in on of the following macros:
#    COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
#    COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
#
# If component specific make targets need to be used for build or install, they
# can be specified in
#    COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
#
# Environment variables and arguments passed into the build and install
# environment(s).  These are the initial settings.
COMPONENT_BUILD_ENV += \
    CC="$(CC)" \
    CCFLAGS="$(CFLAGS)" \
    CCFLAGS.FORCE="$(CXXFLAGS)" \
    CC.RUNPATH="$(CC.RUNPATH)" \
    CC.LD.RUNPATH="$(CC.LD.RUNPATH)" \
    CC.LD.ORIGIN="$(CC.LD.ORIGIN)" \
    CC.DLL.ORIGIN="$(CC.DLL.ORIGIN)" \
    CCLDFLAGS="$(CXXFLAGS)" \
    LDOPTIONS="$(CXXFLAGS)" \
    NPROCS="$(NPROCS)" \
    LDFLAGS="$(CXXFLAGS)"
# This is a workaround for the AT&T nmake failing to always use
# the environmental CCFLAGS in sub-compiles
COMPONENT_BUILD_ARGS= $(COMPONENT_BUILD_ENV)
# build the configured source
$(BUILD_DIR)/%/.built:    $(SOURCE_DIR)/.prep
    $(RM) -r $(@D) ; $(MKDIR) $(@D)
    $(CLONEY) $(SOURCE_DIR) $(@D)
    $(COMPONENT_PRE_BUILD_ACTION)
    cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \
           bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS)
    $(COMPONENT_POST_BUILD_ACTION)
    $(TOUCH) $@
# install the built source into a prototype area
$(BUILD_DIR)/%/.installed:    $(BUILD_DIR)/%/.built
    $(COMPONENT_PRE_INSTALL_ACTION)
    $(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS));
    cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) \
        bin/package flat $(COMPONENT_INSTALL_TARGETS) \
        $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES)
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
# test the built source
$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
    $(COMPONENT_PRE_TEST_ACTION)
    cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) bin/package \
        test $(COMPONENT_TEST_TARGETS)
    $(COMPONENT_POST_TEST_ACTION)
    $(TOUCH) $@
clean::
    $(RM) -r $(BUILD_DIR) $(PROTO_DIR)
make-rules/prep.mk
@@ -21,6 +21,9 @@
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
# One must do all unpack and patch in sequence.
.NOTPARALLEL: (SOURCE_DIR)/.prep
UNPACK =    $(WS_TOOLS)/userland-unpack
FETCH =        $(WS_TOOLS)/userland-fetch
@@ -30,7 +33,8 @@
# In order to override PATCH_DIR and PATCH_PATTERN in component makefiles, they
# need to be conditionally set here.  This means that the override needs to
# happen prior to including prep.mk.  Otherwise other variables set here which
# are based on those will be expanded too early for the override to take effect.
# are based on those will be expanded too early for the override to take
# effect.
# You also can't override PATCHES after including prep.mk; if you want to
# append filenames to PATCHES, you'll have to set $(EXTRA_PATCHES) prior to
# inclusion.
@@ -43,22 +47,20 @@
PATCH_PATTERN ?=    *.patch
PATCHES =    $(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
                2>/dev/null | sort) $(EXTRA_PATCHES)
STAMPS =    $(PATCHES:$(PATCH_DIR)/%=$(SOURCE_DIR)/.%ed)
ifeq   ($(strip $(PARFAIT_BUILD)),yes)
STAMPS +=    $(PATCHES:$(PARFAIT_PATCH_DIR)/%=$(SOURCE_DIR)/.%ed)
endif
# Rule to perform the patching.
$(SOURCE_DIR)/.%ed:    $(PATCH_DIR)/%
    $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
    $(TOUCH) $@
# Parfait patches rule: TODO - Integrate with other patch rules
ifeq   ($(strip $(PARFAIT_BUILD)),yes)
$(SOURCE_DIR)/.%ed:    $(PARFAIT_PATCH_DIR)/%
    $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
    $(TOUCH) $@
endif
# template for download rules. add new rules with $(call download-rule, suffix)
# Template for download rules.
define download-rule
ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
@@ -69,21 +71,64 @@
    $$(TOUCH) $$@
endef
# Generate the download rules from the above template
NUM_ARCHIVES =    1 2 3 4 5 6 7
$(eval $(call download-rule,))
$(foreach suffix,$(NUM_ARCHIVES),$(eval $(call download-rule,_$(suffix))))
# Template for patching rules, note that patching is actually done by the
# %.ed pattern rule above.
# To maintain backwards compatibility, the flag PATCH_EACH_ARCHIVE must
# be non-empty in order to activate individual archive patching.
define patch-rule
ifneq ($(strip $$(PATCH_EACH_ARCHIVE)),)
# Prepend the patch directory to each archive patch.
#$$(COMPONENT_PATCHES$(1):%=$$(PATCH_DIR)/%)
#PATCHDIR_PATCHES$(1) += $$(COMPONENT_PATCHES)
PATCHDIR_PATCHES$(1) += $$(foreach patch,$$(COMPONENT_PATCHES$(1)), \
                         $$(PATCH_DIR)/$$(patch))
else
PATCHDIR_PATCHES = $$(PATCHES)
endif
# Substitute the patch dir for the source dir on the patches
STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
ifeq   ($(strip $(PARFAIT_BUILD)),yes)
STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
endif
$$(SOURCE_DIR)/.patched$(1): $$(SOURCE_DIR)/.unpacked$(1) $$(STAMPS$(1))
    $$(TOUCH) $$@
endef
$(SOURCE_DIR)/.unpacked:    download Makefile $(PATCHES)
    $(RM) -r $(SOURCE_DIR)
    $(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE)
    $(COMPONENT_POST_UNPACK_ACTION)
    $(TOUCH) $@
# Template for unpacking rules.
define unpack-rule
$$(SOURCE_DIR)/.unpacked$(1): download Makefile $$(PATCHDIR_PATCHES$(1))
    $$(RM) -r $$(COMPONENT_SRC$(1))
    $$(UNPACK) $$(UNPACK_ARGS$(1)) \
        $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
    $$(COMPONENT_POST_UNPACK_ACTION$(1))
    $$(TOUCH) $$@
endef
$(SOURCE_DIR)/.patched:    $(SOURCE_DIR)/.unpacked $(STAMPS)
    $(TOUCH) $@
# If an archive is defined, create a download, unpack and patch rule.
define archive-rule
ifneq ($(strip $$(COMPONENT_ARCHIVE$(1))),)
$(eval $(call download-rule,$(1)))
$(eval $(call unpack-rule,$(1)))
$(eval $(call patch-rule,$(1)))
ARCHIVE_STAMPS +=$$(SOURCE_DIR)/.patched$(1)
endif
endef
$(SOURCE_DIR)/.prep:    $(SOURCE_DIR)/.patched
# Calculate the number of defined archives.
# Always generate at least the basic prep rules.
# Work out if there are any other archives to be downloaded and patched.
NUM_EXTRA_ARCHIVES= 1 2 3 4 5 6 7 8 9
$(eval $(call archive-rule,))
ifneq ($(strip $(PATCH_EACH_ARCHIVE)),)
$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
    $(eval $(call archive-rule,_$(suffix))))
else
# Backwards compatibility - only download, do not unpack or patch automatically
$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
    $(eval $(call download-rule,_$(suffix))))
endif
$(SOURCE_DIR)/.prep: $(ARCHIVE_STAMPS)
    $(COMPONENT_PREP_ACTION)
    $(TOUCH) $@