![]() To print the whole array, use as an index. The same logic applies when referencing and printing an associative array: declare -A AssociativeArray=( =blue =car =200 ) The output will show you the first element. To reference the first array variable, use the following syntax: $ ![]() ![]() To do this, create an indexed array: IndexedArray=(car plane bike) Users can reference bash array values using the element index or key. 14 Answers Sorted by: 588 To see the contents of array you can use: printr (array) or if you want nicely formatted array then: echo '' printr (array) echo '' Use vardump (array) to get more information of the content in the array like the datatype and length. just makes sure the output is on three separate lines instead of all crammed together on one. ' ' > This outputs: stuff1 stuff3 stuff2 The. If you reach the end of a row, which happens when the. Except, you need to specify the keys along with all the elements: declare -A AssociativeArrayĪssociativeArray+=(=alloy =gasoline) How to Reference and Print an Array Element
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |