declare Command Examples

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

declare {{variable}}="{{value}}"

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

declare -a {{variable}}=({{item_a item_b item_c}})

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

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

declare -g {{variable}}="{{value}}"