Understanding Scope, Recursion, Return Codes, and Data Sharing
Now that you have a basic understanding of the use and operation of functions in shell scripts, let's look at more advanced topics such as scope, recursion, return codes, and data sharing.
The term scope refers to the region within a program where a variable's value can be accessed. There are two types of scope:
Global scope If a variable has global scope, its value can be accessed from anywhere within a script. Variables with global scope are referred to as global variables.
Local scope If a variable has local scope, its value can only be accessed within the function in which it is declared. Variables with local scope are referred to as local variables.
By default all variables, ...