shell 脚本写法:
* if else 写法
#!/bin/bash # 定义变量 number=10 # 使用 if-elif-else 判断 if [ $number -eq 10 ]; then echo "Number is 10" elif [ $number -eq 20 ]; then echo "Number is 20" elif [ $number -eq 30 ]; then echo "Number is 30" else echo "Number is neither 10, 20 nor 30" fi
* 集合写法
list=["1" "2" "3"]