Bash Cookbook
Chad_Wollenberg writes "Anyone who has used a derivative of Unix over the past 20 years has used Bash, which stands for Borne Again Shell. The geek in all of us makes us want to extend our ability to rule the command line. To truly master a Unix environment, you need to know a shell, and Bash is easily the most popular of them. Any Unix/Linux/BSD administrator knows the power at your fingertips is fully extended by what you can do within the Bash environment, and all of us need the best recipes to get the job done." Keep reading for the rest of Chad's review.
Bash Cookbook
author
Carl Albing, JP Vossen, Cameron Newham
pages
598
publisher
O'Reilly
rating
9
reviewer
Chad Wollenberg
ISBN
978-0-596-52678-8
summary
A good book for intermediate and above users of Bash
Enter Bash Cookbook. Properly named for the series of O'reilly books that gives you valuable information on subjects in the form of recipes, this book was refreshing in that it was properly organized, and surprisingly contemporary, even citing Virtualized platforms as a way to try out different OS's for Bash. The book does a good job of pointing out the different operating systems that do run Bash, even citing Cygwin for Windows. They also use the POSIX standard, so that all of the examples are portable across platforms.
Bash Cookbook is by no means for the feint of heart. It seems that the book is meant for intermediate and above users of Bash. However, the first several chapters do a significant job of over viewing basic concepts of Bash navigation and combing simple commands. The book quickly changes gears to complex statements on how to get things done in Bash.
By Chapter 7, Bash Cookbook extends out of Bash commands and begins exploring combining the power of bash scripting with useful command such as grep, awk, and sed. To quote the authors, "if our scripting examples are going to tackle real-world problems, they need to use the wider range of tools that are actually used by real-world bash users and programmers." And that is exactly what they do. This chapter alone gave me the ability to do more in the command line environment simply by explaining the functions of the scripts put forth. That is something that any reader, intermediate to expert, can take from this book. The detailed explanations really do give everyone the ability to learn something about the commands, and the references to additional resources often lead me to the computer, looking up further details.
I found Chapter 11 to be very useful (pun intended) finally grasping some concepts on the find command that have previously escaped me. From Chapter 12 on, the book focuses on writing useful and complex scripts. This is where the book really begins to shine for the Unix enthusiast and system administrator. The scripts found in Chapter 12, and their elaborate descriptions begin to show the true power of Bash scripting, and how much you can automate. Chapter 14 is about securing your scripts, and is a heavy read, but well worth reading for any administrator that would be using their scripts in a production environment.
Just when you think this book has reached its limits, it gives very handy customization examples in Chapter 16 on how to configure and customize Bash. And also goes into common mistakes made by the novice user. Combine all of that with the Appendices for quick reference, and this book has not left my side since it arrived. While I would not recommend this book for the novice user, I would recommend this book to any system administrator that has to work with Unix or Linux. If nothing else, the examples given here are full of good, reusable code to make tasks easier in your day to day functions. Well done.
You can purchase Bash Cookbook from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Bash Cookbook is by no means for the feint of heart. It seems that the book is meant for intermediate and above users of Bash. However, the first several chapters do a significant job of over viewing basic concepts of Bash navigation and combing simple commands. The book quickly changes gears to complex statements on how to get things done in Bash.
By Chapter 7, Bash Cookbook extends out of Bash commands and begins exploring combining the power of bash scripting with useful command such as grep, awk, and sed. To quote the authors, "if our scripting examples are going to tackle real-world problems, they need to use the wider range of tools that are actually used by real-world bash users and programmers." And that is exactly what they do. This chapter alone gave me the ability to do more in the command line environment simply by explaining the functions of the scripts put forth. That is something that any reader, intermediate to expert, can take from this book. The detailed explanations really do give everyone the ability to learn something about the commands, and the references to additional resources often lead me to the computer, looking up further details.
I found Chapter 11 to be very useful (pun intended) finally grasping some concepts on the find command that have previously escaped me. From Chapter 12 on, the book focuses on writing useful and complex scripts. This is where the book really begins to shine for the Unix enthusiast and system administrator. The scripts found in Chapter 12, and their elaborate descriptions begin to show the true power of Bash scripting, and how much you can automate. Chapter 14 is about securing your scripts, and is a heavy read, but well worth reading for any administrator that would be using their scripts in a production environment.
Just when you think this book has reached its limits, it gives very handy customization examples in Chapter 16 on how to configure and customize Bash. And also goes into common mistakes made by the novice user. Combine all of that with the Appendices for quick reference, and this book has not left my side since it arrived. While I would not recommend this book for the novice user, I would recommend this book to any system administrator that has to work with Unix or Linux. If nothing else, the examples given here are full of good, reusable code to make tasks easier in your day to day functions. Well done.
You can purchase Bash Cookbook from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
'sh' is the Bourne shell.
'bash' is the Bourne Again SHell.
They're not the same.
Bourne Again Shell, not Borne.
Not knocking the book, especially as I haven't read it, but I've found the Advanced Bash Scripting Guide (available free online) http://tldp.org/LDP/abs/html/ extremely helpful on numerous occasions.
Registered Linux User #423733
As a BSD user (OpenBSD and FreeBSD), the only way I run into bash is to explicitly go and install it. Actually, the only place I have run into bash as a default install is on Linux.
I run into alot more sh, ksh, csh, and tcsh.
Bash takes Bourne Shell scripting (which was always more powerful than Csh scripting), and combines it with Csh's and Tcsh's best interactive features (! expansion, arrow history, tab completion, etc.).
The last time I saw people try to have a different paradigm with *NIX shells was with the 'rc' and 'es' shells of the 1990s, which was an attempt to introduce functional programming to the shell. Both shells stopped being actively developed before they were full featured (they never had job control, for example).
More recently, there is a new shell out there called the 'fish' shell, which I tried and didn't like. I don't like its requirement to have everything in a bunch of colors; a true *NIX shell, in my opinion, should not try and make everything colorful (I also despise ls with colors).
Looks like ksh finally was open sourced, but by then Bash had become the standard shell you're guaranteed to have in just about any Linux distribution (exceptions being tiny distributions which use Busybox for everything).
More information, of course, is on the Wikipedia..
I may even buy the book based on the review.
Leaving aside stuff like not for the feint of heart, which is just poor editing, what the hell does I found Chapter 11 to be very useful (pun intended) mean?
Maybe it's the ultimate meta-pun, where there was no pun in the first place, but the author pointed out that one was intended, so one was slipstreamed into the statement.
I think he's actually referring to Chapter 9 which is entitled "Finding Files: find, locate, slocate" hence the pun on "found".
It's a play on words. In the US, if you declare bankruptcy, you "file a Chapter 11".
Gentoo Linux - another day, another USE flag.
From what I've seen (not used it) the new Windows PowerShell (Monad) is designed around "piping" data between apps that actually exchange .Net objects, including lists, maps, etc. of objects -- rather than character streams. There seem to be generic commands that provide sql-like "select / where" filtering clauses, etc., too. You might explore that, see if it fits your needs. It looks awfully verbose to me though, I'd have to find a way to set aliases for most everything. Just a thought.
In short, if organized correctly, bash can be used where a senior sysadmin would normally reach for perl or python. This is often helpful when your juniors have a good grasp of bash, but aren't very strong in other languages.
You mean it makes it possible to use the wrong tool for the job, in order to avoid a little training.
No offense, but that's a *really* terrible idea.
If you are new to linux and are thinking about learning BASH, you need to be aware that in Ubuntu linux /bin/sh points to DASH, NOT BASH. Not alot of difference, but it can screw you up if you are not aware of it.
You know I'm not trying to troll here, but I really felt this change was poorly implemented and announced. I hope it doesn't deter any newbies from probing deeper into their systems and learning the joys of scripting.
Sometimes, life itself is sarcasm...
He FOUND chapter 11 (which is about FIND) useful. There's the pun. You had to read past the bit talking about the pun to get it.
Yeah, that's true and all, but the pun was the fact that he "found" Chapter 11 (the chapter on "find") to be useful -- nothing to do with bankruptcy.
Coloring the prompt? That was the "gee whiz!" moment that made me switch permanently. From my .zshrc:
See how all the colors are defined in an associative array, like ${fg[green]} gets you a green foreground? Say I'm in the directory "/usr/share/media/music/albums/Pink Floyd - A Momentary Lapse of Reason". As a regular user, my prompt looks like:
My name@host is green, the time is blue, and the path is red. The smiley face is green. Now, if I'm root:
My name@host is red now, and the prompt char is "#" instead of "$". But what if I run a command and it fails?
The green smiley face is now a red frowney face. Someone suggested a "big" prompt like that, and once I got used to it, I love it. It's very easy to see where command output stops and the next command starts, and the whole green smile vs. red frown thing is an instant visual indicator of a command's results (which sometimes isn't obvious, say if you're redirecting stderr to /dev/null). Sure, I could have done something similar in Bash, but I guarantee it would've been a whole lot less readable. I did that as an experiment to learn Zsh scripting, and I haven't deliberately used Bash since then.
Dewey, what part of this looks like authorities should be involved?
by Mendel Cooper, is all you will need. PDF. tar.bz.
Save your money for beer.
Sig this!
You might explore that, see if it fits your needs. It looks awfully verbose to me though
You can set your own aliases in the $profile script but you don't need to; Powershell is already an elastic language
These two one-liners are functionally identical:
$items | foreach { $_ | get-members }
$items |%{$_ |gm}
It is not immoral to create the human species - with or without ceremony, Samuel Clemens.