bash Cookbook: Solutions and Examples for bash Users (Coo... and over one million other books are available for Amazon Kindle. Learn more
CDN$ 39.19
  • List Price: CDN$ 64.99
  • You Save: CDN$ 25.80 (40%)
Only 3 left in stock (more on the way).
Ships from and sold by
Gift-wrap available.
bash Cookbook: Solutions ... has been added to your Cart
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

bash Cookbook: Solutions and Examples for bash Users Paperback – Jun 3 2007

See all 2 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
"Please retry"
CDN$ 39.19
CDN$ 35.98 CDN$ 34.59

Frequently Bought Together

bash Cookbook: Solutions and Examples for bash Users + Learning the bash Shell: Unix Shell Programming + Classic Shell Scripting: Hidden Commands that Unlock the Power of Unix
Price For All Three: CDN$ 95.71

Buy the selected items together

Product Details

  • Paperback: 630 pages
  • Publisher: O'Reilly Media; 1 edition (June 3 2007)
  • Language: English
  • ISBN-10: 0596526784
  • ISBN-13: 978-0596526788
  • Product Dimensions: 17.8 x 3 x 23.3 cm
  • Shipping Weight: 862 g
  • Average Customer Review: 4.0 out of 5 stars  See all reviews (1 customer review)
  • Amazon Bestsellers Rank: #199,000 in Books (See Top 100 in Books)
  • See Complete Table of Contents

Product Description

Book Description

Recipes for Shell Scripting

About the Author

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, 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.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4.0 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See the customer review
Share your thoughts with other customers

Most helpful customer reviews

Format: Paperback Verified Purchase
Use it at work all the time and people keep borrowing it. Well organized and explains traps one may fall into.
Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again.

Most Helpful Customer Reviews on (beta) 27 reviews
41 of 42 people found the following review helpful
Solutions to problems for bash users of all skill levels June 25 2007
By calvinnme - Published on
Format: Paperback
This book covers the GNU Bourne Again Shell, which is a member of the Bourne family of shells that includes the original Bourne shell sh, the Korn shell ksh, and the Public Domain Korn Shell pdksh. This book is for anyone who uses a Unix or Linux system, as well as system administrators who may use several systems on any given day. Thus, there are solutions and useful sections for all levels of users including newcomers. This book is full of recipes for creating scripts and interacting with the shell that will allow you to greatly increase your productivity.

Chapter 1, "Beginning bash" covers what a shell is, why you should care about it, and then the basics of bash including how you get it on your system. The next five chapters are on the basics that you would need when working with any shell - standard I/O, command execution, shell variables, and shell logic and arithmetic. Next there are two chapters on "Intermediate Shell Tools". These chapters' recipes use some utilities that are not part of the shell, but which are so useful that it is hard to imagine using the shell without them, such as "sort" and "grep", for example. Chapter nine features recipes that allow you to find files by case, date, type, size, etc. Chapter 10, "Additional Features for Scripting" has much to do with code reuse, which is something you find even in scripting. Chapter 11, "Working with Dates and Times", seems like it would be very simple, but it's not. This chapter helps you get through the complexities of dealing with different formats for displaying the time and date and converting between various date formats.

Chapter 12, "End-User Tasks As Shell Scripts", shows you a few larger though not large examples of scripts. They are meant to give you useful, real world examples of actual uses of shell scripts beyond just system administration tasks. Chapter 13, "Parsing and Similar Tasks", is about tasks that will be familiar to programmers. It's not necessarily full of more advanced scripts than the other recipes in the book, but if you are not a programmer, these tasks might seem obscure or irrelevant to your use of bash. Topics covered include parsing HTML, setting up a database with MySQL, and both trimming and compressing whitespace. Chapter 14 is on dealing with the security of your shell scripts. Chapters 15 through 19 finish up the book starting with a chapter on advanced scripting that focuses on script portability. Chapter 16 is related to the previous chapter on portability and is concerned with configuring and customizing your bash environment. Chapter 17 is about miscellaneous items that didn't fit well into any other chapter. The subjects include capturing file metadata for recovery, sharing and logging sessions, and unzipping many ZIP files at once. Chapter 18 deals with shortcuts aimed at the limiting factor of many uses of bash - the typing speed of the user and shortcuts that cut down on the amount of typing necessary. The final chapter in the book, "Tips and Traps", deals with the common mistakes that bash users make.

All in all this is a very handy reference for a vast number of the tasks that you'll come across when scripting with the bash shell along with well-commented code. Highly recommended.
20 of 21 people found the following review helpful
Keep it close, you will use it Feb. 29 2008
By Gordon Ewasiuk - Published on
Format: Paperback
These O'Reilly Cookbooks should be on every sysadmin's shelf. The Bash Cookbook is no different. Incredibly useful book. I didn't read it cover to cover but have gone back to it at least 15-20 times to pull out nuggets of info. The real-world, practical examples and solutions offered in this book provide the sysadmin with a virtual swiss army knife when working with bash.

Book was so useful, I bought two extra copies and sent them to coworkers.
17 of 18 people found the following review helpful
it was worth waiting for it Oct. 30 2008
By Tiberius - Published on
Format: Paperback Verified Purchase
More than ten years after the first edition of Learning the bash Shell (In a Nutshell (O'Reilly)) came out, there appeared a book that sums up all the experience and expertise the authors have gained since those times using this shell. If you're new to Unix/Linux, start with the work linked in above, but if you have been using either of these systems for some time and you would like to learn how to make your life easier, then this is the book for you.

Why? Because it concentrates on teaching you how to solve your problems. After a brief introduction and setting the basics the real depth begins: 1. a problem, 2. developing a solution, 3. evaluating the solution. And lots of examples. Naturally, the first step is to recognise that you have a problem, which the book also teaches you: some people tend to suffer while doing a repetitive and uninteresting chore but does not even occur to them that it does not need to be so: they can turn the chore into a hunt for automatisation putting their brain to some creative use, so instead of numbing their mind they start sharping it, and this is exactly where this book comes in.

Presently, does not offer you a look into the book, but you can have a preview of every chapter and also a full view of the table of contents at the publisher's page: [...] Than come back here, as Amazon's price is much better. (At the time of writing this, there is a 37% discount.)
7 of 7 people found the following review helpful
Paid for itself in 5 minutes March 6 2009
By Anne - Published on
Format: Paperback Verified Purchase
I had one of those questions today about whether an option exists for a particular built-in command, 'type', and was about to painstakingly page through the bash man page as usual, when I remembered I had just gotten this book. Looked up 'type' in the index, and it referred me to two different pages: one that told me how I can avoid paging through the man page (use the 'help' command!), and one telling me everything I needed to know about using the command (and others like it) in my desired context. I was so happy I kissed it. Yes, I kissed the book.

From a quick thumb-through, I gathered that the rest of the book was just as concise and easy to navigate. Probably not great for complete linux n00bs, but it sure beats the bash man page!!! For anyone who uses the bash shell on a regular basis, whether for scripting or just running unix commands, this is absolutely indispensable. I have no idea how I got through 13+ years of unix programming without it.
5 of 5 people found the following review helpful
Good collection of recipes. Covers bash 3.2 May 10 2008
By kievite - Published on
Format: Paperback
Currently this is the only book that specifically covers bash 3.2, the version that contain new and interesting features like =~ operator for "normal" regular expression matching.

The main advantage of the book that it really covers a lot of ground and provides system administrators and users with a lot of good and difficult to find tips about customizing of the environment and making yourself more productive.

Chapters 5-6 which provide good overview of new features introduced in version 3.x including "normal" regular expressions pattern matching ( operator =~) and C-style for loop. One problem with shells traditionally use two completely obsolete notations for regular expressions (basic regular expression often known as DOS-style regular expressions plus quite perverse prefix notation ). Bash 3.2 did not fixes this problem as this is a problem of Unix in general (Unix can be called an Os that uses a dozen of different definitions of regular expressions :-) that but at least added a normal regular expression notion to the list.

After chapters 5 and 6 I recommend reading chapters 9, 17 and 19 and then the rest. While chapters are of very uneven quality, usually you can find at least one useful tip in each.

The spectrum of bash related tips and useful mini-scripts is quote substantial. The authors cover classic things like customizing prompt quite well. The book is not only about bash it covers a lot of ground including use of classic Unix utilities in scripting (most notably grep, find, sort, and date) along with related topics such as use of pipes and I/O redirection.

Of course for such a complex topic there are some shortcomings. It's a pretty difficult task to write a good cookbook but authors did an excellent job and provided many very valuable tips that can help to improve both system administrators and power users productivity.

One of the problems for a cookbook is a good organization and specifically a good starting chapter and here authors failed. Some chapters are half-baked. The Chapter about version control is badly written and very superficial. The authors just mention a couple of system without any details. And in this topic the devil is in details.

Some bash features are explained superficially. For example bash has horrible implementation of pushd/popd/dirs troika and it not that easy to use them productively. One notable deficiency is that there is no way to suppress duplicates which in essence make this feature almost unusable. The authors treatment looks like a baseless advertizing of a poorly implemented feature.

But I hope that the authors will improve the book in the next edition and I am reluctant to downgrade the book based on those flaws. After all, this is a cookbook and it should be judged by the best recipes not the worst.