22

Automation with Shell Scripts

Script-Driven Tools

In Chapter 20, we examined UNIX command line tools. Everything that you can type in a shell to use those tools can be captured into a text file and replayed, just like a Visual Basic Macro in Office. These text files are called shell scripts.

When a script executes a command, that command usually passes a return value or result code back to the calling shell. It is tedious typing extra lines to inspect those status values, so you rarely bother to check them when you are operating the command line manually. In a shell script, we can exploit them to test whether the command was executed correctly and take some remedial action if it wasn’t. DOS scripts used on Windows do a similar thing, but they ...

Get Developing Quality Metadata now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.