Linux Today: Linux News On Internet Time.

More on LinuxToday

Learn To Use Functions

Mar 30, 2010, 12:33 (0 Talkback[s])


Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers

[ Thanks to Andrew Weber for this link. ]


"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

Related Stories: