Appendix A. Administrative Shell Programming
The purpose of this appendix is to review major Bourne shell
(sh
) programming features. It is not intended as a comprehensive treatment of shell
programming or of the features of the various shells. Rather,
it will enable you to understand and modify the system administration
scripts on your system, most of which are Bourne shell scripts (although
this is slowly changing).
In the course of this appendix, we will look at many examples drawn from actual system scripts, as well as some other simple examples to illustrate basic features. Some of the latter examples use shell commands executed at the command prompt (although the corresponding commands could obviously appear just as easily in scripts).[1]
With the exception of AIX and Linux, the Unix versions we are
considering use the Bourne shell for system scripts. AIX uses the Korn
shell (ksh
), and Linux uses the
Bourne-Again shell (bash
). Linux system
scripts also frequently use bash
features that are not part of the standard shell. Since they are
extensions to sh
, however, the most
important of these features are now described in this appendix.[2] When I mention bash
features here, I am doing so in a descriptive sense only—not in an
historical sense—in comparison to what is offered in the standard Bourne shell. The feature in question
may also be present in other shells and may very well have originated in a
shell other than bash
.
The books UNIX in a Nutshell: System V Edition, by Arnold ...
Get Essential System Administration, 3rd Edition 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.