金鞍玉勒寻芳客,未信我庐别有春。这篇文章主要讲述九九乘法表——脚本相关的知识,希望能为你提供帮助。
[root@manager for]# cat for12.sh
#!/bin/bash
#********************************************************************
#Author: Oldxu
#Date: 2021-09-26
#FileName: for12.sh
#Description: The test script
#********************************************************************for i in {1..9}
do
for j in {1..9}
do
if [ $i == $j ];
then
echo -n "$j * $i = $[ $i * $j ]"
echo ""
break
else
echo -n "$j * $i = $[ $i * $j ]"
fi
done
done
效果【九九乘法表——脚本】1 1 = 1
1 2 = 22 2 = 4
1 3 = 32 3 = 63 3 = 9
1 4 = 42 4 = 83 4 = 124 4 = 16
1 5 = 52 5 = 103 5 = 154 5 = 205 5 = 25
1 6 = 62 6 = 123 6 = 184 6 = 245 6 = 306 6 = 36
1 7 = 72 7 = 143 7 = 214 7 = 285 7 = 356 7 = 427 7 = 49
1 8 = 82 8 = 163 8 = 244 8 = 325 8 = 406 8 = 487 8 = 568 8 = 64
1 9 = 92 9 = 183 9 = 274 9 = 365 9 = 456 9 = 547 9 = 638 9 = 729 * 9 = 81
推荐阅读
- 如何从Buddypress个人资料中删除Gravatar消息
- LFS 系列从零开始 DIY Linux 系统(构建临时系统 - GCC-4.9.2 - 第2遍)
- DevOps笔记(脑裂对系统可用性的影响)
- Jenkins部署笔记
- Java多线程开发|volatile与伪共享问题
- linux中core dump开启使用教程
- 使用ansible批量推送秘钥
- python——一步步教你用pyganme完成贪吃蛇小游戏(简易初版)
- windows下使用route添加路由