mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-14 14:15:25 +02:00

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>
29 lines
740 B
Markdown
29 lines
740 B
Markdown
# 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`
|