1、输出99乘法表
#!/bin/bash
#九九乘法表脚本
#!/bin/bash
#九九乘法表脚本
for i in {1..9}
do
for j in {1..9}
do
if [ $j -le $i ]
then
echo -n "${j}x${i}=$(($j*$i)) "
fi
done
echo
done
do
for j in {1..9}
do
if [ $j -le $i ]
then
echo -n "${j}x${i}=$(($j*$i)) "
fi
done
echo
done
2、输出以下形状
*
**
***
****
*****
******
*******
********
*********
#!/bin/bash
#
*
**
***
****
*****
******
*******
********
*********
#!/bin/bash
#
for ((i=1;i<=9;i++))
do
for ((j=1;j<=$i;j++))
do
echo -n "*"
done
echo
done
=====================================================================
do
for ((j=1;j<=$i;j++))
do
echo -n "*"
done
echo
done
=====================================================================
*
***
*****
*******
*********
***********
*************
#!/bin/bash
#
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 "*"
done
for ((j=1;j<$i;j++))
do
echo -n "*"
done
echo
done
=============================================================
***
*****
*******
*********
***********
*************
#!/bin/bash
#
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 "*"
done
for ((j=1;j<$i;j++))
do
echo -n "*"
done
echo
done
=============================================================
*************
*************
*************
*************
*************
*************
*************
#!/bin/bash
#
for ((i=1;i<=9;i++))
do
for ((j=1;j<=9;j++))
do
echo -n "*"
done
echo
done
*************
*************
*************
*************
*************
*************
#!/bin/bash
#
for ((i=1;i<=9;i++))
do
for ((j=1;j<=9;j++))
do
echo -n "*"
done
echo
done
=============================================================
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
#!/bin/bash
#
touch shuzi.txt
i=1
echo "第19100期开奖结果开奖日期:$(date +'%F %T')"
while [ $i -le 6 ]
do
in=$[$RANDOM % 33 + 1 ]
cat /root/txt/shuzi.txt | grep -q $in
if [ $? -eq 0 ]
then
continue
else
echo -en " 33[31m$(expr $in) 33[0m "
echo -en " 33[31m$(expr $in) 33[0m " >> /root/txt/shuzi.txt
let i++
fi
done
echo -en " 33[34m$(expr $RANDOM % 16 + 1) 33[0m "
echo
echo " " > /root/txt/shuzi.txt