Definition and assignment of arrays and associated arrays in Linuxshell # method of defining arrays 1array_var (12345) # method of defining arrays 2array_var [0] & quot; nick1 & quot; array_var [1] & quot; nick2 & quot; array_var [2] & quot; nick3 & quot; # print the definition and assignment of arrays and associated arrays in the array element Linux shell of a specific index # define arrays in 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 $ {ar Ray_var [@]} # both methods 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_array [index2] = val2 list the array indexes of the associated array # you can list indexes in either of the following ways: echo $ {! Array_var [*]} echo $ {! Array_var [@]}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service