Korn Shell Arrays
$ colors[0]=RED |
Alternatively, you can perform the same assignments using a single command: |
|
Adding a dollar sign and an opening brace to the front of the general syntax and a closing brace on the end allows you to access individual array elements: |
|
Using the array we defined above, let's access (print) each array element one by one: |
|
If you access an array without specifying a subscript, 0 will be used: |
|
The while construct can be used to loop through each position in the array: |
|
0 comments:
发表评论 Add/View Comments