Global Scope #
Global: maintain existence throughout script foo=0 # global variable foo
Local Scope #
Local: only accessible within function they’re defined in Often desirable to limit scope of variables; prevents name conflicts.
funct_1 () {
local foo # variable foo local to funct_1
foo=1
echo "funct_1: foo = $foo"
}