九九乘法表 [root@localhost ~]# vi chengfa.sh #!/bin/bash sum=0 for ((a=1; a<=9; a++)) do for ((b=1; b<=$a; b++)) do sum=$[$a*$b] echo -ne "$a*$b=$sum\t" done echo "" done [root@localhost ~]# chmod +x chengfa.sh [root@localhost ~]# ./chengfa.sh 1*1=1 2*1=2 2*2=4 3*1=3 3*2=6 3*3=9 4*1=4 4*2