发布时间:2019-07-11 09:53:14编辑:auto阅读(1591)
1;打印9*9乘法表
2;输出国际象棋的棋盘
3;猴子;摘了n个香蕉
每天,吃一半,+1
第九天剩一个
求摘了几个香蕉
1;打印99乘法表
一:
for i in {1..9}
do
for j in seq $i
do
echo -n “$i$j=$(i*j) ”
done
echo
done
方法二:
#!/bin/bash
for i in {1..9}
do
for j in {1..9}
do
[ $j -gt $i ] && break
echo -n "$i$j=$[ij] "
done
echo
Done
2;输出国际象棋的棋盘
#!/bin/bash
for i in {1..4}
do
for j in {1..4}
do
echo -ne "\033[40m==\033[0m"
echo -ne "\033[49m||\033[0m"
done
echo
for a in {1..4}
do
echo -ne "\033[49m||\033[0m"
echo -ne "\033[40m==\033[0m"
done
echo
done
echo
3;猴子;摘了n个香蕉
每天,吃一半,+1
第九天剩一个
求摘了几个香蕉
#!/bin/bash
a=1
for i in {1..8}
do
let a=(a+1)*2
done
echo $a
上一篇: 浅谈3A和进程
下一篇: H3C瘦AP转胖AP
47479
45781
36780
34300
28950
25585
24431
19602
19089
17623
5454°
6037°
5553°
5628°
6554°
5365°
5366°
5872°
5845°
7159°