Shell 变量
#---------------------------------------------------------------------- # http://www.runoob.com/linux/linux-shell-variable.html # Shell 变量 #---------------------------------------------------------------------- string="runoob is a great site" echo ${#string} echo ${string:2:8} echo ${string} echo `expr index "$string" is` array_name=(value0 value1 value2 value3) echo ${array_name[0]} echo ${array_name[@]}
Shell 传递参数
echo "Shell 传递参数实例!"; echo "第一个参数为:$1"; echo "参数个数为:$#"; echo "传递的参数作为一个字符串显示:$*"; echo "-- \$* 演示 ---" for i in "$*"; do echo $i done echo "-- \$@ 演示 ---" for i in "$@"; do echo $i done