例子:
解答:
#!/bin/bash
num=0
while [ $num -ne 1 ]
do
pd=`echo $RANDOM`
pd_length=`echo ${#pd}`
if [ $pd_length -ge 5 ]
then
break
else
echo $pd
fi
done
注:
$RANDOM为随机数
${#pd}计算位数
时间: 2024-10-13 18:07:58
例子:
解答:
#!/bin/bash
num=0
while [ $num -ne 1 ]
do
pd=`echo $RANDOM`
pd_length=`echo ${#pd}`
if [ $pd_length -ge 5 ]
then
break
else
echo $pd
fi
done
注:
$RANDOM为随机数
${#pd}计算位数