local [option] name[=value] ...
local is identical to declare in every way, and takes all the same options, with 3 exceptions:
declare and local within a function have the same effect on variable scope, including the -g option.local with no options prints variable names and values in the same format as declare with no options, except the variables are filtered to print only locals that were set in the same scope from which local was called. Variables in parent scopes are not printed.local is not specified by POSIX. Most bourne-like shells don't have a builtin called local, but some such as dash and the busybox shell do.dash shell has local variables.typeset doesn't set local variables, but rather acts upon variables of the next-outermost scope (e.g. setting attributes). Using typeset within functions defined using ksh function name { syntax, variables follow roughly lexical-scoping, except that functions themselves don't have scope, just like Bash. This means that even functions defined within a "function's scope" don't have access to non-local variables except through namerefs.