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

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
主站蜘蛛池模板: 铅山县| 长岛县| 丰镇市| 娄底市| 清远市| 信阳市| 灯塔市| 镇巴县| 澄迈县| 仙游县| 崇明县| 霍林郭勒市| 五常市| 巴南区| 扎兰屯市| 南木林县| 吴江市| 治多县| 汝南县| 莒南县| 秦安县| 兴城市| 龙山县| 易门县| 阳曲县| 射阳县| 临沭县| 鹤山市| 六盘水市| 台中县| 浮山县| 嘉义县| 晋州市| 襄汾县| 金溪县| 宜昌市| 宁都县| 阜阳市| 抚松县| 鄂托克旗| 大连市|