检查脚本中的参数数量
如果我至少有 3 个参数,我如何检查我的脚本,它必须是这样的:
if #number_of_arguments < 3
then
echo "Not enough arguments"
回答
if [ $# -lt 3 ]; then
...
fi
如果我至少有 3 个参数,我如何检查我的脚本,它必须是这样的:
if #number_of_arguments < 3
then
echo "Not enough arguments"
if [ $# -lt 3 ]; then
...
fi