Bash - local - Variable declaration in function - (Builtin)

Bash Liste Des Attaques Ovh

About

local variable scoping declaration inside a block or a function.

It is an error to use local when not within a function.

Syntax

local [option] [name[=value] ...]
  • For each argument, a local variable named name is created, and assigned value.
  • The option can be any of the options accepted by declare.

When local is used within a function, it causes the variable name to have a visible scope restricted to that function and its children.

With no operands, local writes a list of local variables to the standard output.

Return value

It is an error to use local when not within a function. The return status is 0 unless local is used outside a function, an invalid name is supplied, or name is a readonly variable.

Example

local pid base= user= nice= bg= pid_file=





Discover More
Bash Liste Des Attaques Ovh
Bash - (Environment) Variable

A variable is a parameters referenced by a name. parameter A variable has: a value and zero or more attributes (such as integer, ...). Attributes are assigned using the declare builtin command....
Bash Liste Des Attaques Ovh
Bash - Builtin Commands

builtin refers to: a builtin command. See or to the specific builtin command. See (useful when defining a function whose name is the same as a shell builtin) The builtin command execute the specified...
Bash Liste Des Attaques Ovh
Bash - Function

A shell function is an object that: is called like a simple command and executes a compound command with a new set of positional parameters. ie a function definition is itself a compound command ...
Bash Liste Des Attaques Ovh
Bash - Scope

A name variable or function is scoped in Bash: by the subshell with the export built-in command with the source built-in command with the local declaration
Bash Liste Des Attaques Ovh
How to use the Array Variable in Bash?

Bash provides a one-dimensional array variables. See also: When calling a function, quote the variable otherwise bash will not see the string as atomic. The separator is variable $IFS. There is: ...



Share this page:
Follow us:
Task Runner