Scripts or interpreted programs are often used to automate various tasks in Linux. This chapter focused on writing scripts in Bash-the Bourne Again shell-as well as in the scripting language Perl.

By reading this chapter, you learned the following:

  • A shell script is nothing more than a sequence of Linux commands in a file. Typically, you have to place a special line at the beginning of the script file and make it executable. Then you can run the script by typing its name at the shell prompt.

  • When your Red Hat Linux system boots, shell scripts stored in various subdirectories in the /etc directory (for example, /etc/init.d) perform many initialization tasks.

  • There are many built-in shell commands you can use in shell scripts. You already know some of the built-in commands, such as cd and pwd, but this chapter describes many more built-in shell commands.

  • Perl is a popular scripting language that appears on this book's companion CD-ROMs. You can use Perl to write powerful scripts on your Red Hat Linux system.

  • Perl contains features comparable to those of other programming languages, such as C. A powerful feature of Perl is its capability to use regular expressions and to search files for occurrences of a search pattern.

  • Perl 5, the latest version of Perl (and the one that comes with Red Hat Linux), includes a number of helpful features. A key feature is the Perl module, a package of subroutines that follows certain guidelines. Modules make it possible to implement objects in Perl.

  • You can download the latest version of Perl (as well as Perl documentation) from the Comprehensive Perl Archive Network (CPAN) at