UNIX® Shells by Example Fourth Edition

Book description

The world’s #1 shell programming book—now fully updated for Linux and more!

UNIX Shells by Example is the world’s #1 shell programming book, from the world’s #1 shell programming instructor: Ellie Quigley. In UNIX Shells by Example, Fourth Edition, Quigley has thoroughly updated her classic and delivers the information today’s shell programmers need most—including comprehensive coverage of Linux shell programming with bash!

Drawing on 20 years’ experience as a shell programming instructor, Quigley guides you through every facet of programming all leading UNIX/Linux shells: bourne, bash, korn, C, and tcsh. Quigley illuminates each concept with up-to-date, classroom-tested code examples designed to help you jump-start your own projects. She also systematically introduces awk, sed, and grep for both UNIX and GNU/Linux . . . making this the only shell programming book you’ll ever need!

New in this edition:

  • Comprehensive coverage of Linux shell programming with bash

  • Shell Programming QuickStart: makes first-time shell programmers productive in just 15 pages

  • Complete, practical debugging chapter

  • Updated coverage of the latest UNIX and GNU/Linux versions of awk, sed, and grep

  • Shell programming for sysadmins: walks you through key UNIX and Linux system shell scripts

  • Completely updated:

  • Shell programming fundamentals: what shells are, what they do, how they work

  • Choosing the right shell for any application

  • Nearly 50,000 UNIX/Linux sysadmins, developers, and power users have used previous editions of UNIX Shells by Example to become expert shell programmers. With UNIX Shells by Example, Fourth Edition, you can, too—even if you’re completely new to shell programming. Then, once you’re an expert, you’ll turn to this book constantly as the best source for reliable answers, solutions, and code.

    About the CD-ROM

    Comprehensive shell programming code library: all source code and data files for this book’s hundreds of example programs.



    Table of contents

    1. Copyright
      1. Dedication
    2. Preface
      1. ACKNOWLEDGMENTS
    3. 1. Introduction to UNIX/Linux Shells
      1. 1.1. What Is UNIX? What Is Linux? A Little History
        1. 1.1.1. A Little Bit About UNIX
        2. 1.1.2. Why Linux?
          1. The Free Software Foundation
      2. 1.2. Definition and Function of a Shell
        1. 1.2.1. The UNIX Shells
        2. 1.2.2. The Linux Shells
          1. What Is POSIX?
      3. 1.3. History of the Shell
        1. 1.3.1. Uses of the Shell
        2. 1.3.2. Responsibilities of the Shell
      4. 1.4. System Startup and the Login Shell
        1. 1.4.1. Parsing the Command Line
        2. 1.4.2. Types of Commands
      5. 1.5. Processes and the Shell
        1. 1.5.1. What Processes Are Running?
          1. The ps Command
          2. The pstree/ptree Command
        2. 1.5.2. What Are System Calls?
        3. 1.5.3. Creating Processes
          1. The fork System Call
          2. The wait System Call
          3. The exec System Call
          4. The exit System Call
          5. Killing Processes
      6. 1.6. The Environment and Inheritance
        1. 1.6.1. Ownership and Permissions
        2. 1.6.2. The File Creation Mask
        3. 1.6.3. Changing Permissions and Ownership
          1. The chmod Command
          2. The chown Command
        4. 1.6.4. The Working Directory
        5. 1.6.5. Variables
        6. 1.6.6. Redirection and Pipes
          1. File Descriptors
          2. Redirection
          3. Pipes
        7. 1.6.7. The Shell and Signals
      7. 1.7. Executing Commands from Scripts
    4. 2. Shell Programming QuickStart
      1. 2.1. Taking a Peek at Shell Scripts
      2. 2.2. Sample Scripts: Comparing the Major Shells
        1. Before Getting Started
        2. The Purpose
      3. 2.3. The C and TC Shell Syntax and Constructs
        1. 2.3.1. The C/TC Shell Script
      4. 2.4. The Bourne Shell Syntax and Constructs
        1. 2.4.1. The Bourne Shell Script
      5. 2.5. The Korn Shell Constructs
        1. 2.5.1. The Korn Shell Script
      6. 2.6. The Bash Shell Constructs
        1. 2.6.1. The Bash Shell Script
    5. 3. Regular Expressions and Pattern Matching
      1. 3.1. Regular Expressions
        1. 3.1.1. Definition and Example
        2. 3.1.2. Regular Expression Metacharacters
      2. 3.2. Combining Regular Expression Metacharacters
        1. 3.2.1. More Regular Expression Metacharacters
    6. 4. The grep Family
      1. 4.1. The grep Command
        1. 4.1.1. The Meaning of grep
        2. 4.1.2. How grep Works
        3. 4.1.3. Metacharacters
        4. 4.1.4. grep and Exit Status
      2. 4.2. grep Examples with Regular Expressions
      3. 4.3. grep with Options
      4. 4.4. grep with Pipes
        1. 4.4.1. grep Review
      5. 4.5. egrep (Extended grep)
        1. 4.5.1. egrep Examples
        2. 4.5.2. egrep Review
      6. 4.6. fgrep (Fixed grep or Fast grep)
      7. 4.7. Linux and GNU grep
        1. 4.7.1. Basic and Extended Regular Expressions
          1. The POSIX Class
      8. 4.8. GNU Basic grep (grep –G) with Regular Expressions
      9. 4.9. grep –E or egrep (GNU Extended grep)
        1. 4.9.1. grep –E and egrep Examples
        2. 4.9.2. Anomalies with Regular and Extended Variants of grep
      10. 4.10. Fixed grep (grep –F and fgrep)
      11. 4.11. Recursive grep (rgrep, grep –R)
      12. 4.12. GNU grep with Options
      13. 4.13. grep with Options (UNIX and GNU)
        1. 4.13.1. GNU grep Options Examples
      14. LAB 1: grep EXERCISE
    7. 5. sed, the Streamlined Editor
      1. 5.1. What Is sed ?
      2. 5.2. Versions of sed
      3. 5.3. How Does sed Work?
      4. 5.4. Regular Expressions
      5. 5.5. Addressing
      6. 5.6. Commands and Options
        1. 5.6.1. How to Modify a File with sed
        2. 5.6.2. GNU sed Options
      7. 5.7. Error Messages and Exit Status
      8. 5.8. Metacharacters
      9. 5.9. sed Examples
        1. 5.9.1. Printing: The p Command
        2. 5.9.2. Deleting: The d Command
        3. 5.9.3. Substitution: The s Command
        4. 5.9.4. Range of Selected Lines: The Comma
        5. 5.9.5. Multiple Edits: The e Command
        6. 5.9.6. Reading from Files: The r Command
        7. 5.9.7. Writing to Files: The w Command
        8. 5.9.8. Appending: The a Command
        9. 5.9.9. Inserting: The i Command
        10. 5.9.10. Changing: The c Command
        11. 5.9.11. Next: The n Command
        12. 5.9.12. Transform: The y Command
        13. 5.9.13. Quit: The q Command
        14. 5.9.14. Holding and Getting: The h and g Commands
        15. 5.9.15. Holding and Exchanging: The h and x Commands
      10. 5.10. sed Scripting
        1. 5.10.1. sed Script Examples
        2. 5.10.2. sed Review
      11. LAB 2: sed EXERCISE
    8. 6. The awk Utility
      1. 6.1. What's awk? What's nawk? What's gawk?
        1. 6.1.1. What Does awk Stand For?
        2. 6.1.2. Which awk?
      2. 6.2. awk's Format
        1. 6.2.1. Input from Files
        2. 6.2.2. Input from Commands
      3. 6.3. How awk Works
      4. 6.4. Formatting Output
        1. 6.4.1. The print Function
          1. Escape Sequences
        2. 6.4.2. The OFMT Variable
        3. 6.4.3. The printf Function
      5. 6.5. awk Commands from Within a File
      6. 6.6. Records and Fields
        1. 6.6.1. Records
          1. The Record Separator
          2. The $0 Variable
          3. The NR Variable
        2. 6.6.2. Fields
        3. 6.6.3. Field Separators
          1. The Input Field Separator
          2. Changing the Field Separator at the Command Line
          3. Using More Than One Field Separator
          4. The Output Field Separator
      7. 6.7. Patterns and Actions
        1. 6.7.1. Patterns
        2. 6.7.2. Actions
      8. 6.8. Regular Expressions
        1. 6.8.1. Matching on an Entire Line
        2. 6.8.2. The match Operator
          1. The POSIX Character Class
      9. 6.9. awk Commands in a Script File
      10. 6.10. Review
        1. 6.10.1. Simple Pattern Matching
        2. 6.10.2. Simple Actions
        3. 6.10.3. Regular Expressions in Pattern and Action Combinations
        4. 6.10.4. Input Field Separators
        5. 6.10.5. awk Scripting
      11. LAB 3: awk EXERCISE
      12. 6.11. Comparison Expressions
        1. 6.11.1. Relational and Equality Operators
        2. 6.11.2. Conditional Expressions
        3. 6.11.3. Computation
        4. 6.11.4. Logical Operators and Compound Patterns
        5. 6.11.5. Range Patterns
        6. 6.11.6. A Data Validation Program
      13. 6.12. Review
        1. 6.12.1. Equality Testing
        2. 6.12.2. Relational Operators
        3. 6.12.3. Logical Operators (&&, ||)
        4. 6.12.4. Logical NOT Operator (!)
        5. 6.12.5. Arithmetic Operators
        6. 6.12.6. Range Operator
        7. 6.12.7. Conditional Operator
        8. 6.12.8. Assignment Operators
      14. LAB 4: awk EXERCISE
      15. 6.13. Variables
        1. 6.13.1. Numeric and String Constants
          1. Initialization and Type Coercion
        2. 6.13.2. User-Defined Variables
          1. Increment and Decrement Operators
          2. User-Defined Variables at the Command Line
          3. The –v Option (nawk)
          4. Field Variables
          5. Built-In Variables
        3. 6.13.3. BEGIN Patterns
        4. 6.13.4. END Patterns
      16. 6.14. Redirection and Pipes
        1. 6.14.1. Output Redirection
        2. 6.14.2. Input Redirection (getline)
          1. The getline Function
      17. 6.15. Pipes
        1. 6.15.1. Closing Files and Pipes
          1. The system Function
      18. 6.16. Review
        1. 6.16.1. Increment and Decrement Operators
        2. 6.16.2. Built-In Variables
        3. 6.16.3. BEGIN Patterns
        4. 6.16.4. END Patterns
        5. 6.16.5. awk Script with BEGIN and END
        6. 6.16.6. The printf Function
        7. 6.16.7. Redirection and Pipes
        8. 6.16.8. Opening and Closing a Pipe
      19. LAB 5: nawk EXERCISE
      20. 6.17. Conditional Statements
        1. 6.17.1. if Statements
        2. 6.17.2. if/else Statements
        3. 6.17.3. if/else and else if Statements
      21. 6.18. Loops
        1. 6.18.1. while Loop
        2. 6.18.2. for Loop
        3. 6.18.3. Loop Control
          1. break and continue Statements
      22. 6.19. Program Control Statements
        1. 6.19.1. next Statement
        2. 6.19.2. exit Statement
      23. 6.20. Arrays
        1. 6.20.1. Subscripts for Associative Arrays
          1. Using Variables As Array Indexes
          2. The Special-for Loop
          3. Using Strings As Array Subscripts
          4. Using Field Values As Array Subscripts
          5. Arrays and the split Function
          6. The delete Function
          7. Multidimensional Arrays (nawk)
        2. 6.20.2. Processing Command Arguments (nawk)
          1. ARGV
          2. ARGC
      24. 6.21. awk Built-In Functions
        1. 6.21.1. String Functions
          1. The sub and gsub Functions
          2. The index Function
          3. The length Function
          4. The substr Function
          5. The match Function
          6. The split Function
          7. The sprintf Function
      25. 6.22. Built-In Arithmetic Functions
        1. 6.22.1. Integer Function
        2. 6.22.2. Random Number Generator
          1. The rand Function
          2. The srand Function
      26. 6.23. User-Defined Functions (nawk)
      27. 6.24. Review
      28. LAB 6: nawk EXERCISE
      29. 6.25. Odds and Ends
        1. 6.25.1. Fixed Fields
          1. Empty Fields
          2. Numbers with $, Commas, or Other Characters
        2. 6.25.2. Multiline Records
        3. 6.25.3. Generating Form Letters
        4. 6.25.4. Interaction with the Shell
      30. LAB 7: nawk EXERCISE
      31. 6.26. awk Built-In Functions
        1. 6.26.1. String Functions
          1. The toupper and tolower Functions (gawk only)
        2. 6.26.2. Time Functions with gawk
          1. The systime Function
          2. The strftime Function
        3. 6.26.3. Command-Line Arguments
        4. 6.26.4. Reading Input (getline)
        5. 6.26.5. Control Functions
        6. 6.26.6. User-Defined Functions
        7. 6.26.7. awk/gawk Command-Line Options
    9. 7. The Interactiven Bourne Shell
      1. 7.1. Introduction
      2. 7.2. The Environment
        1. 7.2.1. The Initialization Files
          1. The /etc/profile File
          2. The .profile File
        2. 7.2.2. The Prompts
          1. The Primary Prompt
          2. The Secondary Prompt
        3. 7.2.3. The Search Path
        4. 7.2.4. The hash Command
        5. 7.2.5. The dot Command
      3. 7.3. The Command Line
        1. 7.3.1. The Exit Status
        2. 7.3.2. Multiple Commands at the Command Line
          1. Grouping Commands
        3. 7.3.3. Conditional Execution of Commands
        4. 7.3.4. Commands in the Background
      4. 7.4. Shell Metacharacters (Wildcards)
      5. 7.5. Filename Substitution
        1. 7.5.1. The Asterisk
        2. 7.5.2. The Question Mark
        3. 7.5.3. The Square Brackets
        4. 7.5.4. Escaping Metacharacters
      6. 7.6. Variables
        1. 7.6.1. Local Variables
          1. Setting Local Variables
          2. The Scope of Local Variables
          3. Setting Read-Only Variables
        2. 7.6.2. Environment Variables
          1. Setting Environment Variables
        3. 7.6.3. Listing Set Variables
        4. 7.6.4. Unsetting Variables
        5. 7.6.5. Printing the Values of Variables: The echo Command
        6. 7.6.6. Variable Expansion Modifiers
        7. 7.6.7. Positional Parameters
        8. 7.6.8. Other Special Variables
      7. 7.7. Quoting
        1. 7.7.1. The Backslash
        2. 7.7.2. Single Quotes
        3. 7.7.3. Double Quotes
      8. 7.8. Command Substitution
      9. 7.9. An Introduction to Functions
        1. 7.9.1. Defining Functions
        2. 7.9.2. Listing and Unsetting Functions
      10. 7.10. Standard I/O and Redirection
        1. 7.10.1. The exec Command and Redirection
      11. 7.11. Pipes
      12. 7.12. The here document and Input
        1. 7.12.1. Now What?
    10. 8. Programming the Bourne Shell
      1. 8.1. Introduction
        1. 8.1.1. The Steps in Creating a Shell Script
          1. The First Line
          2. Comments
          3. Executable Statements and Bourne Shell Constructs
          4. Making the Script Executable
          5. A Scripting Session
      2. 8.2. Reading User Input
      3. 8.3. Arithmetic
        1. 8.3.1. Integer Arithmetic and the expr Command
        2. 8.3.2. Floating-Point Arithmetic
      4. 8.4. Positional Parameters and Command-Line Arguments
        1. 8.4.1. The set Command and Positional Parameters
        2. 8.4.2. How $* and $@ Differ
      5. 8.5. Conditional Constructs and Flow Control
        1. 8.5.1. Testing Exit Status: The test Command
        2. 8.5.2. The if Command
        3. 8.5.3. The exit Command and the ? Variable
        4. 8.5.4. Checking for Null Values
        5. 8.5.5. The if/else Command
        6. 8.5.6. The if/elif/else Command
        7. 8.5.7. File Testing
        8. 8.5.8. The null Command
        9. 8.5.9. The case Command
        10. 8.5.10. Creating Menus with the here document and case Command
      6. 8.6. Looping Commands
        1. 8.6.1. The for Command
        2. 8.6.2. The $* and $@ Variables in Wordlists
        3. 8.6.3. The while Command
        4. 8.6.4. The until Command
        5. 8.6.5. Looping Control Commands
          1. The shift Command
          2. The break Command
          3. The continue Command
        6. 8.6.6. Nested Loops and Loop Control
        7. 8.6.7. I/O Redirection and Subshells
          1. Redirecting the Output of a Loop to a File
          2. Piping the Output of a Loop to a UNIX Command
        8. 8.6.8. Running Loops in the Background
        9. 8.6.9. The exec Command and Loops
        10. 8.6.10. IFS and Loops
      7. 8.7. Functions
        1. 8.7.1. Unsetting Functions
        2. 8.7.2. Function Arguments and the Return Value
        3. 8.7.3. Functions and the dot Command
          1. Storing Functions
      8. 8.8. Trapping Signals
        1. 8.8.1. Resetting Signals
        2. 8.8.2. Ignoring Signals
        3. 8.8.3. Listing Traps
        4. 8.8.4. Traps in Functions
        5. 8.8.5. Debugging
      9. 8.9. The Command Line
        1. 8.9.1. Processing Command-Line Options with getopts
          1. getopts Scripts
        2. 8.9.2. The eval Command and Parsing the Command Line
      10. 8.10. Shell Invocation Options
        1. 8.10.1. The set Command and Options
        2. 8.10.2. Shell Built-In Commands
      11. LAB 8: BOURNE SHELL—GETTING STARTED
      12. LAB 9: METACHARACTERS
      13. LAB 10: REDIRECTION
      14. LAB 11: FIRST SCRIPT
      15. LAB 12: COMMAND-LINE ARGUMENTS
      16. LAB 13: GETTING USER INPUT
      17. LAB 14: CONDITIONAL STATEMENTS
      18. LAB 15: CONDITIONALS AND FILE TESTING
      19. LAB 16: THE case STATEMENT
      20. LAB 17: LOOPS
      21. LAB 18: FUNCTIONS
    11. 9. The Interactive C and TC Shells
      1. 9.1. Introduction
        1. 9.1.1. C/TC Shell Startup
      2. 9.2. The Environment
        1. 9.2.1. Initialization Files
          1. The .cshrc and .tcshrc Files
          2. The .login File
        2. 9.2.2. The Search Path
        3. 9.2.3. The rehash Command
        4. 9.2.4. The hashstat Command
        5. 9.2.5. The source Command
        6. 9.2.6. The Shell Prompts
          1. The Primary Prompt.
          2. The Secondary Prompt.
      3. 9.3. The C/TC Shell Command Line
        1. 9.3.1. The Exit Status
        2. 9.3.2. Command Grouping
        3. 9.3.3. Conditional Execution of Commands
        4. 9.3.4. Commands in the Background
        5. 9.3.5. Command-Line History
          1. Setting History
          2. Saving History
          3. Displaying History
          4. Re-executing Commands
      4. 9.4. Aliases
        1. 9.4.1. Listing Aliases
        2. 9.4.2. Creating Aliases
        3. 9.4.3. Deleting Aliases
        4. 9.4.4. Alias Loop
      5. 9.5. Manipulating the Directory Stack
        1. 9.5.1. The pushd and popd Commands
      6. 9.6. Job Control
        1. 9.6.1. The Ampersand and Background Jobs
        2. 9.6.2. The Suspend Key Sequence and Background Jobs
        3. 9.6.3. The jobs Command
        4. 9.6.4. The Foreground and Background Commands
      7. 9.7. Shell Metacharacters
      8. 9.8. Filename Substitution
        1. 9.8.1. The Asterisk
        2. 9.8.2. The Question Mark
        3. 9.8.3. The Square Brackets
        4. 9.8.4. The Curly Braces
        5. 9.8.5. Escaping Metacharacters
        6. 9.8.6. Tilde Expansion
        7. 9.8.7. Filename Completion: The filec Variable
        8. 9.8.8. Turning Off Metacharacters with noglob
      9. 9.9. Redirection and Pipes
        1. 9.9.1. Redirecting Input
        2. 9.9.2. The here document
        3. 9.9.3. Redirecting Output
        4. 9.9.4. Appending Output to an Existing File
        5. 9.9.5. Redirecting Output and Error
        6. 9.9.6. Separating Output and Errors
        7. 9.9.7. The noclobber Variable
      10. 9.10. Variables
        1. 9.10.1. Curly Braces
        2. 9.10.2. Local Variables
          1. Setting Local Variables
          2. The set Command
          3. Read-Only Variables (tcsh)
          4. Built-In Local Variables
        3. 9.10.3. Environment Variables
          1. Printing Environment Variables
        4. 9.10.4. Arrays
          1. The shift Command and Arrays
          2. Creating an Array from a String
        5. 9.10.5. Special Variables
          1. Pathname Variable Modifiers
      11. 9.11. Command Substitution
        1. 9.11.1. Wordlists and Command Substitution
      12. 9.12. Quoting
        1. 9.12.1. The Backslash
        2. 9.12.2. Single Quotes
        3. 9.12.3. Double Quotes
        4. 9.12.4. The Quoting Game
          1. Quoting with the :q Modifier
          2. Quoting with the :x Modifier
      13. 9.13. New Features of the Interactive TC Shell
        1. 9.13.1. Versions of tcsh
        2. 9.13.2. The Shell Prompts
          1. The Primary Prompt.
          2. The Secondary Prompt.
      14. 9.14. The TC Shell Command Line
        1. 9.14.1. The Command Line and Exit Status
          1. Exit Status and the printexitvalue Variable
        2. 9.14.2. TC Shell Command-Line History
          1. The history Variable
          2. Saving History and the savehist Variable
          3. Displaying History
          4. Accessing Commands from the History File
        3. 9.14.3. The Built-In Command-Line Editors
          1. The bindkey Built-In Command
          2. The vi Built-In Editor
          3. The emacs Built-In Editor
          4. Binding Keys
      15. 9.15. TC Shell Command, Filename, and Variable Completion
        1. 9.15.1. The autolist Variable
        2. 9.15.2. The fignore Variable
        3. 9.15.3. The complete Shell Variable
        4. 9.15.4. Programming Completions
          1. Types of Completions
      16. 9.16. TC Shell Spelling Correction
      17. 9.17. TC Shell Aliases
        1. 9.17.1. Listing Aliases
        2. 9.17.2. Creating Aliases
        3. 9.17.3. Deleting Aliases
        4. 9.17.4. Alias Loop
        5. 9.17.5. Special tcsh Aliases
      18. 9.18. TC Shell Job Control
        1. 9.18.1. The jobs Command and the listjobs Variable
        2. 9.18.2. Foreground and Background Commands
        3. 9.18.3. Scheduling Jobs
      19. 9.19. Printing the Values of Variables in the TC Shell
        1. 9.19.1. The echo Command
        2. 9.19.2. The printf Command
        3. 9.19.3. Curly Braces and Variables
        4. 9.19.4. Uppercase and Lowercase Modifiers
      20. 9.20. TC Shell Built-In Commands
        1. 9.20.1. Special Built-In T/TC Shell Variables
        2. 9.20.2. TC Shell Command-Line Switches
      21. LAB 19: THE TC SHELL—GETTING STARTED
      22. LAB 20: HISTORY
      23. LAB 21: SHELL METACHARACTERS
      24. LAB 22: REDIRECTION
      25. LAB 23: VARIABLES AND ARRAYS
    12. 10. Programming the C and TC Shells
      1. 10.1. Introduction
        1. 10.1.1. The Steps in Creating a Shell Script
          1. The First Line
          2. Comments
          3. Making the Script Executable
          4. An Example Scripting Session
      2. 10.2. Reading User Input
        1. 10.2.1. The $< Variable
        2. 10.2.2. Creating a Wordlist from the Input String
      3. 10.3. Arithmetic
        1. 10.3.1. Arithmetic Operators
        2. 10.3.2. Floating-Point Arithmetic
      4. 10.4. Debugging Scripts
      5. 10.5. Command-Line Arguments
        1. 10.5.1. Positional Parameters and argv
      6. 10.6. Conditional Constructs and Flow Control
        1. 10.6.1. Testing Expressions
        2. 10.6.2. Precedence and Associativity
        3. 10.6.3. The if Statement
        4. 10.6.4. Testing and Unset or Null Variables
        5. 10.6.5. The if/else Statement
        6. 10.6.6. Logical Expressions
        7. 10.6.7. The if Statement and a Single Command
        8. 10.6.8. The if/else if Statement
        9. 10.6.9. Exit Status and the Status Variable
        10. 10.6.10. Exiting from a Shell Script
        11. 10.6.11. Using an Alias to Create an Error Message
        12. 10.6.12. Using the Status Variable in a Script
        13. 10.6.13. Evaluating Commands Within Conditionals
        14. 10.6.14. The goto
        15. 10.6.15. File Testing with the C Shell
        16. 10.6.16. The test Command and File Testing
        17. 10.6.17. Nesting Conditionals
        18. 10.6.18. File Testing with the TC Shell
        19. 10.6.19. The filetest Built-In (tcsh)
        20. 10.6.20. Additional TC Shell File-Testing Operators
        21. 10.6.21. The switch Command
          1. Nesting Switches
        22. 10.6.22. The here document and Menus
      7. 10.7. Looping Commands
        1. 10.7.1. The foreach Loop
        2. 10.7.2. The while Loop
        3. 10.7.3. The repeat Command
        4. 10.7.4. Looping Control Commands
          1. The shift Command
          2. The break Command
          3. Nested Loops and the repeat Command
          4. The continue Command
      8. 10.8. Interrupt Handling
      9. 10.9. setuid Scripts
      10. 10.10. Storing Scripts
      11. 10.11. Built-In Commands
      12. LAB 24: C/TC SHELLS—GETTING STARTED
      13. LAB 25: SHELL METACHARACTERS
      14. LAB 26: REDIRECTION
      15. LAB 27: FIRST SCRIPT
      16. LAB 28: GETTING USER INPUT
      17. LAB 29: COMMAND-LINE ARGUMENTS
      18. LAB 30: CONDITIONALS AND FILE TESTING
      19. LAB 31: THE switch STATEMENT
      20. LAB 32: LOOPS
    13. 11. The Interactive Korn Shell
      1. 11.1. Introduction
        1. 11.1.1. Startup
      2. 11.2. The Environment
        1. 11.2.1. The Initialization Files
          1. The /etc/profile File
          2. The .profile File
          3. The ENV File
          4. The set –o Options
        2. 11.2.2. The Prompts
          1. The Primary Prompt
          2. The Secondary Prompt
        3. 11.2.3. The Search Path
        4. 11.2.4. The dot Command
      3. 11.3. The Command Line
        1. 11.3.1. The Order of Processing Commands
        2. 11.3.2. The Exit Status
        3. 11.3.3. Multiple Commands and Command Grouping
        4. 11.3.4. Conditional Execution of Commands
        5. 11.3.5. Commands in the Background
        6. 11.3.6. Command-Line History
          1. The history Command/Redisplay Commands
          2. Re-executing Commands with the r Command
        7. 11.3.7. Command-Line Editing
          1. The vi Built-In Editor
          2. The emacs Built-In Editor
          3. FCEDIT and Editing Commands
      4. 11.4. Commenting and Filename Expansion
      5. 11.5. Aliases
        1. 11.5.1. Listing Aliases
        2. 11.5.2. Creating Aliases
        3. 11.5.3. Deleting Aliases
        4. 11.5.4. Tracked Aliases
      6. 11.6. Job Control
      7. 11.7. Metacharacters
      8. 11.8. Filename Substitution (Wildcards)
        1. 11.8.1. The Asterisk
        2. 11.8.2. The Question Mark
        3. 11.8.3. The Square Brackets
        4. 11.8.4. Escaping Metacharacters
        5. 11.8.5. Tilde and Hyphen Expansion
        6. 11.8.6. New ksh Metacharacters
        7. 11.8.7. The noglob Variable
      9. 11.9. Variables
        1. 11.9.1. Local Variables
          1. Setting and Referencing Local Variables
          2. The Scope of Local Variables
          3. Setting Read-Only Variables
        2. 11.9.2. Environment Variables
          1. Setting Environment Variables
          2. Special Environment Variables
        3. 11.9.3. Listing Set Variables
        4. 11.9.4. Unsetting Variables
        5. 11.9.5. Printing the Values of Variables
        6. 11.9.6. Escape Sequences
        7. 11.9.7. Variable Expressions and Expansion Modifiers
        8. 11.9.8. Variable Expansion of Substrings
        9. 11.9.9. Variable Attributes: The typeset Command
        10. 11.9.10. Positional Parameters
        11. 11.9.11. Other Special Variables
      10. 11.10. Quoting
        1. 11.10.1. The Backslash
        2. 11.10.2. Single Quotes
        3. 11.10.3. Double Quotes
      11. 11.11. Command Substitution
      12. 11.12. Functions
        1. 11.12.1. Defining Functions
        2. 11.12.2. Functions and Aliases
        3. 11.12.3. Listing Functions
        4. 11.12.4. Unsetting Functions
      13. 11.13. Standard I/O and Redirection
        1. 11.13.1. The exec Command and Redirection
        2. 11.13.2. Redirection and the Child Shell
      14. 11.14. Pipes
        1. 11.14.1. The here document and Redirecting Input
      15. 11.15. Timing Commands
        1. 11.15.1. The time Command
        2. 11.15.2. The TMOUT Variable
    14. 12. Programming the Korn Shell
      1. 12.1. Introduction
        1. 12.1.1. The Steps in Creating a Shell Script
          1. The First Line
          2. Comments
          3. Executable Statements and Korn Shell Constructs
          4. Naming and Storing Scripts
          5. Making a Script Executable
          6. Using a Script As an Argument to ksh
          7. A Scripting Session
      2. 12.2. Reading User Input
        1. 12.2.1. read and File Descriptors
        2. 12.2.2. Reading Through Files
      3. 12.3. Arithmetic
        1. 12.3.1. The Integer Type
        2. 12.3.2. Using Different Bases
        3. 12.3.3. Listing Integers
        4. 12.3.4. Arithmetic Operators and the let Command
      4. 12.4. Positional Parameters and Command-Line Arguments
        1. 12.4.1. The set Command and Positional Parameters
      5. 12.5. Conditional Constructs and Flow Control
        1. 12.5.1. Testing Exit Status and the $? Variable
        2. 12.5.2. The Old test Command
        3. 12.5.3. The New test Command
        4. 12.5.4. File Testing with Binary Operators
        5. 12.5.5. Expression Testing with Logical Operators
        6. 12.5.6. File Testing with Flags
        7. 12.5.7. The if Command
        8. 12.5.8. Using the Old-Style Bourne test
        9. 12.5.9. Using the New-Style Korn test
        10. 12.5.10. Using the Old-Style Bourne test with Numbers
        11. 12.5.11. The let Command and Testing Numbers
        12. 12.5.12. The if/else Command
        13. 12.5.13. The if/elif/else Command
        14. 12.5.14. The exit Command
        15. 12.5.15. The null Command
        16. 12.5.16. The case Command
          1. The case Command and the here document
      6. 12.6. Looping Commands
        1. 12.6.1. The for Command
        2. 12.6.2. The $* and $@ Variables in Wordlists
        3. 12.6.3. The while Command
        4. 12.6.4. The until Command
        5. 12.6.5. The select Command and Menus
        6. 12.6.6. Looping Control Commands
          1. The shift Command
          2. The break Command
          3. The continue Command
        7. 12.6.7. Nested Loops and Loop Control
        8. 12.6.8. I/O Redirection and Loops
          1. Redirecting the Output of a Loop to a File
          2. Piping the Output of a Loop to a UNIX Command
        9. 12.6.9. Running Loops in the Background
        10. 12.6.10. The exec Command and Loops
        11. 12.6.11. The IFS and Loops
      7. 12.7. Arrays
        1. 12.7.1. Creating Arrays with the set Command
      8. 12.8. Functions
        1. 12.8.1. Defining Functions
        2. 12.8.2. Listing and Unsetting Functions
        3. 12.8.3. Local Variables and the Return Value
        4. 12.8.4. Exported Functions
        5. 12.8.5. Function Options and the typeset Command
          1. Autoloaded Functions
      9. 12.9. Trapping Signals
        1. 12.9.1. Pseudo or Fake Signals
        2. 12.9.2. Resetting Signals
        3. 12.9.3. Ignoring Signals
        4. 12.9.4. Listing Traps
        5. 12.9.5. Traps and Functions
      10. 12.10. Coprocesses
      11. 12.11. Debugging
      12. 12.12. The Command Line
        1. 12.12.1. Processing Command-Line Options with getopts
          1. Sample getopts Scripts
      13. 12.13. Security
        1. 12.13.1. Privileged Scripts
        2. 12.13.2. Restricted Shells
      14. 12.14. Built-In Commands
      15. 12.15. Korn Shell Invocation Arguments
      16. LAB 33: KORN SHELL—GETTING STARTED
      17. LAB 34: HISTORY
      18. LAB 35: ALIASES AND FUNCTIONS
      19. LAB 36: SHELL METACHARACTERS
      20. LAB 37: TILDE EXPANSION, QUOTES, AND COMMAND SUBSTITUTION
      21. LAB 38: REDIRECTION
      22. LAB 39: JOB CONTROL
      23. LAB 40: WRITING THE info SHELL SCRIPT
      24. LAB 41: VARIABLE EXPANSION OF SUBSTRINGS
      25. LAB 42: THE lookup SCRIPT
      26. LAB 43: USING typeset
      27. LAB 44: THE if/else CONSTRUCT AND THE let COMMAND
      28. LAB 45: THE case STATEMENT
      29. LAB 46: THE select LOOP
      30. LAB 47: AUTOLOADING FUNCTIONS
    15. 13. The Interactive Bash Shell
      1. 13.1. Introduction
        1. 13.1.1. Versions of bash
        2. 13.1.2. Startup
          1. Changing the Shell at the Command Line
      2. 13.2. The Environment
        1. 13.2.1. The Initialization Files
          1. The /etc/profile File
          2. The ~/.bash_profile File
          3. The BASH_ENV (ENV) Variable
          4. The .bashrc File
          5. The /etc/bashrc File
          6. The ~/.profile File
          7. The ~/.bash–logout File
          8. Options to Prevent Startup Files from Being Executed
          9. The .inputrc File
        2. 13.2.2. Setting bash Options with the Built-In set and shopt Commands
          1. The set –o Options
          2. The shopt Built-In (Version 2.x+)
        3. 13.2.3. The Prompts
          1. The Primary Prompt
          2. Setting the Prompt with Special Escape Sequences
          3. The Secondary Prompt
        4. 13.2.4. The Search Path
        5. 13.2.5. The hash Command
        6. 13.2.6. The source or dot Command
      3. 13.3. The Command Line
        1. 13.3.1. The Order of Processing Commands
        2. 13.3.2. Built-In Commands and the help Command
        3. 13.3.3. Changing the Order of Command-Line Processing
        4. 13.3.4. The Exit Status
        5. 13.3.5. Multiple Commands at the Command Line
        6. 13.3.6. Command Grouping
        7. 13.3.7. Conditional Execution of Commands
        8. 13.3.8. Commands in the Background
      4. 13.4. Job Control
        1. 13.4.1. Job Control Commands and Options
          1. New jobs Options
          2. The disown Built-In
      5. 13.5. Command-Line Shortcuts
        1. 13.5.1. Command and Filename Completion
        2. 13.5.2. History
        3. 13.5.3. Accessing Commands from the History File
          1. The Arrow Keys
          2. The history Built-In Command
          3. The fc Command
          4. Re-executing History Commands (Bang! Bang!)
        4. 13.5.4. Command-Line Editing
          1. The vi Built-In Editor
          2. The emacs Built-In Editor
          3. FCEDIT and Editing Commands
      6. 13.6. Aliases
        1. 13.6.1. Listing Aliases
        2. 13.6.2. Creating Aliases
        3. 13.6.3. Deleting Aliases
      7. 13.7. Manipulating the Directory Stack
        1. 13.7.1. The dirs Built-In Command
        2. 13.7.2. The pushd and popd Commands
      8. 13.8. Metacharacters (Wildcards)
      9. 13.9. Filename Substitution (Globbing)
        1. 13.9.1. The Asterisk
        2. 13.9.2. The Question Mark
        3. 13.9.3. The Square Brackets
        4. 13.9.4. Brace Expansion
        5. 13.9.5. Escaping Metacharacters
        6. 13.9.6. Tilde and Hyphen Expansion
        7. 13.9.7. Controlling Wildcards (Globbing)
        8. 13.9.8. Extended Filename Globbing (bash 2.x)
      10. 13.10. Variables
        1. 13.10.1. Types of Variables
        2. 13.10.2. Naming Conventions
        3. 13.10.3. The declare Built-In
        4. 13.10.4. Local Variables and Scope
          1. Setting Local Variables
          2. Setting Read-Only Variables
        5. 13.10.5. Environment Variables
          1. Setting Environment Variables.
        6. 13.10.6. Unsetting Variables
        7. 13.10.7. Printing the Values of Variables
          1. The echo Command
          2. The printf Command.
        8. 13.10.8. Variable Expansion Modifiers (Parameter Expansion)
        9. 13.10.9. Variable Expansion of Substrings
        10. 13.10.10. Positional Parameters
        11. 13.10.11. Other Special Variables
      11. 13.11. Quoting
        1. 13.11.1. The Backslash
        2. 13.11.2. Single Quotes
        3. 13.11.3. Double Quotes
      12. 13.12. Command Substitution
      13. 13.13. Arithmetic Expansion
      14. 13.14. Order of Expansion
      15. 13.15. Arrays
      16. 13.16. Functions
        1. 13.16.1. Defining Functions
        2. 13.16.2. Listing and Unsetting Functions
      17. 13.17. Standard I/O and Redirection
        1. 13.17.1. The exec Command and Redirection
      18. 13.18. Pipes
        1. 13.18.1. The here document and Redirecting Input
      19. 13.19. Shell Invocation Options
        1. 13.19.1. The set Command and Options
        2. 13.19.2. The shopt Command and Options
      20. 13.20. Shell Built-In Commands
      21. LAB 48: bash SHELL—GETTING STARTED
      22. LAB 49: JOB CONTROL
      23. LAB 50: COMMAND COMPLETION, HISTORY, AND ALIASES
      24. LAB 51: SHELL METACHARACTERS
      25. LAB 52: REDIRECTION
      26. LAB 53: VARIABLES
    16. 14. Programming the Bash Shell
      1. 14.1. Introduction
        1. 14.1.1. The Steps in Creating a Shell Script
          1. The First Line
          2. Comments
          3. Executable Statements and bash Shell Constructs
          4. Making the Script Executable
          5. A Scripting Session
      2. 14.2. Reading User Input
        1. 14.2.1. Variables (Review)
        2. 14.2.2. The read Command
      3. 14.3. Arithmetic
        1. 14.3.1. Integers (declare and let Commands)
          1. The declare Command
          2. Listing Integers
          3. Representing and Using Different Bases
          4. The let Command
        2. 14.3.2. Floating-Point Arithmetic
      4. 14.4. Positional Parameters and Command-Line Arguments
        1. 14.4.1. Positional Parameters
        2. 14.4.2. The set Command and Positional Parameters
          1. How $* and $@ Differ
      5. 14.5. Conditional Constructs and Flow Control
        1. 14.5.1. Exit Status
        2. 14.5.2. The Built-In test and let Commands
          1. The test Command with Single Brackets
          2. The test Command with Double Brackets
          3. The let Command and Arithmetic with Double Parentheses
        3. 14.5.3. The if Command
          1. The exit Command and the ? Variable
          2. Checking for Null Values
          3. Nested if Commands
        4. 14.5.4. The if/else Command
        5. 14.5.5. The if/elif/else Command
        6. 14.5.6. File Testing
        7. 14.5.7. The null Command
        8. 14.5.8. The case Command
          1. Creating Menus with the here document and case Command
      6. 14.6. Looping Commands
        1. 14.6.1. The for Command
        2. 14.6.2. The $* and $@ Variables in Wordlists
        3. 14.6.3. The while Command
        4. 14.6.4. The until Command
        5. 14.6.5. The select Command and Menus
        6. 14.6.6. Looping Control Commands
          1. The shift Command
          2. The break Command
          3. The continue Command
          4. Nested Loops and Loop Control
        7. 14.6.7. I/O Redirection and Subshells
          1. Redirecting the Output of a Loop to a File
          2. Piping the Output of a Loop to a UNIX/Linux Command
        8. 14.6.8. Running Loops in the Background
        9. 14.6.9. The IFS and Loops
      7. 14.7. Functions
        1. 14.7.1. Unsetting Functions
        2. 14.7.2. Exporting Functions
        3. 14.7.3. Function Arguments and the Return Value
          1. Arguments
          2. The Built-In local Function
          3. The Built-In return Function
        4. 14.7.4. Functions and the source (or dot) Command
          1. Storing Functions
      8. 14.8. Trapping Signals
        1. 14.8.1. Resetting Signals
        2. 14.8.2. Ignoring Signals
        3. 14.8.3. Listing Traps
        4. 14.8.4. Traps and Functions
      9. 14.9. Debugging
      10. 14.10. The Command Line
        1. 14.10.1. Processing Command-Line Options with getopts
          1. Sample getopts Scripts
          2. Special getopts Variables
        2. 14.10.2. The eval Command and Parsing the Command Line
      11. 14.11. bash Options
        1. 14.11.1. Shell Invocation Options
        2. 14.11.2. The set Command and Options
        3. 14.11.3. The shopt Command and Options
      12. 14.12. Shell Built-In Commands
      13. LAB 54: bash SHELL—FIRST SCRIPT
      14. LAB 55: COMMAND-LINE ARGUMENTS
      15. LAB 56: GETTING USER INPUT
      16. LAB 57: CONDITIONAL STATEMENTS
      17. LAB 58: CONDITIONALS AND FILE TESTING
      18. LAB 59: THE case STATEMENT
      19. LAB 60: LOOPS
      20. LAB 61: FUNCTIONS
    17. 15. Debugging Shell Scripts
      1. 15.1. Introduction
      2. 15.2. Style Issues
      3. 15.3. Types of Errors
        1. 15.3.1. Runtime Errors
        2. 15.3.2. Naming Conventions
        3. 15.3.3. Insufficient Permissions
        4. 15.3.4. Path Problems
        5. 15.3.5. The Shbang Line
        6. 15.3.6. Sneaky Aliases
      4. 15.4. Probable Causes for Syntax Errors
        1. 15.4.1. Undefined and Misspelled Variables
        2. 15.4.2. Incomplete Programming Statements
          1. Missing Keywords
          2. Indentation
          3. if/endif Errors
          4. case and switch Errors
          5. Looping Errors
          6. Operator Errors
          7. Misusing an Operator
          8. Quoting Errors
          9. Quoting Metacharacters
          10. What You Should Know About Quotes
            1. The Backslash
            2. Single Quotes
            3. Double Quotes
            4. Backquotes
            5. Combining Quotes
            6. Setting the Shell Variable
          11. Problems with the here document
          12. File-Testing Errors
            1. Checking for File Existence in the Five Shells
        3. 15.4.3. Common Error Messages from the Big 5 Shells
          1. Common C/TC Shell Error Messages
          2. Common Bourne Shell Error Messages
          3. Common Korn Shell Error Messages
          4. Common Bash Error Messages
        4. 15.4.4. Logic Errors and Robustness
          1. Logical Operator Errors
          2. Relational Operator Errors
          3. Branching Errors
          4. Exit Status with an if Conditional
          5. Lacking Robustness
      5. 15.5. Tracing with Shell Options and the set Command
        1. 15.5.1. Debugging Bourne Shell Scripts
          1. Bourne Shell Debugging Options
        2. 15.5.2. Debugging C/TC Shell Scripts
        3. 15.5.3. Debugging Korn Shell Scripts
        4. 15.5.4. Debugging Bash Scripts
          1. Bash Invocation Options
          2. The set Command and Options
          3. The shopt Command and Options
      6. 15.6. Summary
    18. 16. The System Administrator and the Shell
      1. 16.1. Introduction
      2. 16.2. The Superuser
      3. 16.3. Becoming a Superuser with the su Command
        1. 16.3.1. Running Scripts As Root
          1. Running a Script in the Current Directory
        2. 16.3.2. Scripts That Run As Root (setuid Programs)
      4. 16.4. Boot Scripts
        1. 16.4.1. A Little Terminology
          1. The Kernel and init
          2. What Is a Run Level?
          3. Single-User Mode
          4. Boot Scripts
          5. What Is a Daemon?
        2. 16.4.2. An Example Boot Script—The cron Utility
          1. Creating a cron Instruction File (crontab File)
          2. The cron Boot Script
        3. 16.4.3. Writing a Portable Script
        4. 16.4.4. User-Specific Initialization Files
          1. Possible Files for /etc/skel
        5. 16.4.5. System-Wide Initialization Files
          1. /etc/profile
          2. /etc/bashrc
          3. /etc/csh.login
          4. /etc/csh.cshrc
      5. 16.5. Summary
        1. Bibliography
    19. A. Useful UNIX/Linux Utilities for Shell Programmers
      1. apropos—searches the whatis database for strings
      2. arch—prints the machine architecture (see uname -m)
      3. at, batch—executes commands at a later time
      4. awk—pattern scanning and processing language
      5. banner—makes posters
      6. basename—with a directory name delivers portions of the pathname
      7. bash—GNU Bourne Again Shell
      8. bc—processes precision arithmetic
      9. bdiff—compares two big files
      10. cal—displays a calendar
      11. cat—concatenates and displays files
      12. chfn—changes the finger information
      13. chmod—changes the permissions mode of a file
      14. chown—changes owner of file
      15. chsh—changes your login shell
      16. clear—clears the terminal screen
      17. cmp—compares two files
      18. compress—compress, uncompress, zcat compress, uncompress files, or display expanded files
      19. cp—copies files
      20. cpio—copies file archives in and out
      21. cron—the clock daemon
      22. crypt—encodes or decodes a file
      23. cut—removes selected fields or characters from each line of a file
      24. date—displays the date and time or sets the date
      25. dd—converts a file while copying it
      26. diff—compares two files for differences
      27. dos, xdos, dosexec, dosdebug—a Linux DOS emulator that runs MS-DOS and MS-DOS programs under Linux
      28. df—summarizes free disk space
      29. du—summarizes disk usage
      30. echo—echoes arguments
      31. egrep—searches a file for a pattern using full regular expressions
      32. expr—evaluates arguments as an expression
      33. fgrep—searches a file for a character string
      34. file—determines the type of a file by looking at its contents
      35. find—finds files
      36. finger—displays information about local and remote users
      37. fmt—simple text formatters
      38. fold—folds long lines
      39. ftp—file transfer program
      40. free—displays amount of free and used memory in the system
      41. fuser—identifies processes using files or sockets
      42. gawk—pattern scanning and processing language
      43. gcc, g++—GNU project C and C++ Compiler (v2.7)
      44. getopt(s)—parses command-line options
      45. grep—searches a file for a pattern
      46. groups—prints group membership of user
      47. gzip, gunzip, zcat—compresses or expands files
      48. head—outputs the first ten lines of a file(s)
      49. host—prints information about specified hosts or zones in DNS
      50. id—prints the username, user ID, group name, and group ID
      51. jsh—the standard, job control shell
      52. kill—sends a signal to terminate one or more processes
      53. killall—kills processes by name
      54. less—opposite of more
      55. line—reads one line
      56. ln—creates hard links to files
      57. logname—gets the name of the user running the process
      58. look—displays lines beginning with a given string
      59. lp—sends output to a printer (AT&T)
      60. lpr—sends output to a printer (UCB)
      61. lpstat—prints information about the status of the LP print service (AT&T)
      62. lpq—prints information about the status of the printer (UCB)
      63. ls—lists contents of directory
      64. mail, rmail—reads mail or sends mail to users
      65. mailx—interactive message processing system
      66. make—maintains, updates, and regenerates groups of related programs and files
      67. man—formats and displays the online manual pages
      68. manpath—determines user's search path for man pages
      69. mesg—permits or denies messages resulting from the write command
      70. mkdir—creates a directory
      71. more—browses or pages through a text file
      72. mtools—utilities to access DOS disks in UNIX
      73. mv—moves or renames files
      74. nawk—pattern scanning and processing language
      75. newgrp—logs into a new group
      76. news—prints news items
      77. nice—runs a command at low priority
      78. nohup—makes commands immune to hangups and quits
      79. od—octal dump
      80. pack, pcat, unpack—compresses and expands files
      81. passwd—changes the login password and password attributes
      82. paste—merges same lines of several files or subsequent lines of one file
      83. pcat—(see pack)
      84. pine—a Program for Internet News and E-mail
      85. pg—displays files one page at a time
      86. pr—prints files
      87. ping—reports if a remote system is reachable and alive
      88. ps—reports process status
      89. pstree—displays a tree of processes
      90. pwd—displays the present working directory name
      91. quota—displays users' disk usage and limits
      92. rcp—remote file copy
      93. rdate—gets the date and time via the network
      94. rgrep—a recursive, highlighting grep program
      95. rlogin—remote login
      96. rm—removes files from directories
      97. rmdir—removes a directory
      98. rsh—starts a remote shell
      99. ruptime—shows the host status of local machines
      100. rwho—who is logged in on local machines
      101. script—creates a typescript of a terminal session
      102. sed—streamlined editor
      103. size—prints section sizes in bytes of object files
      104. sleep—suspends execution for some number of seconds
      105. sort—sorts and/or merges files
      106. spell—finds spelling errors
      107. split—splits a file into pieces
      108. strings—finds any printable strings in an object or binary file
      109. stty—sets the options for a terminal
      110. su—become superuser or another user
      111. sum—calculates a checksum for a file
      112. sync—updates the superblock and sends changed blocks to disk
      113. tabs—sets tab stops on a terminal
      114. tail—displays the tail end of a file
      115. talk—allows you to talk to another user
      116. tar—stores and retrieves files from an archive file, normally a tape device
      117. tee—replicates the standard output
      118. telnet—communicates with a remote host
      119. test—evaluates an expression
      120. time—displays a summary of time used by this shell and its children
      121. timex—times a command; reports process data and system activity
      122. top—displays top CPU processes
      123. touch—updates access time and/or modification time of a file
      124. tput—initializes a terminal or queries the terminfo database
      125. tr—translates characters
      126. true—provides successful exit status
      127. tsort—topological sort
      128. tty—gets the name of the terminal
      129. umask—sets file-creation mode mask for permissions
      130. uname—prints name of current machine
      131. uncompress—restores files to their original state after they have been compressed using the compress command
      132. uniq—reports on duplicate lines in a file
      133. units—converts quantities expressed in standard scales to other scales
      134. unpack—expands files created by pack
      135. uucp—copies files to another system, UNIX-to-UNIX system copy
      136. uuencode, uudecode—encodes a binary file into ASCII text in order to send it through e-mail, or converts it back into its original form
      137. wc—counts lines, words, and characters
      138. what—extracts SCCS version information from a file by printing information found after the @(#) pattern
      139. which—locates a command and displays its pathname or alias (UCB)
      140. whereis—locates the binary, source, and manual page files for a command (UCB)
      141. who—displays who is logged on the system
      142. write—writes a message to another user
      143. xargs—constructs an argument list(s) and executes a command
      144. zcat—uncompresses a compressed file to standard output; Same as uncompress –c
      145. zipinfo—lists detailed information about a ZIP archive
      146. zmore—file perusal filter for crt viewing of compressed text
    20. B. Comparison of the Shells
      1. B.1. The Shells Compared
      2. B.2. tcsh versus csh
      3. B.3. bash versus sh
    21. CD-ROM Warranty
    22. About the CD-ROM

    Product information

    • Title: UNIX® Shells by Example Fourth Edition
    • Author(s): Ellie Quigley
    • Release date: September 2004
    • Publisher(s): Pearson
    • ISBN: 013147572X