*
***
*****
*******
*********
***********
*************
for ((i=1;i<=9;i++))
do
for ((j=9;j>=$i;j--))
do
echo -n "."
done
for ((j=1;j<=$i;j++))
do
echo -n "s"
done
for ((j=1;j<$i;j++))
do
echo -n "*"
done
echo
3、编写双色球系统
#!/bin/bash
#
echo "第19100期开奖结果 开奖日期:$(date +'%F %T')"
for i in {1..6}
do
num=$(expr $RANDOM % 33 + 1)
echo -en " 33[31m$num 33[0m"
done
#!/bin/bash
#
echo "第19100期开奖结果 开奖日期:$(date +'%F %T')"
for i in {1..6}
do
num=$(expr $RANDOM % 33 + 1)
echo -en " 33[31m$num 33[0m"
done
echo -en " 33[34m$(expr $RANDOM % 16 + 1) 33[0m"
echo
echo
方法2:红球不重复
#双色球
echo "第19100期开奖结果 开奖日期:$(date +'%F %T')"
touch /number
aa=0
for ((i=1;${aa}<6;i++))
do
num=$(expr $RANDOM % 33 + 1)
cat /number | grep $num &> /dev/null
if [ $? -ne 0 ]
then echo "$num" >> /number
echo -en " 33[31m$num 33[0m"
let aa++
else continue
fi
done
echo -en " 33[34m$(expr $RANDOM % 16 + 1) 33[0m"
echo
rm -rf /number
echo "第19100期开奖结果 开奖日期:$(date +'%F %T')"
touch /number
aa=0
for ((i=1;${aa}<6;i++))
do
num=$(expr $RANDOM % 33 + 1)
cat /number | grep $num &> /dev/null
if [ $? -ne 0 ]
then echo "$num" >> /number
echo -en " 33[31m$num 33[0m"
let aa++
else continue
fi
done
echo -en " 33[34m$(expr $RANDOM % 16 + 1) 33[0m"
echo
rm -rf /number
#结束了