Good Advice & Practice of Shell Programming

C H A P T E R 2

Standard 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.

From : Expert shell scripting. Thank to the great author.