Work the Shell - Mad Libs Generator, Tweaks and Hacks

We continue building a Mad Libs tool and slowly come to realize that it's a considerably harder problem than can be neatly solved in a 20-line shell script.
But, There Are Problems

Looking back at what we've done, however, there are a couple problems. The most important is that although we have a tool that identifies part of speech, it's not particularly accurate, because it turns out that many words can be identified properly based only on their use and context. A grammarian already will have identified some of the problems above! Even more than that, I suspect that however much we hack the script to make smarter word selections and identify context, the fact is that creating a really great Mad Libs involves human intervention. Given an arbitrary sentence, there are words that can be replaced to make it funny, and others that just make it incomprehensible.

Now, it wouldn't be too much to have a somewhat less ambitious program that understood a Mad Libs type of markup language and prompted as appropriate, reassembling the results after user input. Perhaps “The <noun> in <place> stays mainly in the plain”, which turns into:

Noun (person, place or thing):
Noun (a place):

But, that I will leave as (ready for it?) an exercise for the reader!

Note: Mad Libs is a registered trademark of Penguin Group USA.

Dave Taylor has been hacking shell scripts for a really long time, thirty years. He's the author of the popular Wicked Cool Shell Scripts and can be found on Twitter as @DaveTaylor and more generally at


Dave Taylor has been hacking shell scripts for over thirty years. Really. He's the author of the popular "Wicked Cool Shell Scripts" and can be found on Twitter as @DaveTaylor and more generally at

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix