8.2. Scripting the Bash Shell

The makings of a typical script includes a hash-bang line "!/bin/bash", variable declarations "declare FOO=BAR", and optionally command variable declarations, This is all we need to create a static script. We will cover these terms more in-depth in the following section, as well as explore the logical constructs that make a script such a powerful wrapper for the command-line tools Mac OS X provides.

The bash shell is based on the Bourne shell (sh), and is syntactically backward- compatible. In fact, the b and a in BASH stand for Bourne Again, a tribute to sh and its author Stephen Bourne. The bash shell is very capable, and has support for numerous control statements. This includes support for standard control statements: ...

Get Enterprise Mac Administrator's Guide 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.