定义全局变量
```bash
export GOSUNCN=100
```
配置文件永久生效
```bash
source ~/.bash_profile
```
删除变量
```bash
unset GOSUNCN
```
定义数组
```bash
GOSUNCN=('A' 'B' 'C' 'D')
```
取出数组中的值
```bash
${数组名[索引]} ${GOSUNCN[2]}
```
精确赋值
```bash
GOSUNCN[2]='3'
```
访问数组所有元素
```bash
${GOSUNCN[@]}
```
统计数组元素个数
```bash
${#GOSUNCN[@]}
```
访问数组元素的索引
```bash
${!GOSUNCN[@]}
```
指定起始索引
```bash
${GOSUNCN[@]:1} # 从第二个(索引1)开始遍历
${GOSUNCN[@]:3} # 从第四个(索引3)开始遍历
```
指定起始索引和遍历个数
```bash
${GOSUNCN[@]:1:2} # 从第二个(索引1)开始遍历,遍历2个
${GOSUNCN[@]:3:3} # 从第四个(索引3)开始遍历,遍历3个
```
关联数组声明
```bash
declare -A GOSUNCN
```
赋值语句
```bash
GOSUNCN[name]='zhilian'
GOSUNCN[age]=29
```
获取值
```bash
${GOSUNCN[name]}
${GOSUNCN[age]}
```
整体赋值
```bash
GOSUNCN=([name]='Apollo' [age]=22)
```