It is:
(它是:)
if [ $# -eq 0 ]
then
echo "No arguments supplied"
fi
The $#
variable will tell you the number of input arguments the script was passed.
($#
变量将告诉您脚本传递的输入参数的数量。)
Or you can check if an argument is an empty string or not like:
(或者您可以检查参数是否为空字符串,例如:)
if [ -z "$1" ]
then
echo "No argument supplied"
fi
The -z
switch will test if the expansion of "$1" is a null string or not.
(-z
开关将测试“ $ 1”的扩展名是否为空字符串。)
If it is a null string then the body is executed. (如果为空字符串,则执行主体。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…