You are previewing Sams Teach Yourself Shell Programming in 24 Hours, Second Edition.
O'Reilly logo
Sams Teach Yourself Shell Programming in 24 Hours, Second Edition

Book Description

The vast majority of users utilize the Korn Shell or some variant of the Bourne Shell, such as bash. Sams Teach Yourself Shell Programming in 24 Hours covers these shells. It begins with a generalized tutorial of Unix and tools and then moves into detailed coverage of shell programming. Sams Teach Yourself Shell Programming in 24 Hours is one of the best values because it provides readers with more information for less money. This book uses the effective and proven 'Teach Yourself' format to instruct the reader how to make their shell work for them. It covers useful information including: managing input/output, manipulating text filters, understanding and debugging shell scripts, creating and utilizing variables, tools, processes, and customizing the shell.

Sams Teach Yourself Shell Programming in 24 Hours is a tutorial aimed at assisting Unix and Linux users to get optimal performance out of their operating system. It shows them how to take control of their systems and work efficiently by har4nessing the power of the shell to solve common problems.

Table of Contents

  1. Copyright
  2. About the Author
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
  6. Introduction to UNIX and Shell Tools
    1. Shell Basics
      1. What Is a Command?
      2. What Is the Shell?
      3. Summary
      4. Questions
      5. Terms
    2. Script Basics
      1. The UNIX System
      2. Shell Modes and Initialization
      3. Getting Help
      4. Summary
      5. Questions
      6. Terms
    3. Working with Files
      1. Listing Files
      2. File Contents
      3. Manipulating Files
      4. Summary
      5. Questions
      6. Terms
    4. Working with Directories
      1. The Directory Tree
      2. Switching Directories
      3. Listing Files and Directories
      4. Manipulating Directories
      5. Summary
      6. Questions
      7. Terms
    5. Input and Output
      1. Output
      2. Input
      3. File Descriptors
      4. Summary
      5. Questions
      6. Terms
    6. Manipulating File Attributes
      1. File Types
      2. Owners, Groups, and Permissions
      3. Summary
      4. Questions
      5. Terms
    7. Processes
      1. Starting a Process
      2. Listing and Terminating Processes
      3. Parent and Child Processes
      4. Summary
      5. Questions
      6. Terms
  7. Shell Programming
    1. Variables
      1. Working with Variables
      2. Environment and Shell Variables
      3. Summary
      4. Questions
      5. Terms
    2. Substitution
      1. Filename Substitution (Globbing)
      2. Variable Substitution
      3. Command and Arithmetic Substitution
      4. Summary
      5. Questions
      6. Terms
    3. Quoting
      1. Quoting with Backslashes
      2. Using Single Quotes
      3. Using Double Quotes
      4. Quoting Rules and Situations
      5. Summary
      6. Questions
      7. Terms
    4. Flow Control
      1. The if Statement
      2. The case Statement
      3. Summary
      4. Questions
      5. Terms
    5. Loops
      1. The while Loop
      2. The for and select Loops
      3. Loop Control
      4. Summary
      5. Questions
      6. Terms
    6. Parameters
      1. Special Variables
      2. Options and Arguments
      3. Option Parsing in Shell Scripts
      4. Summary
      5. Questions
      6. Terms
    7. Functions
      1. Using Functions
      2. Understanding Scope, Recursion, Return Codes, and Data Sharing
      3. Summary
      4. Questions
      5. Terms
    8. Text Filters
      1. The head and tail Commands
      2. Using grep
      3. Counting Words
      4. Summary
      5. Questions
      6. Terms
    9. Filtering Text with Regular Expressions
      1. The Basics of awk and sed
      2. Using sed
      3. Summary
      4. Questions
      5. Terms
    10. Filtering Text with awk
      1. What Is awk?
      2. Using awk Features
      3. Summary
      4. Questions
      5. Terms
    11. Other Tools
      1. The Built-In Commands
      2. The sleep Command
      3. The find Command
      4. xargs
      5. The expr Command
      6. The bc Command
      7. Summary
      8. Questions
      9. Terms
  8. Advanced Topics
    1. Signals
      1. How Are Signals Represented?
      2. Dealing with Signals
      3. Summary
      4. Questions
      5. Terms
    2. Debugging
      1. Enabling Debugging
      2. Using Syntax Checking
      3. Shell Tracing
      4. Summary
      5. Questions
      6. Terms
    3. Problem Solving with Functions
      1. Library Basics
      2. Creating a Library
      3. Summary
      4. Questions
      5. Terms
    4. Problem Solving with Shell Scripts
      1. Startup Scripts
      2. Maintaining an Address Book
      3. Summary
      4. Questions
      5. Terms
    5. Scripting for Portability
      1. Determining UNIX Versions
      2. Techniques for Increasing Portability
      3. Summary
      4. Question
      5. Terms
    6. Shell Programming FAQs
      1. Shell and Command Questions
      2. Variable and Argument Questions
      3. File and Directory Questions
      4. Summary
  9. Appendixes
    1. Command Quick Reference
      1. Reserved Words and Built-in Shell Commands
      2. Conditional Expressions
      3. Arithmetic Expressions (ksh, bash, and zsh Only)
      4. Parameters and Variables
      5. Input/Output
      6. Pattern Matching and Regular Expressions
    2. Glossary
    3. Answers to Questions
      1. Hour 1
      2. Hour 2
      3. Hour 3
      4. Hour 4
      5. Hour 5
      6. Hour 6
      7. Hour 7
      8. Hour 8
      9. Hour 9
      10. Hour 10
      11. Hour 11
      12. Hour 12
      13. Hour 13
      14. Hour 14
      15. Hour 15
      16. Hour 16
      17. Hour 17
      18. Hour 18
      19. Hour 19
      20. Hour 20
      21. Hour 21
      22. Hour 22
      23. Hour 23
    4. Shell Function Library
  10. Index