$1在shell中称为“位置参数”,表示传入的第1个参数(第1个入参)。 用在shell脚本主体中,表示shell脚本的第1个入参。 用在shell脚本函数里,表示函数的第1个入参。 test -z $1 是一个判断表达式,用于判断$1的值是否为空字符串。 若为空,则结果为true;否则为false。
例子:
#!/bin/sh . /lc_sale/.bash_profile
echo "Start----------------------"
infile=$1 while read province_code province_name do echo $province_name'='$province_code sh ./singleprovine.sh $province_code done < $infile
echo "end ----------------------"