Sams Teach Yourself Shell Programming in 24 Hours
(Publisher: Macmillan Computer Publishing)
Author(s): Sriranga Veeraraghavan
ISBN: 0672314819
Publication Date: 01/01/99
- Introduction
- About the Authors
- Part IIntroduction to UNIX and Shell Tools
- Hour 1Shell Basics
- What Is a Command?
- Simple Commands
- Complex Commands
- Compound Commands
- Command Separators
- What Is the Shell?
- The Shell Prompt
- Different Types of Shells
- Summary
- Questions
- Terms
- Hour 2Script Basics
- The UNIX System
- Logging In
- Shell Initialization
- Interactive Versus Noninteractive Shells
- Initialization File Contents
- Making a Shell Script Executable
- Getting Help
- Using the man Command
- Manual Sections
- Summary
- Questions
- Terms
- Hour 3Working with Files
- Listing Files
- Hidden Files
- Option Grouping
- Viewing the Content of a File
- cat
- Counting Words (wc)
- Manipulating Files
- Copying Files (cp)
- Renaming Files (mv)
- Removing Files (rm)
- Summary
- Questions
- Terms
- Hour 4Working With Directories
- The Directory Tree
- Filenames
- Pathnames
- Switching Directories
- Home Directories
- Changing Directories
- Listing Files and Directories
- Listing Directories
- Listing Files
- Manipulating Directories
- Creating Directories
- Copying Files and Directories
- Moving Files and Directories
- Removing Directories
- Summary
- Questions
- Hour 5Manipulating File Attributes
- File Types
- Determining a Files Type
- Regular Files
- Symbolic Links
- Device Files
- Named Pipes
- Owners, Groups, and Permissions
- Viewing Permissions
- Changing File and Directory Permissions
- Changing Owners and Groups
- Summary
- Questions
- Hour 6Processes
- Starting a Process
- Foreground Processes
- Background Processes
- Listing Running Processes
- jobs Command
- ps Command
- Killing a Process (kill Command)
- Parent and Child Processes
- Job ID Versus Process ID
- Subshells
- Process Permissions
- Overlaying the Current Process (exec Command)
- Summary
- Questions
- Terms
- Part IIShell Programming
- Hour 7Variables
- Defining Variables
- Variable Names
- Accessing Values
- Array Variables
- Accessing Array Values
- Read-only Variables
- Unsetting Variables
- Environment Variables
- Exporting Environment Variables
- Shell Variables
- Summary
- Questions
- Terms
- Hour 8Substitution
- Filename Substitution (Globbing)
- Using the * Wildcard
- Using the ? Wildcard
- Matching Sets of Characters
- Variable Substitution
- Substituting a Default Value
- Assigning a Default Value
- Aborting Due to Variable Errors
- Command and Arithmetic Substitution
- Command Substitution
- Arithmetic Substitution
- Summary
- Questions
- Hour 9Quoting
- Quoting with Backslashes
- Using Single Quotes
- Using Double Quotes
- Quoting Rules and Situations
- Quoting Ignores Word Boundaries
- Combining Quoting in Commands
- Embedding Spaces in a Single Argument
- Quoting Newlines to Continue on the Next Line
- Quoting to Access Filenames Containing Special Characters
- Quoting Regular Expression Wildcards
- Quoting the Backslash to Enable echo Escape Sequences
- Quote Wildcards for cpio and find
- Summary
- Questions
- Terms
- Hour 10Flow Control
- The if Statement
- An if Statement Example
- Using test
- The case Statement
- A case Statement Example
- Using Patterns
- Summary
- Questions
- Hour 11Loops
- The while Loop
- Validating User Input
- The until Loop
- The for and select Loops
- The for Loop
- The select Loop
- Loop Control
- Infinite Loops and the break Command
- The continue Command
- Summary
- Questions
- Terms
- Hour 12Parameters
- Special Variables
- Using $0
- Options and Arguments
- Dealing with Arguments, an Example
- Using basename
- Common Argument Handling Problems
- Option Parsing in Shell Scripts
- Using getopts
- Conclusion
- Questions
- Hour 13Input/Output
- Output
- Output to the Terminal
- Output Redirection
- Input
- Input Redirection
- Reading User Input
- Pipelines
- File Descriptors
- Associating Files with a File Descriptor
- General Input/Output Redirection
- Summary
- Questions
- Terms
- Hour 14Functions
- Creating and Using Functions
- Invoking a Function
- Function Examples
- Sharing Data Between Functions, an Example
- Moving Around the File System
- Implementing dirs
- Implementing pushd
- Implementing popd
- Conclusion
- Questions
- Hour 15Text Filters
- The head and tail Commands
- The head Command
- The tail Command
- Using grep
- Looking for Words
- Reading From STDIN
- Line Numbers
- Listing Filenames Only
- Counting Words
- The tr Command
- The sort Command
- The uniq Command
- Sorting Numbers
- Using Character Classes with tr
- Summary
- Questions
- Hour 16Filtering Text Using Regular Expressions
- The Basics of awk and sed
- Invocation Syntax
- Basic Operation
- Regular Expressions
- Using sed
- Printing Lines
- Deleting Lines
- Performing Substitutions
- Using Multiple sed Commands
- Using sed in a Pipeline
- Summary
- Questions
- Hour 17Filtering Text with awk
- What is awk?
- Basic Syntax
- Field Editing
- Taking Pattern-Specific Actions
- Comparison Operators
- Using STDIN as Input
- Using awk Features
- Variables
- Flow Control
- Summary
- Questions
- Terms
- Hour 18Miscellaneous Tools
- The eval Command
- The : Command
- The type Command
- The sleep Command
- The find Command
- find: Starting Directory
- find: -name Option
- find: -type Option
- find: -mtime, -atime, -ctime
- find: -size Option
- find: Combining Options
- find: Negating Options
- find: -print Action
- find: -exec Action
- xargs
- The expr Command
- The bc Command
- remsh/rsh/rcmd/remote (Remote Shell)
- Summary
- Questions
- Terms
- Part IIIAdvanced Topics
- Hour 19Dealing with Signals
- How Are Signal Represented?
- Getting a List of Signals
- Default Actions
- Delivering Signals
- Dealing with Signals
- The trap Command
- Cleaning Up Temporary Files
- Ignoring Signals
- Setting Up a Timer
- Conclusion
- Questions
- Hour 20Debugging
- Enabling Debugging
- Using the set command
- Syntax Checking
- Why You Should Use Syntax Checking
- Using Verbose Mode
- Shell Tracing
- Finding Syntax Bugs Using Shell Tracing
- Finding Logical Bugs Using Shell Tracing
- Using Debugging Hooks
- Summary
- Questions
- Hour 21Problem Solving with Functions
- Creating a Library of Functions
- Creating the Library
- Including Functions from a Library
- Naming Conventions
- Useful Functions
- Displaying Messages
- Asking a Question
- Checking Disk Space
- Obtaining the Process ID by Name
- Getting a Users Numeric User ID
- The Complete Library
- Summary
- Questions
- Terms
- Hour 22Problem Solving with Shell Scripts
- Moving Directories
- Using tar
- mvdir.sh
- A Walkthrough of mvdir.sh
- Examples
- Maintaining an Address Book
- Showing People
- Adding a Person
- Deleting a Person
- Summary
- Questions
- Terms
- Hour 23Scripting for Portability
- Determining UNIX Versions
- BSD Versus System V
- Using uname
- Determining the UNIX Version Using a Function
- Techniques for Increasing Portability
- Conditional Execution
- Abstraction
- Summary
- Questions
- Terms
- Hour 24Shell Programming FAQs
- Shell and Command Questions
- Variable and Argument Questions
- File and Directory Questions
- Summary
- Part IVAppendixes
- Appendix ACommand Quick Reference
- Reserved Words and Built-in Shell Commands
- Conditional Expressions
- File Tests
- String Tests
- Integer Comparisons
- Arithmetic Expressions (Korn/Bash Only)
- Operators Allowed in Korn/Bash Integer Expressions
- Parameters and Variables
- User-Defined Variables
- Built-in Shell Variables
- Built-in Commands that Directly Affect Variables
- Two Types of Variables
- Shell Variables
- Parameter Substitution
- Parameter Substitution in Bourne/Korn/Bash
- Parameter Substitution Only in Korn/Bash
- Pattern Matching
- Pattern Wildcards Available in Bourne/Korn/Bash
- Pattern Wildcards Available Only in Korn
- I/O
- here Document
- Miscellaneous Command Summaries
- Regular Expression Wildcards
- Limited Regular Expression Wildcards
- Extended Regular Expression Wildcards
- Summary
- Questions
Appendix B
Appendix C
Index