Syntax
Bash Local Variable Syntax
In Bash, local variable: keeps a variable inside a function — local count=0
Quick Answer
- Syntax
local count=0
BashSyntax
Local Variable
Code example
local count=0
Keeps a variable inside a function.
How to local variable in Bash
- Open your Bash file or editor.
- Copy the example, then replace its sample names and values for your code.
Bash Local Variable Syntax
Use local count=0.
Related Syntax References
Frequently asked questions
What is the Bash syntax for local variable?
Use this pattern: local count=0
Can I copy this Bash code example?
Yes. Use Copy code and adapt the example to your program.
Is this Bash syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify