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

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

相关推荐
二宝哥12 小时前
CentOS 7.9 离线安装 Nginx 并配置openssl1.1.1
linux·nginx·centos
程序员老陆13 小时前
说一说FFmpeg6在Linux平台的编译
linux·运维·服务器·ffmpeg
玫幽倩13 小时前
2026黄河流域公安院校-电子物证单项赛(程序逆向分析+服务器取证)
运维·服务器·python·电子取证·逆向·程序分析·服务器取证
IT摆渡者13 小时前
VM EXSI7.0存储硬盘故障处理
大数据·linux·github
赵民勇14 小时前
systemd-cgtop命令详解
linux·运维
灯澜忆梦14 小时前
【MySQL11】进阶篇 | 索引_#3使用规则
数据库·sql·mysql·性能优化
Zhu75814 小时前
在docker环境部署frp
运维·docker·容器
hhwyqwqhhwy14 小时前
Ubuntu22.04 安装vitis
linux
wWYy.14 小时前
Mysql:有哪些锁?
数据库·mysql
运维行者_14 小时前
企业带宽监控工具实战:网络流量分析与异常排查的5个关键能力
运维·服务器·开发语言·网络·分布式·后端·php