CHAPTER 2Standard Function Library

After writing many scripts, I realized there were several functions and routines I was using repeatedly. Sometimes I would write the code for these duplicated functions again, and other times I would copy and paste the code from an earlier script. But the best coding practice is to keep a file around that contains all of your already tested and working functions. This creates a scriptwriter's toolbox, or, in programming speak, a library. With a library in place, many of the tools you need often are close at hand and you don't have to code the functions anew each time you need them. This chapter shows you how to set up a standard function library and how to utilize the library in your scripts.

The Library File ...

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.