[ Thanks to BlueVoodoo for this link.
]
“One issue people run into when learning how to shell
script well is duplicating work they’ve already done in a script.
Rather than copying their work and changing a couple of hard-coded
values, they could simply create a function to handle the work for
both areas of the script. Creating centralized functions also
standardizes and provides for a uniform script. If a function works
in one area of the script, it’s a safe bet it will work elsewhere
in the script, as well.”