Information technology — Portable Operating System Interface (POSIX) — Part 2: Shell and Utilities

This part of ISO/IEC 9945 defines a standard source-code-level interface to command interpretation, or "shell," services and common utility programs for applica- tion programs. These services and programs are complementary to those specified by ISO/IEC 9945-1: 1990 (IEEE Std 1003.1-1990) {8}, hereinafter referred to as "POSIX.1 {8}." When the User Portability Utilities Option is included, this part of ISO/IEC 9945 has additional scope. The list of utilities and features is extended to provide a common interactive environment for system users and program developers. This part of ISO/IEC 9945 has been designed to be used by both application programmers and system implementors. When the User Portability Utilities Option is included, it is also to be used by system users and program developers. How- ever, it is intended to be a reference document and not a tutorial on the use of the services, the utilities, or the interrelationships between the utilities. The emphasis of this part of ISO/IEC 9945 without the User Portability Utilities Option is on the shell and utility functionality required by application programs (including "shell scripts") and not on the direct interactive use of the shell command language or the utilities by humans. When the User Portability Utilities Option is included, the emphasis is extended to support terminal users in a consistent manner across all conforming systems. There are three constraining factors that limit this user portability scope: (1) The users in this context are limited to the group of individuals who are familiar with the style of interaction characteristic of historically derived systems based on one of the UNIX operating systems. Typical users would include program developers, engineers, or general purpose time-sharing users. (2) The environment to be supported is a multi-user time-sharing system supporting character-oriented display terminals. Alternatively, it is a collection of single-user systems interconnected via local area networks or telephone lines, but with similar user interfaces. This part of ISO/IEC 9945 does not include support that is tailored for bit-mapped or graphics display terminals, although it is expected that such terminals could emu-late the character orientation required by this environment. When facili-ties require cursor addressability from the terminal hardware, this is specifically identified in this part ofISO/IEC 9945. (3) The facilities to be provided are based on the historical models of the fol- lowing documents: the System V Interface Definition {B37}, the BSD User Manual {B46}, the X/Open Portability Guide {B49}, and documentation for the KornShell {B38}. Emphasis is placed on standardizing existing practice for existing users, with changes or additions limited to correcting deficiencies in the following areas: (a) Support for international character sets and other localization requirements, such as date formats, collation sequences, etc. (b) Reconciliation of differences between the historical implementa­tions. (c) Elimination of system or device dependencies. (d) Corrections of features that could reduce system or user security/integrity. Portions of this part of ISO/IEC 9945 comprise optional language bindings to sys-tern service interfaces. (See, for example, the C-Language Bindings Option in Annex B.) This part of ISO/IEC 9945 is intended to describe language interfaces and utilities in sufficient detail so that an application developer can understand the required interfaces without access to the source code of existing implementations on which they may be based. Therefore, it does not attempt to describe the source programming language or internal design of the utilities; they should be , considered "black boxes" that exhibit the described functionality. For language interfaces, or functions, this part of ISO/IEC 9945 has been defined exclusively at the source-code level. The objective is that a conforming portable application sourc

Technologies de l'information — Interface pour la portabilité des systèmes (POSIX) — Partie 2: Enveloppe et services

General Information

Status
Withdrawn
Publication Date
22-Dec-1993
Withdrawal Date
22-Dec-1993
Current Stage
9599 - Withdrawal of International Standard
Completion Date
13-Dec-2002
Ref Project

Relations

Buy Standard

Standard
ISO/IEC 9945-2:1993 - Information technology -- Portable Operating System Interface (POSIX)
English language
300 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


I NTE R NAT I O N AL ISO/IEC
STANDARD
ANSIAEEE
Std 1003.2
First edition
1993-1 2-22
Information technology - Portable Operating
System Interface (POSIX) -
Part 2:
Shell and Utilities
Volume I
Technologies de l'information - Interface pour la portabilité des systèmes
lP0SlXl -
Partie 2: Enveloppe et services
Tome 1
Reference number
ISO/I EC 9945-2: 1993(E)
ANSIAEEE
Std 1003.2-1993
The Institute of Electrical and Electronics Engineers, Inc.
345 East 47th Street, New York, NY 10017-2394, USA
Copyright O 1993 by the
Institute of Electrical and Electronics Engineers, Inc.
All rights reserved. Published 1993
Printed in the United States ofAmerica
ISBN 1-55937-255-9
No part of this publication may be reproduced in any form,
in an electronic retrieval system or otherwise,
without the prior written permission ofthe publisher:
SHI 5628
December 22, 1993
International Standard ISO/IEC 9945-2: 1993
ANSUIEEE Std 1003.2-1992
(Includes ANSUIEEE Std 1003.2a-1992)
Information technology-
Portable Operating System Interface
(POSIX)-Part 2: Shell and Utilities
(Volume 1)
Sponsor
Technical Committee on Operating Systems and Application Environments
of the
IEEE Computer Society
Approved September 17,1992
IEEE Standards Board
Approved April 5, 1993
American National Standards Institute
Approved 1993 by the
International Organization for Standardization
and by the
International Electrotechnical Commission
Abstract: This standard is part of the POSM series of standards for applications
and user interfaces to open systems. It defines the applications interface to a shell
command language and a set of utility programs for complex data manipulation.
When the User Portability Utilities Option is included, the standard also defines a
common environment for general-purpose time-sharing users on character-oriented
display terminals .
Keywords: API, application portability, data processing, open systems, operating
system, portable application, POSIX, shell and utilities, user portability
Adopted as an International Standard by the
.\.l.’ International Organization for Standardization
IB
and by the
International Electrotechnical Commission
m
American National Standard
Published by
The Institute of Electrical and Electronics Engineers, Inc.

