declare
Declare variables and give them attributes. tldr-pages
On several platforms
Several platforms
Declare a string variable with the specified value
declare variable="value"IdentifyDeclare an integer variable with the specified value
declare -i variable="value"IdentifyDeclare an array variable with the specified value
declare -a variable=(item_a item_b item_c)IdentifyDeclare an associative array variable with the specified value
declare -A variable=([key_a]=item_a [key_b]=item_b [key_c]=item_c)IdentifyDeclare a readonly string variable with the specified value
declare -r variable="value"IdentifyDeclare a global variable within a function with the specified value
declare -g variable="value"IdentifyPrint a function definition
declare -f function_nameIdentifyPrint a variable definition
declare -p variable_nameIdentify