Pro Bash Programming: Scripting the GNU/Linux Shell, Second Edition

  • 3h 19m
  • Chris F. A. Johnson, Jayant Varma
  • Apress
  • 2015

Pro Bash Programming, teaches you how to effectively utilize the Bash shell in your programming. The Bash shell is a complete programming language, not merely a glue to combine external Linux commands. By taking full advantage of Shell internals, Shell programs can perform as snappily as utilities written in C or other compiled languages. And you will see how, without assuming Unix lore, you can write professional Bash 4.3 programs through standard programming techniques.

This second edition has updated for Bash 4.3, and many scripts have been rewritten to make them more idiomatically Bash, taking better advantage of features specific to Bash. It is easy to read, understand, and will teach you how to get to grips with Bash programming without drowning you in pages and pages of syntax.

Using this book you will be able to use the shell efficiently, make scripts run faster using expansion and external commands, and understand how to overcome many common mistakes that cause scripts to fail. This book is perfect for all beginning Linux and Unix system administrators who want to be in full control of their systems, and really get to grips with Bash programming.

What you’ll learn

  • Use the shell to write new utilities and accomplish most programming tasks.
  • Use shell parameter expansion to replace many external commands, making scripts very fast.
  • Learn to avoid many common mistakes that cause scripts to fail.
  • Learn how Bash’s readline and history libraries can save typing when getting user input.
  • Learn to use features new to Bash 4.0.
  • Build shell scripts that get information from the Web.

Who this book is for

Beginning Linux and Unix system administrators who want to be in full command of their systems.

About the Authors

Chris F.A. Johnson was introduced to Unix in 1990 and learned shell scripting because there was no C compiler on the system. His first major project was a menu-driven, user-extensible database system with report generator. Chris uses the shell as his primary, general-purpose programming language, and his projects have included a member database, menuing system, and POP3 mail filtering and retrieval. Chris is the author of Shell Scripting Recipes: A Problem-Solution Approach (Apress, 2005). When not pushing shell scripting to the limit, he designs and codes web sites, teaches chess, and composes cryptic crosswords.

Jayant Varma is the founder of OZ Apps (, a consulting and development company providing IT solutions with specialization in mobile technology. He is an experienced developer with more than 20 years of industry experience spread across several countries. He is the author of a number of books on iOS development, including Learn Lua for iOS Game Development (Apress, 2012), Xcode 6 Essentials (Packt, 2015), and More iPhone Development with Objective-C (Apress, 2015). He has also been a university lecturer in Australia where he currently resides. He loves traveling and finds Europe to be his favorite destination.

In this Book

  • Hello, World: Your First Shell Program
  • Input, Output, and Throughput
  • Looping and Branching
  • Command-Line Parsing and Expansion
  • Parameters and Variables
  • Shell Functions
  • String Manipulation
  • File Operations and Commands
  • Reserved Words and Built-In Commands
  • Writing Bug-Free Scripts and Debugging the Rest
  • Programming for the Command Line
  • Runtime Configuration
  • Data Processing
  • Scripting the Screen
  • Entry-Level Programming