---

Learn To Use Functions

[ Thanks to Andrew
Weber
for this link. ]

“Functions

“A function can help you modularize your script. In addition,
the function is executed in the context of the same shell, no child
process. This will save on resources as you use functions.
Functions are a script within a script which can be defined by the
user and stored in memory, allowing you to reuse the function
repeatedly. This also provides a modular aspect that allows you to
debug one function at a time be disabling functions.

“Think of functions as miniature shell scripts, or containers
inside a shell script where each container functions within itself
to provide resources for the larger script. One big difference
between a shell script and a function is that a new instance of the
shell is started for a shell script but the function runs in the
current shell”

Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis