ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Linux用shell脚本执行乘法口诀表的两种方式

2026/9/24 12:14:36 拓冰建站 浏览量
Linux用shell脚本执行乘法口诀表的两种方式
#!/bin/bash
# *********************************************************#
#                                                          #
# * Author        : 藻头男                                  #
# * QQ邮箱        : 2322944912@qq.com                      #
# * Create time   : 2024-01-02-21-00-00                    #
# * Filename      : cheng.sh                               #
# * Description   : This is Shell scripts                  #
#                                                          #
#                                                          #
# ********************************************************#clear    #清屏执行 
#第一种方法for循环for i in {1..9}dofor o in `seq $i`doecho -n -e "$o x $i = $[$i*$o]\t"doneechodone echo "" #第二种方法while循环a=0while [ $a -lt 9 ]dolet a++b=0while [ $b -lt $a ]dolet b++echo -ne "$b x $a = $[$b*$a]\t"     done    echodone

感谢观看!希望能够帮助到大家!