Foreword
IS0 (the International Organization for Standardization) and IEC (the International
Electrotechnical Commission) form the specialized system for worldwide standardiz-
ation. National bodies that are members of IS0 or IEC participate in the development
of International Standards through technical committees established by the respective
organization to deal with particular fields of technical activity. IS0 and IEC technical
committees collaborate in fields of mutual interest. Other international organizations,
governmental and non-govemmcntal, in liaison with IS0 and IEC, also take part in the
work.
In the field of information technology, IS0 and IEC have established a joint technical
committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint
technical committee are circulated to national bodies for voting. Publication as an
International Standard requires approval by at least 75 % of the national bodies casting
a vote.
International Standard ISO/IEC 9945-2: 1993 was prepared by Joint Technical
Committee ISO/IEC JTC 1, Information technology, subcommittee 22, Programming
languages, their environments and system sofiare interfaces.
ISO/IEC 9945 consists of the following parts, under the general title Information
technology - Portable Operating System Interface (POSIX):
- Part 1 : System application program inte face (API) [C language]
- Part 2: Shell and Utilities
- Part 3: System administration (under development)
Annexes A, B and C form an intcgral pan of this pan of ISODEC9945.
Annexes D, E, F, G and H are for information only.
International Organization for Standardizationflntemational Electrotechnical Commission
Case postale 56 * CH-1211 Genève 20 * Switzerland

IEEE Standards documents are developed within the Technical Committees of
the IEEE Societies and the Standards Coordinating Committees of the IEEE Stan-
dards Board. Members of the committees serve voluntarily and without compen-
sation. They are not necessarily members of the Institute. The standards
developed within IEEE represent a consensus of the broad expertise on the subject
within the Institute as well as those activities outside of IEEE that have expressed
an interest in participating in the development of the standard.
Use of an IEEE Standard is wholly voluntary. The existence of an IEEE Standard
does not imply that there are no other ways to produce, test, measure, purchase,
market, or provide other goods and services related to the scope of the IEEE Stan-
dard. Furthermore, the viewpoint expressed at the time a standard is approved
and issued is subject to change brought about through developments in the state
of the art and comments received from users of the standard. Every IEEE Stan-
dard is subjected to review at least every five years for revision or reaffirmation.
When a document is more than five years old and has not been reaffirmed, it is
reasonable to conclude that its contents, although still of some value, do not
wholly reflect the present state of the art. Users are cautioned to check to deter-
mine that they have the latest edition of any IEEE Standard.
Comments for revision of IEEE Standards are welcome from any interested party,
regardless of membership affiliation with IEEE. Suggestions for changes in docu-
ments should be in the form of a proposed change of text, together with appropri-
ate supporting comments.
Interpretations: Occasionally questions may arise regarding the meaning of por-
tions of standards as they relate to specific applications. When the need for
interpretations is brought to the attention of the IEEE, the Institute will initiate
action to prepare appropriate responses. Since IEEE Standards represent a con-
sensus of all concerned interests, it is important to ensure that any interpretation
has also received the concurrence of a balance of interests. For this reason, the
IEEE and the members of its technical committees are not able to provide an
instant response to interpretation requests except in those cases where the matter
has previously received formal consideration.
Comments on standards and requests for interpretations should be addressed to:
Secretary, IEEE Standards Board
445 Hoes Lane
P.O. Box 1331
Piscataway, NJ 08855-1331
IEEE Standards documents are adopted by the Institute of Electrical and Elec-
tronics Engineers without regard to whether their adoption may involve
patents on articles, materials, or processes. Such adoption does not assume
any liability to any patent owner, nor does it assume any obligation whatever to
parties adopting the standards documents.

