九九乘法表,原始版:
复制代码 代码示例:
#!/bin/bash
for a in `seq 1 9`
do
for b in `seq 1 9`
do
if [ $a -ge $b ]
then
echo $a x $b = $(expr $a * $b)
fi
done
done
改进版的九九乘法表:
复制代码 代码示例:
#!/bin/bash
for a in `seq 1 9`
do
echo ""
for b in `seq 1 9`
do
if [ $a -ge $b ]
then
echo -n "$a x $b = $(expr $a * $b)"
fi
done
done
echo ""