shell脚本之九九乘法表
来源:互联网 发布:知柏地黄丸 性早熟 编辑:程序博客网 时间:2024/05/18 02:34
这是一个for循环嵌套使用的案例,实现代码如下:
#!/bin/bash
color='\E[47;30m'
RES='\E[0m'
for num1 in `seq 9`
do
for num2 in `seq 9`
do
if [ $num1 -ge $num2 ];then
if (((num1*num2)>9));then
echo -en "${color}${num2}x${num1}=$((num1*num2))$RES " -------一个空格
else
echo -en "${color}${num2}x${num1}=$((num1*num2))$RES " -------两个空格
fi
fi
done
echo " "
done
脚本代码图片如下:
结果如下图所示:
阅读全文
0 0
- shell脚本之九九乘法表
- Shell脚本:打印九九乘法表
- shell-九九乘法表
- shell脚本之shell数组
- Shell脚本之循环
- shell脚本之gettop
- shell脚本之颜色
- shell脚本之find
- shell脚本---之入门
- shell脚本之find .
- Shell脚本之awk
- Shell脚本之sed
- Shell脚本之循环
- Shell脚本之数组
- shell 脚本之for
- shell 脚本之语法
- shell 脚本之开篇
- shell 脚本之 echo
- 贪心算法
- iOS-88-多个button时,如何创建最有效
- ionic tables 传值
- tensorflow里面的padding解释
- JavaScript 实例:当当网 购物车统计总价
- shell脚本之九九乘法表
- Ubuntu安装后的一些基本使用方法
- powerdvd 17破解版(极致蓝光播放器)附注册机
- C语言实验——打印菱形
- JAVA IO源码学习系列一(ByteArrayOutputStream)
- struts2数据封装(九)
- linux上实现getch()函数
- synchronized 和lock 区别
- 浅谈Mybatis之mybaits常用注解