Wicked Cool Shell Scripts: Sample Scripts
All of the scripts are available online in the "Shell Script Library", but the book isn't just a bunch of script listings: that wouldn't be useful, informative or fun! Instead, each of the 101 scripts are explained and explored in significant detail. To get a sense of how this adds tremendous value to the book, here are a few examples for you to peruse. (Remember, the table of contents offers a list of all scripts).
#38 Ensuring Maximally Compressed Files
As highlighted in Script #37, most Unix implementations include more than one compression method, but the onus is on the user to figure out which does the best job of compressing a given file. What typically happens is that users learn how to work with just one compression program without ever knowing that they could attain better results with a different one. Making this more confusing is that some files compress better with one algorithm and some with another, and there's no way to know without experimentation. (keep reading)
#60 Tracking BBC News with lynx
As I mentioned earlier, one of the unsung heroes of the command-line Internet is unquestionably the lynx web browser (or its newer sibling links). Although you can use it to surf the Web if you dislike graphics, its real power is accessed on the command line itself, within a shell script. The -dump flag, for example, produces the text but not the HTML source, as shown in the following when checking the BBC World Service website, tracking technology news... (keep reading)
#84 Exploring the Apache access_log
If you're running Apache or a similar web server that uses the Common Log Format, there's quite a bit of quick statistical analysis that can be done with a shell script. The standard configuration for a server has an access_log and error_log written for the site; even ISPs make these raw data files available to customers, but if you've got your own server, you should definitely have and be archiving this valuable information. (keep reading)
#99 Unscramble: A Word Game
If you've seen the "Jumble" game in your newspaper or played word games at all, you're familiar with the basic concept of this game: A word is picked at random and then scrambled. Your task is to figure out and guess what the original word is in the minimum number of turns. (keep reading)
There are, of course, 97 other scripts explained and explored in the book, so if this has whetted your appetite, or even made you say "okay, how would he do that in a shell script?" then maybe it's time to take the plunge and buy the book!