shell-嵌套循环之九九乘法表
#!/bin/bash for i in `seq 1 9`; do for j in `seq 1 $i`; do let "k=$i*$j" echo -ne "$i*$j=$k\t" done echo done
输出结果
#!/bin/bash a=1 while [ $a -le 9 ] do b=1 while [ $b -le $a ] do let "c=$a*$b" echo -ne "$a*$b=$c\t" let "b+=1" done echo let "a+=1" done
输出结果
#!/bin/bash a=1 until [ $a -gt 9 ] do b=1 until [ $b -gt $a ] do let "c=$a*$b" echo -ne "$a*$b=$c\t" let "b+=1" done echo let "a+=1" done
输出结果:
相关推荐
laisean 2020-11-11
xiaonamylove 2020-08-16
tianhuak 2020-11-24
huha 2020-10-16
lianshaohua 2020-09-23
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
以梦为马不负韶华 2020-10-20
CARBON 2020-10-20
彼岸随笔 2020-10-20
lianshaohua 2020-10-20
yutou0 2020-10-17
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16
applecarelte 2020-10-16