Bash 检查脚本中的参数数
如果我至少有3个参数,我如何签入脚本,它必须类似于:Bash 检查脚本中的参数数,bash,shell,sh,Bash,Shell,Sh,如果我至少有3个参数,我如何签入脚本,它必须类似于: if #number_of_arguments < 3 then echo "Not enough arguments" 在bash中,另一种方法是使用算术表达式 if (( $# < 3 )); then ... fi if (( $# < 3 )); then ... fi
if #number_of_arguments < 3
then
echo "Not enough arguments"
在bash中,另一种方法是使用算术表达式
if (( $# < 3 )); then
...
fi
if (( $# < 3 )); then
...
fi