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

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
主站蜘蛛池模板: 息烽县| 韩城市| 高密市| 莫力| 黎城县| 海口市| 乳山市| 南通市| 扬州市| 涞水县| 五峰| 怀集县| 平和县| 南投县| 工布江达县| 浑源县| 简阳市| 丰都县| 新营市| 郸城县| 永新县| 恩平市| 临桂县| 江源县| 惠来县| 涿鹿县| 宝丰县| 花垣县| 张家口市| 武穴市| 巴南区| 永德县| 承德市| 开原市| 锦屏县| 广德县| 阆中市| 高州市| 涡阳县| 方山县| 海兴县|