Wicked Cool Shell Scripts: The Library
There are 101 scripts discussed in this book, but in fact there are closer to 150 scripts available, in total. Here's how you can get them if you'd like. You are welcome to do this if you don't have the book, but it'll make a lot more sense if you do have "Wicked Cool Shell Scripts", of course. Note that you can also download the entire set of scripts as AllFiles.tgz. Just make sure you unpack the scripts into their own directory!
verify that a specified program is either valid as-is, or can be found in the PATH directory list.
Ensures that input only consists of alphabetical and numeric characters.
Normalizes month field in date specification to three letters, first letter capitalized. A helper function for hack #7, validdate. Exits w/ zero if no error.
given a number, show it with comma separated values expects DD and TD to be instantiated. instantiates nicenum or, if a second arg is specified, the output is echoed to stdout
validate integer input, allow negative ints too
test whether a number is a valid floating point value. Note that this cannot accept scientific (1.304e5) notation.
validate date, taking into account leap year rules
a script to emulate the -n flag functionality with 'echo' for Unix systems that don't have that available.
wrapper for 'bc' that returns the value of a formula
a flexible file locking mechanism
use these variables to easily have different color and format output. Make sure to output the reset sequence after colors (f = foreground, b = background), and use the 'off' feature for anything you turn on.
Script to demonstrate use of the shell function library
a collection of shell library utilities
a simple word guessing game a la hangman
a simple number guessing game
A version of fmt, using nroff. Adds two useful flags: -w X for line width and -h to enable hyphenation for better fills.
sample input file for justification and spelling script tests
sample input file for justification and spelling, post shpell script
a replacement for the existing rm command that allows a rudimentary unremove capability through utilizing a newly created directory in the user's home directory. It can handle directories of content as well as individual files, and if the user specifies the -f flag, files are NOT archived, but removed.
search the deleted files archive for the specified file. If there is more than one match, show a list ordered by timestamp, and let the user specify which they want restored.
log all file deletion requests unless "-s" flag is used
output a directory listing in a friendly and useful format
search the locate database for the specified pattern
build the locate database using find
pretend we're the DIR command in DOS and display the contents of the specified file, accepting some of the standard DIR flags
given a pattern and a man section, show all the matches for that pattern from within all relevant man pages.
show the current time in the specified timezone or geographic zone. Without any argument, show UTC/GMT. Use the word "list" to see a list of known geographic regions Note that it's possible to match a zone directory (a region) but that only timezone files are valid specifications.
an easy command-line based memory pad. Search the results with 'remindme'
search a datafile for matching lines, or show the contents of the datafile if no arg is specified
a command-line calculator that acts as a front-end to bc
check the spelling of a word