linux shell脚本编写 | 三角形 | 梯形 | 菱形 | 九九乘法表 | 矩形 | 超详细
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
九九乘法表
方法一:
#!/bin/bash
a=1
while [ $a -le 9 ]
do
b=1
while [ $b -le $a ]
do
c=$[$a*$b]
echo -e -n "$a*$b=$c\t"
let b++
done
let a++
echo ""
done
方法二:
#!/bin/bash
for((a=1;a<=9;a++))
do
for((b=1;b<=$a;b++))
do
c=$[$a*$b]
echo -e -n " $a*$b=$c"
done
echo " "
done
横线
for((a=1;a<=8;a++))
do
echo -n "*"
done
竖线
#!/bin/bash
for((a=1;a<=8;a++))
do
echo "*"
done
矩形
#!/bin/bash
for((i=1;i<=10;i++))
do
for((j=1;j<=10;j++))
do
echo -n "*"
done
echo ""
done
直角三角形
方法一:
#!/bin/bash
for((a=1;$a<=9;a++))
do
for((b=9;$b>=$a;b--))
do
echo -n " "
done
for((c=1;$c<=$a;c++))
do
echo -n "*"
done
echo ""
done
方法二:
#!/bin/bash
for((a=1;$a<=9;a++))
do
for((b=1;$b<=$a;b++))
do
echo -n "*"
done
echo ""
done
等腰三角形
#!/bin/bash
for((i=1;$i<=10;i++))
do
for((j=10;j>=$i;j--))
do
echo -n " "
done
for((k=1;k<=$[$i*2-1];k++))
do
echo -e -n "*"
done
echo ""
done
倒直角三角形
#!/bin/bash
for((a=1;$a<=9;a++))
do
for((b=9;$b>=$a;b--))
do
echo -n "*"
done
echo ""
done
#!/bin/bash
for((a=1;$a<=9;a++))
do
for((b=1;$b<=$a;b++))
do
echo -n " "
done
for((c=9;$c>=$a;c--))
do
echo -n "*"
done
echo ""
done
倒等腰三角形
#!/bin/bash
for((a=1;a<=10;a++))
do
for((b=2;b<=$a;b++))
do
echo -n " "
done
for((c=10;c>=$a;c--))
do
echo -n "*"
done
for((d=9;d>=$a;d--))
do
echo -n "*"
done
echo ""
done
菱形
#!/bin/bash
for((i=1;$i<=9;i++))
do
for((j=9;j>=$i;j--))
do
echo -n " "
done
for((k=1;k<=$[$i*2-1];k++))
do
echo -e -n "*"
done
echo ""
done
for((a=1;a<=10;a++))
do
for((b=2;b<=$a;b++))
do
echo -n " "
done
for((c=10;c>=$a;c--))
do
echo -n "*"
done
for((d=9;d>=$a;d--))
do
echo -n "*"
done
echo ""
done
平行四边形
#!/bin/bash
for((a=1;$a<=8;a++))
do
for((b=1;$b<=$a;b++))
do
echo -n " "
done
for((c=1;$c<=8;c++))
do
echo -n "*"
done
echo ""
done
#!/bin/bash
for((a=1;$a<=8;a++))
do
for((b=8;$b>=$a;b--))
do
echo -n " "
done
for((c=1;$c<=8;c++))
do
echo -n "*"
done
echo ""
done
直角梯形
#!/bin/bash
for((a=1;$a<=8;a++))
do
for((b=8;$b>=$a;b--))
do
echo -n " "
done
for((c=1;$c<=8+$a;c++))
do
echo -n "*"
done
echo ""
done
等腰梯形
for((a=1;$a<=8;a++))
do
for((b=8;$b>=$a;b--))
do
echo -n " "
done
for((c=1;$c<=8+$a;c++))
do
echo -n "*"
done
for((d=1;$d<=$a;d++))
do
echo -n "*"
done
echo ""
done
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献4条内容
所有评论(0)