Bash Cookbook: Solutions and Examples for Bash Users

Front Cover
"O'Reilly Media, Inc.", May 24, 2007 - Computers - 600 pages

The key to mastering any Unix system, especially Linux and Mac OS X, is a thorough knowledge of shell scripting. Scripting is a way to harness and customize the power of any Unix system, and it's an essential skill for any Unix users, including system administrators and professional OS X developers. But beneath this simple promise lies a treacherous ocean of variations in Unix commands and standards.

bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages. Packed full of useful scripts, along with examples that explain how to create better scripts, this new cookbook gives professionals and power users everything they need to automate routine tasks and enable them to truly manage their systems -- rather than have their systems manage them.

 

Contents

Chapter 1 Beginning bash
1
Chapter 2 Standard Output
29
Chapter 3 Standard Input
57
Chapter 4 Executing Commands
69
Shell Variables
83
Chapter 6 Shell Logic and Arithmetic
111
Chapter 7 Intermediate Shell Tools I
147
Chapter 8 Intermediate Shell Tools II
167
Chapter 14 Writing Secure Shell Scripts
281
Chapter 15 Advanced Scripting
321
Chapter 16 Configuring and Customizing bash
353
Chapter 17 Housekeeping and Administrative Tasks
411
Chapter 18 Working Faster by Typing Less
453
Common Goofs for Novices
463
Appendix A Reference Lists
483
Appendix B Examples Included with bash
529

find locate slocate
187
Chapter 10 Additional Features for Scripting
201
Chapter 11 Working with Dates and Times
217
Chapter 12 EndUser Tasks As Shell Scripts
231
Chapter 13 Parsing and Similar Tasks
249
Appendix C CommandLine Processing
537
Appendix D Revision Control
543
Appendix E Building bash from Source
563
Index
571
Copyright

Other editions - View all

Common terms and phrases

About the author (2007)

Carl Albing is currently a Distinguished Visiting Professor in the Department of Computer Science at the U.S. Naval Academy where he is teaching courses on programming languages and on High Performance Computing. Prior to this he was writing software for some of the biggest and fastest computers in the world as a software engineer for Cray, Inc. As an independent consultant, he is comfortable programming with C, Java, bash and much more. Carl is the coauthor of two books, one on Java development on Linux and his latest, the O'Reilly "bash Cookbook". A former software consultant, manager, analyst and programmer with an amazing breadth of software experience, Carl has worked with companies in the US, Canada and Europe. He has worked for large companies and small startups, in technical as well as in managerial and marketing roles. Carl's software projects, past and present, involve the design and development of distributed computing software, medical image processing applications, compilers, medical devices, web-based factory floor automation, and more. Carl's education includes a Ph.D. in Computer Science as well as a B.A. degree in Mathematics and an International MBA. He has spoken at conferences and training seminars in the US, Canada and Europe as well as local high schools and colleges. Carl enjoys speaking at user groups and seminars on Linux, C, Java, and bash topics. JP Vossen has been working with computers since the early 80s and has been in the IT industry since the early 90s, specializing in Information Security since the late 90s. He's been fascinated with scripting and automation since he first understood what an autoexec.bat was, and was delighted to discover the power and flexibility of bash and GNU on Linux in the mid-90s. He has previously written for Information Security Magazine and SearchSecurity.com, among others. On those few occasion when he's not in front of a computer, he is usually taking something apart, putting something together, or both. Cameron Newham lives in Perth, Western Australia. After completing a Bachelor of Science majoring in information technology and geography at the University of Western Australia, Cameron joined Universal Defence Systems (later to become Australian Defence Industries) as a software engineer. He has been with ADI for six years, working on various aspects of command and control systems. In his spare time Cameron can be found surfing the Internet, ballroom dancing, or driving his sports car. He also has more than a passing interest in space science, 3D graphics, synthesiser music, and Depeche Mode.

Bibliographic information