CHAPTER 13Self-Linked Scripts

The technique I am about to discuss allows you to have a single script that can be called in several ways by different names. The script itself contains all the code necessary to perform a number of tasks, but you may want to determine the specific task to be performed at runtime by calling the script by a specific name. This lets users invoke an individual task by name without having to learn specialized command-line switches for the options they want.

There are two of ways of specifying the precise behavior of a script. One way is to have the script accept command-line options telling it how to act. This method is covered in Chapter 5, which dealt with the use of getopts. This chapter illustrates the second method: ...

Get Expert Shell Scripting 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.