1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:22:08 +02:00
tldr/pages/common/local.md
2021-12-18 16:46:09 -03:00

673 B

local

Declare local variables and give them attributes. More information: https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins.

  • Declare a string variable with the specified value:

local {{variable}}="{{value}}"

  • Declare an integer variable with the specified value:

local -i {{variable}}="{{value}}"

  • Declare an array variable with the specified value:

local {{variable}}=({{item_a item_b item_c}})

  • Declare an associative array variable with the specified value:

local -A {{variable}}=({{[key_a]=item_a [key_b]=item_b [key_c]=item_c}})

  • Declare a readonly variable with the specified value:

local -r {{variable}}="{{value}}"