Contents
PAGE
Foreword ix
......................
X
Introduction .
xi
..........
Organization of This Part of ISO/IEC 9945
................... xii
Base Documents .
Xlll
Related Standards Activities .
Sectionl: General .
1.1 Scope .
1.2 Normative References .
1.3 Conformance .
1.4 Test Methods .
........ 9
Section 2: Terminology and General Requirements
.................. 9
2.1 Conventions
................... 13
2.2 Definitions
2.3 Built-In Utilities . 39
2.4 Character Set . 40
..................... 44
2.5 Locale
2.6 Environment Variables . 73
.................. 77
2.7 Required Files
............. 77
2.8 Regular Expression Notation
2.9 Dependencies on Other Standards . 92
2.10 Utility Conventions . 97
2.11 Utility Description Defaults . 101
2.12 File Format Notation . 108
............... 111
2.13 Configuration Values
2.14 Terminal Characteristics . 114
Section 3: Shell Command Language . 117
3.1 Shell Introduction . 117
3.2 Quoting . 117
3.3 Token Recognition . 119
3.4 Reserved Words . 121
3.5 Parameters and Variables . 122
3.6 Word Expansions . 125
3.7 Redirection . 130
3.8 Exit Status and Errors . 133
3.9 Shell Commands . 135
3.10 Shell Grammar . 143
3.11 Signals and Error Handling . 149
3.12 Shell Execution Environment . 149
3.13 Pattern Matching Notation . 150
..
3.14 Special Built-In Utilities .
3.14.1 break-Exit from for. while. or until loop . 153
3.14.2 colon - Null utility .
3.14.3 continue - Continue for, while. or until loop . . 153
3.14.4 dot - Execute commands in current environment . 154
3.14.5 eval - Construct command by concatenating
arguments .
3.14.6 exec - Execute commands and open, close, and/or copy file
descriptors .
3.14.7 exit - Cause the shell to exit . 155
3.14.8 export - Set export attribute for variables . 155
3.14.9 readonly - Set read-only attribute for variables . 155
3.14.10 return - Return from a function . 156
3.14.11 set - Sethnset options and positional parameters . . 156
3.14.12 shift - Shift positional parameters . 159
3.14.13 trap - Trap signals . 160
3.14.14 unset - Unset values and attributes of variables and
functions .
Section 4: Execution Environment Utilities .
4.1 awk . Pattern scanning and processing language .
4.2 basename . Return nondirectory portion of pathname .
4.3 bc -Arbitrary-precision arithmeticlanguage .
4.4 cat . Concatenate and print files .
4.5 cd . Change working directory .
4.6 chgrp . Change file group ownership .
4.7 chmod - Change file modes . .
4.8 chow . Change file ownership .
4.9 cksum . Write file checksums and sizes .
4.10 cmp . Compare two files .
4.11 comm - Select or reject lines common to two files . 225
4.12 command . Execute a simple command . . 228
4.13 cp . Copy files .
4.14 cut . Cut out selected fields of each line of a file .
4.15 date . Write the date and time .
4.16 dd . Convert and copy a file .
4.17 dif f . Compare two files . .
4.18 dirname . Return directory portion of pathname .
4.19 echo . Write arguments to standard output .
4.20 ed - Edit text .
4.21 env . Set environment for command invocation .
4.22 expr . Evaluate arguments as an expression .
4.23 false . Return false value .
4.24 find-Findfiles . .
4.25 fold . Fold lines .
4.26 getconf . Get configuration values .
4.27 getopts . Parse utility options . , .
4.28 grep . File pattern searcher .
4.29 head . Copy the first part of files . 299
4.30 id - Return user identity .
...
4.31 j oin . Relational database operator .
4.32 ki 11 . Terminate or signal processes .
4.33 In . Link files .
4.34 locale . Get locale-specific information .
4.35 localedef . Define locale environment .
4.36 logger . Log messages .
4.37 logname . Return the login name of the user .
4.38 lp . Send files to a printer .
4.39 Is . List directory contents .
4.40 mai lx . Process messages .
4.41 mkdir . Make directories .
4.42 mkf i f o . Make FIFO special files .
4.43 mv . Move files .
4.44 nohup . Invoke a utility immune to hangups .
4.45 od . Dump files in various formats .
4.46 pas te . Merge corresponding or subsequent lines of files .
4.47 pathchk . Check pathnames .
4.48 pax . Portable archive interchange .
4.49 pr . Print files .
4.50 printf . Write formatted output .
4.51 pwd . Return working directory name . 396
4.52 read . Read a line from standard input .
4.53 rm . Remove directory entries .
4.54 rmdir . Remove directories .
4.55 sed . Stream editor .
4.56 sh . Shell, the standard command language interpreter . 414
4.57 sleep . Suspend execution for an interval .
4.58 sort . Sort, merge, or sequence check text files
...... 431
s t ty . Set the options for a terminal
4.59 . 437
4.60 tail . Copy the last part of a file . 444
4.61 tee . Duplicate standard input .
4.62 test . Evaluate expression .
4.63 touch . Change file access and modification times . 453
4.64 tr . Translate characters .
4.65 true . Return true value .
4.66 t ty . Return the terminal name of the user . 464
4.67 mask-Get or set the filemodecreationmask . 466
4.68 uname . Return system name .
4.69 uniq . Report or filter out repeated lines in a file .
4.70 wait . Await process completion . 474
wc . Word, line, and bytekharacter count .
4.71
4.72 xargs . Construct argument list(s) and invoke utility .
Section 5: User Portability Utilities Option . 485
5.1 alias . Define or display aliases .
5.2 at . Execute commands at a later time .
5.3 batch . Execute commands when the system load permits . .
5.4 bg . Run jobs in the background .
5.5 crontab-Scheduleperiodicbackgroundwork .
5.6 csplit - Split files based on context .
iv
.............. 505
5.7 ctags . Create a tags file
............. 509
5.8 df . Report free disk space
............ 512
5.9 du . Estimate file space usage
5.10 ex . Text editor .
expand . Convert tabs
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.