Question
How to declare an associative array in bash ?

Associative arrays can be created in the same way: the only thing we need to change is the option used: instead of lowercase -a we must use the -A option of the declare command:

$declare -A my_array Question How to declare an associative array in bash ? Answer ? Question How to declare an associative array in bash ? Answer Associative arrays can be created in the same way: the only thing we need to change is the option used: instead of lowercase -a we must use the -A option of the declare command: $ declare -A my_array
If you want to change selection, open document below and click on "Move attachment"

How to use arrays in bash script - LinuxConfig.org
nd: $declare -a my_array Declare, in bash, it's used to set variables and attributes. In this case, since we provided the -a option, an indexed array has been created with the "my_array" name. <span>Associative arrays can be created in the same way: the only thing we need to change is the option used: instead of lowercase -a we must use the -A option of the declare command:$ declare -A my_array This, as already said, it's the only way to create associative arrays in bash. Create indexed arrays on the fly We can create indexed arrays with a more concise syntax, by simply assign

#### Summary

status measured difficulty not learned 37% [default] 0

No repetitions