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

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
主站蜘蛛池模板: 罗源县| 镇康县| 海安县| 德兴市| 商南县| 枣阳市| 拜城县| 竹溪县| 藁城市| 湖北省| 高碑店市| 昌黎县| 桦南县| 腾冲县| 公主岭市| 绥阳县| 莱西市| 上林县| 水城县| 浠水县| 清远市| 西安市| 石楼县| 前郭尔| 叶城县| 景泰县| 田林县| 城市| 两当县| 工布江达县| 葵青区| 城步| 钟祥市| 兴城市| 双峰县| 嘉善县| 墨江| 绥江县| 大石桥市| 永福县| 海原县|