Definition and assignment of arrays and associated arrays in Linux shell # method of defining arrays 1array_var = (12345) # define the array method 2array_var [0] = "nick1" array_var [1] = "nick2" array_var [2] = "nick3" # print the array element content of a specific index echo $ {array_var [0]} index = 5 echo $ {array_var [$ index]} # print all values of the array in the form of a list echo $ {array_var [*]} echo $ {array_var [@]} # both ways can # print the array length echo $ {# array_var [*]} define the method declare-Aass_array of the associated array # The following two methods can assign values to the array ass_array = ([index1] = val1 [index2] = val2) ass_array [index1] = val1ass_ar Ray [index2] = val2 listing the array indexes of the associated array # You can list the indexes in either of the following ways: echo $ {! Array_var [*]} echo $ {! Array_var [@]}