builtin

Bash local

Creates function-local bindings. Called functions may see them via dynamic scope.

Formal Syntax & Structure

bash syntaxbash
local [option] name[=value] ...

Parameters & Attributes

NameTypeDescription
nameidentifierLocal variable name.

Return Value

exit status

Creates function-local bindings. Called functions may see them via dynamic scope.

Working Example

Example Snippetbash
name=globalshow() { local name=local; printf '%s\n' "$name"; }showprintf '%s\n' "$name"
Bash Reference