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}
 do
 for o in `seq $i`
 do
     echo -n -e "$o x $i = $[$i*$o]\t"
 done
    echo
 done 

echo "" 

#第二种方法while循环
 a=0
 while [ $a -lt 9 ]
 do
    let a++
 b=0
        while [ $b -lt $a ]
        do
             let b++
             echo -ne "$b x $a = $[$b*$a]\t"     
        done    
             echo
 done

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

相关推荐
杜子不疼.几秒前
【Linux】库制作与原理(二):动态库的制作与使用
linux·运维·服务器
森焱森3 分钟前
嵌入式硬件工程师应知 白银快速分析报告
linux·c语言·arm开发·嵌入式硬件·去中心化
小白电脑技术8 分钟前
飞牛漏洞焦虑?别瞎折腾WAF了!用Lucky五步搞定“防爬墙”
服务器·网络·安全
消失的旧时光-19438 分钟前
Nginx 是什么?为什么它不写在代码里?——从 0 认识 Nginx
运维·服务器·nginx
BJ_Bonree10 分钟前
4月17日,博睿数据受邀出席GOPS全球运维大会2026 · 深圳站!
大数据·运维·人工智能
RisunJan10 分钟前
Linux命令-lpq(查看打印队列状态)
linux·运维·服务器
山君爱摸鱼12 分钟前
Linux-服务进程
linux·运维·服务器
阿乐艾官13 分钟前
【linux文件系统重要目录及命令解释】
linux·运维·服务器
blueSatchel15 分钟前
U-Boot启动后做的事情
linux·u-boot
senijusene18 分钟前
Linux软件编程: Linux 操作系统基础与shell脚本
linux·运维·chrome