Table of Contents
- Contents
- About the Authors
- About the Technical Reviewers
- Acknowledgments
- Preface
PART 1 — Introducing the Shell
CHAPTER 1 — Introduction to Shells
- What’s a Shell?
- Getting Started
- Simple Commands
- Command Lines
- Shell Types and Versions
- The Filesystem: Directories, Pathnames
- Where the Commands Are Located
- Relative Pathnames and Your Current Directory
- Building Pathnames with Wildcards
- Expansion and Substitution
- Building Pathnames by Completion
- Command-Line Editing
- Command History
- More Unix Programs
- Summary
CHAPTER 2 — Using Shell Features Together
- Writing Output to Files: Redirection
- Using Programs Together: Pipes
- Joining Forces
- Editing Data, Continuing Command Lines
- Command Substitution
- for and foreach Loops
- More About for Loops
- Building Our Script
- Making a Script File
- Running the Script
- Programs and the Path
- Using the Results (via Aliases and Functions)
- Summary
CHAPTER 3 — More Shell Features
- Passing Info to Processes with Environment Variables
- Starting and Stopping Processes: Signals, Job Control
- Control Shell Interpretation with Quoting
- Quick Directory Changes with cdpath
- Summary
PART 2 — Using bash and zsh
CHAPTER 4 — Entering and Editing the Command Line
- Terminals and Shells
- The Command Line
- Line Editing Basics.
- Beyond Keystrokes: Commands and Bindings
- Options for Editing
- Multiline Editing and the zsh Editor Stack
- Keyboard Macros
- Other Tips on Terminals
- Summary
CHAPTER 5 — Starting the Shell
- Starting Shells
- Startup Files, Login and Interactive Shells
- Shell Options
- Getting Started with Cygwin
- Summary
CHAPTER 6 — More About Shell History
- Setting Up Variables
- “Bang”History: The Use of Exclamation Marks
- More Options for Manipulating History
- A Few More History Tricks
- Summary
CHAPTER 7 — Prompts
- Basic Prompting
- Prompts in bash
- Prompts in zsh
- Checking for Mail and Idle Terminals
- Summary
CHAPTER 8 — Files and Directories
- Types of Files
- Finding Commands and Files
- Managing Directories with the Shell
- More Argument Handling: Braces
- Redirection
- Here-Documents and Here-Strings
- Summary
CHAPTER 9 — Pattern Matching
- Basic Globbing
- Internationalization and Locales
- Globbing in Bash
- Globbing in Zsh
- Glob Qualifiers in Zsh
- Globbing Flags in Zsh
- Summary
CHAPTER 10 — Completion
- Getting Started with Completion
- Listing and Formatting Possible Matches
- Types of Completion
- Controlling Matching
- Reducing the Number of Matches
- Automatically Added Suffixes
- Exact Ambiguous Matches
- Summary
CHAPTER 11 — Jobs and Processes
- Mastering Job Control
- High-Power Command Substitutions
- Resource Limits
- Lying About the Program Name
- Summary
PART 3 — Extending the Shell
CHAPTER 12 — Variables
- Arrays
- Variable Attributes
- Numeric Variables and Arithmetic
- Complex Variable Expansions
- Associative Arrays
- Variable Indirection
- Summary
CHAPTER 13 — Scripting and Functions
- Programming with the Shell
- Input and Output
- Propagating Functions
- Traps and Special Functions
- Defining New Globbing Qualifiers
- Debugging Scripts
- Summary
CHAPTER 14 — Writing Editor Commands
- Widgets and Functions
- Simple Recipe for a Widget
- Making Widgets Behave Naturally
- Case Study I: Multiple Tasks in Widgets
- Case Study 2: Overriding Widgets
- Case Study 3: Locating Command-Line Arguments
- Case Study 4: Chaining Widgets Together
- Approximate Matching
- An Example Widget: Correcting Spelling
- Input and Output Within Widgets
- Summary
CHAPTER 15 — Writing Completion Functions
- Completions
- Helper Functions
- Handling Styles
- Making Full Use of Tags
- Tags, Labels, and Descriptions
- Prefixes and Suffixes
- Stand-alone Completion Widgets
- Summary
- And Finally...
APPENDIX A — Unix Programs
APPENDIX B — External Resources
- bash
- zsh
- General