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

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
主站蜘蛛池模板: 图木舒克市| 小金县| 江安县| 扶绥县| 南雄市| 临海市| 烟台市| 麦盖提县| 长兴县| 岚皋县| 鲜城| 昆明市| 芜湖市| 莆田市| 日照市| 哈密市| 安陆市| 陆丰市| 大理市| 昌宁县| 东乡族自治县| 灵璧县| 苏州市| 休宁县| 康平县| 苏州市| 白银市| 东光县| SHOW| 双流县| 宿州市| 长岛县| 凉城县| 临泽县| 平度市| 石景山区| 桃园县| 九龙县| 大同县| 成武县| 财经|