在Shell脚本中获取输入参数长度 # !/bin/sh string="$1" length=${#string} if [ $length -lt 2 ] then echo "必须输入参数,且参数长度至少为2" exit 1 fi echo $1 阅读:33