CONTENTS Title Page Copyright Page Preface 1 Introduction to POSIX for OpenVMS 1.1 Using This Guide Part I The File System and Shell 2 File Systems in POSIX for OpenVMS 2.1 OpenVMS and POSIX File System Differences 2.1.1 Directory Hierarchies 2.1.2 Filenames and Pathnames 2.1.3 File Structures 2.1.4 File Protection 2.1.5 Special Files 2.1.6 Links Between Files 2.2 The OpenVMS File System 2.2.1 When to Use the OpenVMS File System 2.2.2 Modifying OpenVMS File System Characteristics 2.2.3 Displaying OpenVMS File System Characteristics 2.2.4 Referencing Files in the OpenVMS File System 2.3 The POSIX for OpenVMS Container File System 2.3.1 When to Use the Container File System 2.3.2 Commands in the POSIX for OpenVMS Container File System 2.4 Using the OpenVMS and POSIX for OpenVMS File Systems 2.4.1 Using Valid Pathnames in POSIX for OpenVMS 3 The POSIX for OpenVMS Shell Environment 3.1 Overview of the POSIX for OpenVMS Shell 3.2 POSIX for OpenVMS Commands 3.3 Invoking the POSIX for OpenVMS Shell 3.4 Waiting for the POSIX for OpenVMS Prompt 3.5 Starting a Shell Session 3.5.1 POSIX for OpenVMS Profile Files 3.5.2 The ENV Environment Variable 3.5.3 Invoking a Sub-Shell 3.6 Online Help 3.7 Moving from the POSIX for OpenVMS Shell to DCL 3.8 Determining the Environment 3.8.1 Determining the Command Language Interpreter 3.8.2 Determining the Current Working Directory 3.9 Special Files and Directories Required by POSIX for OpenVMS 3.10 POSIX for OpenVMS Shell Parameters 3.10.1 Setting a Shell Variable 3.10.2 Evaluating Shell Variables 3.10.3 Using Shell Variables 3.10.4 Displaying Shell Variables 3.10.5 Unsetting Shell Variables 3.10.6 Exporting Shell Variables 3.10.7 Environment Variables 3.10.8 Readonly Variables 3.11 Configuration Values 3.12 Treatment of Universal Time 3.13 POSIX for OpenVMS Processes and Job Control 3.13.1 Foreground and Background Jobs 3.13.2 Running Commands in the Foreground 3.13.3 Running Commands in the Background 3.13.4 Manipulating Background Jobs 3.14 Exiting the POSIX for OpenVMS Shell 3.15 Running Processes after Logging Off 4 POSIX for OpenVMS Commands 4.1 Commands in the POSIX Environment 4.2 Using the Terminal in the POSIX Environment 4.2.1 Command Line Editing 4.2.2 Recalling Commands 4.2.3 Controlling Terminal Actions 4.3 Redirecting Input, Output and Error Messages 4.3.1 Redirecting Output 4.3.2 Redirecting Input 4.3.3 Appending Redirected Output 4.3.4 Creating a Here-Document 4.3.5 Duplicating an Input File Descriptor 4.3.6 Duplicating an Output File Descriptor 4.3.7 Opening a File Descriptor for Reading and Writing 4.3.8 Word Expansion 4.4 Using Pipelines to Create Compound Commands 4.5 Grouping Commands into Lists 4.5.1 Creating Sequential Lists 4.5.2 Creating Asynchronous Lists 4.5.3 Creating AND Lists 4.5.4 Creating OR Lists 4.6 Using the Grouping Operators to Create Compound Commands 5 POSIX for OpenVMS Shell Notation 5.1 Using the POSIX for OpenVMS Special Notation 5.2 Quoting Characters to Remove Special Meanings 5.2.1 The Single Quote Character 5.2.2 Double Quotes 5.2.3 The Backslash 5.2.4 Quoting Positional Parameters 5.2.5 Removing Quote Characters 5.3 Pattern Matching Notation 5.3.1 Wildcard Notation 5.3.2 Regular Expressions and Extended Regular Expressions 6 Programming the POSIX for OpenVMS Shell 6.1 Creating a POSIX for OpenVMS Shell Script 6.2 Executing a Shell Script 6.3 Expanding a POSIX for OpenVMS Shell Command 6.3.1 Alias Substitution 6.3.2 Tilde Expansion 6.3.3 Parameter Expansion 6.3.4 Command Substitution 6.3.5 Arithmetical Expansion 6.3.6 Field Splitting 6.3.7 Pathname Expansion 6.3.8 Quote Removal 6.4 Shell Scripts, Parameters and Variables 6.4.1 Evaluating Environment Variables 6.4.2 Using Parameters to Obtain Information About the Shell 6.4.3 Exporting Variables 6.4.4 Using Operators to Manipulate Variables 6.5 Testing Conditions Within a Shell Script 6.5.1 Other Uses for the test Utility 6.5.2 Combining Test Expressions 6.5.3 Testing the Exit Status 6.6 Command Control in Shell Scripts 6.7 Using the Conditional Statements 6.7.1 Using the if Conditional Statement 6.7.2 Using the case Conditional Statement 6.8 Looping Within a Shell Script 6.8.1 Using the for Loop 6.8.2 Using the while Loop 6.8.3 Using the until Loop 6.8.4 Nesting Control Structures 6.8.5 Controlling Command Execution 6.9 Creating Shell Functions 6.9.1 Returning Values from a Function 6.10 Terminating Scripts and Functions Part II The POSIX for OpenVMS Utilities Guides 7 A Guide to awk 7.1 Introduction 7.2 An awk Program 7.3 Input to awk Programs 7.4 Variables and Expressions 7.5 Symbol Table 7.6 Environment 7.7 Operators 7.8 Command Line Arguments 7.9 Built-In Arithmetical Functions 7.10 Built-In String Functions 7.11 The System Function 7.12 User-Defined Functions 7.13 Patterns and Actions 7.14 Output 8 A Guide to bc 8.1 Introduction 8.2 Numbers 8.3 Identifiers 8.4 Built-In Variables 8.4.1 Scale 8.4.2 Bases 8.4.3 Arithmetical Operations 8.4.4 Comments and White Space 8.4.5 Instructions 8.5 Functions 8.5.1 Built-In Functions 8.6 Dynamic Scoping 9 A Guide to dc 9.1 Introduction 9.2 Input 9.3 Reverse Polish Notation 9.4 The Scaling Factor 9.5 Basic Operators 9.6 Numbers in Different Bases 9.7 Executing Strings 9.8 Array Operations 9.9 Other Commands 9.10 Example 10 A Guide to lex 10.1 Introduction 10.2 lex Programs 10.3 Definitions 10.4 Rules 10.4.1 Token String and Length 10.4.2 Numbers and Values 10.5 Declarations 10.6 Using lex 10.6.1 The yylex( ) Function 10.6.2 The lex Table File 10.6.3 Generating and Compiling yylex( ) 10.6.4 The LEX Library 10.7 Error Detection and Recovery 10.8 Ambiguity and the Look-Ahead Facility 10.8.1 Resolving Ambiguities 10.8.2 The Look-Ahead Facility 10.8.3 Left Context Sensitivity 10.8.4 The Reject Action 10.8.5 Character Set 10.8.6 Linking lex Files 11 A Guide to make 11.1 Introduction 11.2 Macros 11.3 Special Characters 11.4 Rules 11.5 Metarules 11.6 Attributes 11.7 Special Targets 11.8 Special Macros 11.9 Making Libraries 11.10 Conditionals 11.11 Limits 11.12 Files Used by make 12 A Guide to the Revision Control System 12.1 Introduction 12.2 Functions of RCS 12.3 Getting Started with RCS 12.4 Automatic Identification 12.5 RCS States 12.6 Revision Numbers 12.7 Check Out by Date 12.8 Symbolic Names 12.9 Merging 12.10 More RCS Utilities 12.11 File Names 12.12 File Times 12.13 RCS Configuration 12.14 RCS File Format 12.15 RCS Editing for Log Messages and Text Descriptions 13 A Guide to yacc 13.1 Introduction 13.2 How the yacc Utility Works 13.2.1 The yyparse( ) and yylex( ) Routines 13.2.2 Grammar Rules 13.3 Input to yacc 13.3.1 The Declaration Section 13.3.2 Token Declarations 13.3.3 Precedence and Associativity 13.3.4 Variable and Function Declarations 13.3.5 Summary of the Output from yacc 13.4 Grammar Rules 13.4.1 Recognition Actions 13.4.2 Token and Symbol Values 13.4.3 Precedence in the Grammar Rules 13.4.4 The Start Symbol 13.4.5 The End Marker 13.4.6 Declarations in yyparse( ) 13.5 The Program Section 13.5.1 The Lexical Analyzer 13.6 Internal Structures 13.6.1 States 13.6.2 Diagramming States 13.6.3 State Actions 13.6.4 The Accept Action 13.6.5 The Shift Action 13.6.6 The Reduce Action 13.6.7 The Goto Action 13.6.8 The Error Action 13.7 Error Handling 13.7.1 The error Symbol 13.7.2 The Error Condition 13.7.3 Examples of Using Actions 13.7.4 Error Recognition Actions 13.7.5 The yyclearin Macro 13.7.6 The yyerror( ) Function 13.7.7 The yyerrok Macro 13.7.8 Other Error Support Routines 13.8 Output from yacc 13.8.1 Rules Summary 13.8.2 State Descriptions 13.8.3 Parser Statistics 13.9 Types 13.9.1 The Default Action 13.10 Ambiguities 13.10.1 Resolving Conflicts by Precedence 13.11 Disambiguating Rules 13.11.1 Conflicts in yacc Output 13.12 Advanced Features 13.12.1 LALR(2) Grammars 13.12.1.1 The Look-Ahead Action 13.12.1.2 The yy2lex( ) Routine 13.12.1.3 Conflicts 13.12.2 Multiple Actions 13.12.3 Selection Preference 13.12.4 Nonpositive Numbers in $N Constructs 13.12.5 Lists and Handling Null Strings 13.12.6 Right Versus Left Recursion 13.12.7 The YYDEBUG Symbol 13.12.8 Advanced Symbols Use 13.12.9 The YYERROR( ) Macro 13.12.10 The Default Action 13.12.11 Errors and Shift/Reduce Conflicts 13.12.12 Additional Information on yacc 13.12.13 The yacc Parser 13.12.14 yacc Differences 13.13 Files Produced or Used by the yacc Utility 13.14 Linking yacc Files