- Learning Linux Shell Scripting
- Ganesh Naik
- 94字
- 2021-06-25 22:02:57
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
推薦閱讀
- 工業機器人虛擬仿真實例教程:KUKA.Sim Pro(全彩版)
- Microsoft Power BI Quick Start Guide
- Managing Mission:Critical Domains and DNS
- Apache Hive Essentials
- 大數據安全與隱私保護
- 傳感器與物聯網技術
- Java Web整合開發全程指南
- 西門子變頻器技術入門及實踐
- Google SketchUp for Game Design:Beginner's Guide
- Hadoop應用開發基礎
- Pentaho Analytics for MongoDB
- 格蠹匯編
- INSTANT Puppet 3 Starter
- 空間機器人
- AVR單片機工程師是怎樣煉成的