官术网_书友最值得收藏!

Working with arrays

An array is a list of variables. For example, we can create an array called FRUIT, which will contain the names of many fruits. The array does not have a limit on how many variables it may contain. It can contain any type of data. The first element in an array will have the index value of 0:

[student@localhost ~]$ FRUITS=(Mango Banana Apple)
[student@localhost ~]$ echo ${FRUITS[*]}
Mango Banana Apple
[student@localhost ~]$ echo $FRUITS[*]
Mango[*]
[student@localhost ~]$ echo ${FRUITS[2]}
Apple
[student@localhost ~]$ FRUITS[3]=Orange
[student@localhost ~]$ echo ${FRUITS[*]}
Mango Banana Apple Orange
主站蜘蛛池模板: 申扎县| 海丰县| 长宁区| 玉林市| 大荔县| 得荣县| 兴仁县| 泸水县| 建始县| 开化县| 兴安县| 裕民县| 新和县| 循化| 罗田县| 泸定县| 松潘县| 周口市| 玉林市| 乌苏市| 连山| 潞城市| 北辰区| 天全县| 大宁县| 莱西市| 故城县| 逊克县| 祁东县| 长葛市| 留坝县| 颍上县| 郴州市| 正阳县| 通许县| 克什克腾旗| 秦皇岛市| 德兴市| 大厂| 牙克石市| 梨树县|