1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-13 11:55:26 +02:00
tldr/pages/common/local.md
Pranaov S 8bc9dce9b1
pages/common/*: correct urls, see also improvements, unbashify pages, examples addition (#16841)
Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2025-06-14 19:02:15 +03:00

740 B

local

Declare local variables and give them attributes. See also: declare and export. More information: https://www.gnu.org/software/bash/manual/bash.html#index-local.

  • 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}}"

  • Display help:

local --help