Introduction....................................................... ii Organization of the Standard.................................... ii Base Documents.................................................. ii Related Standards Activities.................................... ii Section 1: General................................................. 1 1.1 Scope..................................................... 1 1.2 Normative References...................................... 13 1.3 Conformance............................................... 14 Section 2: Terminology and General Requirements.................... 21 2.1 Conventions............................................... 21 2.2 Definitions............................................... 26 2.3 Built-in Utilities........................................ 58 2.4 Character Set............................................. 61 2.5 Locale.................................................... 69 2.6 Environment Variables..................................... 119 2.7 Required Files............................................ 126 2.8 Regular Expression Notation............................... 128 2.9 Dependencies on Other Standards........................... 161 2.10 Utility Conventions....................................... 172 2.11 Utility Description Defaults.............................. 182 2.12 File Format Notation...................................... 198 2.13 Configuration Values...................................... 204 Section 3: Shell Command Language.................................. 215 3.1 Shell Definitions......................................... 217 3.2 Quoting................................................... 220 3.3 Token Recognition......................................... 224 3.4 Reserved Words............................................ 226 3.5 Parameters and Variables.................................. 228 3.6 Word Expansions........................................... 233 3.7 Redirection............................................... 249 3.8 Exit Status and Errors.................................... 255 3.9 Shell Commands............................................ 258 3.10 Shell Grammar............................................. 279 3.11 Signals and Error Handling................................ 288 3.12 Shell Execution Environment............................... 289 3.13 Pattern Matching Notation................................. 291 3.14 Special Built-in Utilities................................ 295 Section 4: Execution Environment Utilities......................... 317 4.1 awk - Pattern scanning and processing language............ 317 4.2 basename - Return nondirectory portion of pathname........ 358 4.3 bc - Arbitrary-precision arithmetic language.............. 362 4.4 cat - Concatenate and print files......................... 383 4.5 cd - Change working directory............................. 388 4.6 chgrp - Change file group ownership....................... 392 4.7 chmod - Change file modes................................. 395 4.8 chown - Change file ownership............................. 405 4.9 cksum - Write file checksums and sizes.................... 409 4.10 cmp - Compare two files................................... 416 4.11 comm - Select or reject lines common to two files......... 420 4.12 command - Execute a simple command........................ 424 4.13 cp - Copy files........................................... 430 4.14 cut - Cut out selected fields of each line of a file...... 440 4.15 date - Write the date and time............................ 445 4.16 dd - Convert and copy a file.............................. 452 4.17 diff - Compare two files.................................. 462 4.18 dirname - Return directory portion of pathname............ 471 4.19 echo - Write arguments to standard output................. 475 4.20 ed - Edit text............................................ 479 4.21 env - Set environment for command invocation.............. 498 4.22 expr - Evaluate arguments as an expression................ 503 4.23 false - Return false value................................ 509 4.24 find - Find files......................................... 511 4.25 fold - Fold lines......................................... 521 4.26 getconf - Get configuration values........................ 526 4.27 getopts - Parse utility options........................... 531 4.28 grep - File pattern searcher.............................. 537 4.29 head - Copy the first part of files....................... 545 4.30 id - Return user identity................................. 549 4.31 join - Relational database operator....................... 554 4.32 kill - Terminate or signal processes...................... 559 4.33 ln - Link files........................................... 566 4.34 locale - Get locale-specific information.................. 570 4.35 localedef - Define locale environment..................... 577 4.36 logger - Log messages..................................... 583 4.37 logname - Return user's login name........................ 586 4.38 lp - Send files to a printer.............................. 589 4.39 ls - List directory contents.............................. 595 4.40 mailx - Process messages.................................. 605 4.41 mkdir - Make directories.................................. 610 4.42 mkfifo - Make FIFO special files.......................... 614 4.43 mv - Move files........................................... 617 4.44 nohup - Invoke a utility immune to hangups................ 623 4.45 od - Dump files in various formats........................ 627 4.46 paste - Merge corresponding or subsequent lines of files..................................................... 637 4.47 pathchk - Check pathnames................................. 642 4.48 pax - Portable archive interchange........................ 648 4.49 pr - Print files.......................................... 665 4.50 printf - Write formatted output........................... 672 4.51 pwd - Return working directory name....................... 679 4.52 read - Read a line from standard input.................... 682 4.53 rm - Remove directory entries............................. 686 4.54 rmdir - Remove directories................................ 692 4.55 sed - Stream editor....................................... 695 4.56 sh - Shell, the standard command language interpreter..... 706 4.57 sleep - Suspend execution for an interval................. 713 4.58 sort - Sort, merge, or sequence check text files.......... 716 4.59 stty - Set the options for a terminal..................... 725 4.60 tail - Copy the last part of a file....................... 736 4.61 tee - Duplicate standard input............................ 742 4.62 test - Evaluate expression................................ 745 4.63 touch - Change file access and modification times......... 756 4.64 tr - Translate characters................................. 762 4.65 true - Return true value.................................. 770 4.66 tty - Return user's terminal name......................... 772 4.67 umask - Get or set the file mode creation mask............ 775 4.68 uname - Return system name................................ 780 4.69 uniq - Report or filter out repeated lines in a file...... 784 4.70 wait - Await process completion........................... 790 4.71 wc - Word, line, and byte count........................... 795 4.72 xargs - Construct argument list(s) and invoke utility..... 799 Section 5: User Portability Utilities Option....................... 807 Section 6: Software Development Utilities Option................... 809 6.1 ar - Create and maintain library archives................. 809 6.2 make - Maintain, update, and regenerate groups of programs.................................................. 818 6.3 strip - Remove unnecessary information from executable files..................................................... 844 Section 7: Language-Independent System Services.................... 847 7.1 Shell Command Interface................................... 848 7.2 Access Environment Variables.............................. 849 7.3 Regular Expression Matching............................... 849 7.4 Pattern Matching.......................................... 850 7.5 Command Option Parsing.................................... 850 7.6 Generate Pathnames Matching a Pattern..................... 850 7.7 Perform Word Expansions................................... 851 7.8 Get POSIX Configurable Variables.......................... 851 7.9 Locale Control............................................ 852 Annex A (normative) C Language Development Utilities Option........ 855 A.1 c89 - Compile Standard C programs......................... 856 A.2 lex - Generate programs for lexical tasks................. 867 A.3 yacc - Yet another compiler compiler...................... 884 Annex B (normative) C Language Bindings Option..................... 907 B.1 C Language Definitions.................................... 908 B.1.1 POSIX Symbols...................................... 908 B.1.2 Headers and Function Prototypes.................... 910 B.1.3 Error Numbers...................................... 911 B.2 C Numerical Limits........................................ 911 B.2.1 C Macros for Symbolic Limits....................... 912 B.2.2 Compile-Time Symbolic Constants for Portability Specifications..................................... 913 B.2.3 Execution-Time Symbolic Constants for Portability Specifications..................................... 914 B.2.4 POSIX.1 C Numerical Limits......................... 915 B.3 C Binding for Shell Command Interface..................... 915 B.3.1 C Binding for Execute Command...................... 916 B.3.2 C Binding for Pipe Communications with Programs.... 919 B.4 C Binding for Access Environment Variables................ 925 B.5 C Binding for Regular Expression Matching................. 925 B.6 C Binding for Match Filename or Pathname.................. 934 B.7 C Binding for Command Option Parsing...................... 937 B.8 C Binding for Generate Pathnames Matching a Pattern....... 942 B.9 C Binding for Perform Word Expansions..................... 948 B.10 C Binding for Get POSIX Configurable Variables............ 954 B.11 C Binding for Locale Control.............................. 957 Annex C (normative) FORTRAN Development and Runtime Utilities Options......................................................... 959 C.1 asa - Interpret carriage-control characters............... 960 C.2 fort77 - FORTRAN compiler................................. 964 Annex D (informative) Bibliography................................. 973 Annex E (informative) Rationale and Notes.......................... 977 E.1 General................................................... 977 E.2 Terminology and General Requirements...................... 978 E.3 Shell Command Language.................................... 979 E.4 Execution Environment Utilities........................... 980 E.5 User Portability Utilities Option......................... 993 E.6 Software Development Utilities Option..................... 993 E.7 Language-Independent System Services...................... 994 E.8 C Language Development Utilities Option................... 994 E.9 C Language Bindings Option................................ 995 E.10 FORTRAN Development and Runtime Utilities Options......... 996 Annex F (informative) Sample National Profile...................... 997 Annex G (informative) Balloting Instructions....................... 1091 Identifier Index................................................... 1105 Alphabetic Topical Index........................................... 1111