Bourne Shell Scripting/Modularization
From Wikibooks, the open-content textbooks collection
It is possible to define shell functions and combine them together to implement more complex scripts.
A shell that wanted to store complex data structures would probably use temporary files. However, in some cases the easy way to pass large amounts of data between functions is to pipe the two functions together.
function1() {
...
}
function2() {
...
}
function1 args | function2 args