编写一个shell脚本用“#”打印一个直角梯形
答案:2 悬赏:40 手机版
解决时间 2021-03-18 23:23
- 提问者网友:雾里闻花香
- 2021-03-18 11:49
编写一个shell脚本用“#”打印一个直角梯形
最佳答案
- 五星知识达人网友:迟山
- 2021-03-18 12:11
#!/bin/sh
for i in `seq 10 25`
do
for j in `seq $i`
do
echo -n "# " #双引号中的空格可以去掉,但打印出来会比较难看
done
echo
done
---------------------------------
结果:
# # # # # # # # # #
# # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # # #
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # #
for i in `seq 10 25`
do
for j in `seq $i`
do
echo -n "# " #双引号中的空格可以去掉,但打印出来会比较难看
done
echo
done
---------------------------------
结果:
# # # # # # # # # #
# # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # # #
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # #
全部回答
- 1楼网友:低音帝王
- 2021-03-18 12:32
如何编写一个shell脚本 本文结合大量实例阐述如何编写一个shell脚本。 为什么要进行shell编程 在linux系统中,虽然有各种各样的图形化接口工具,但是sell仍然是一个非常灵活的工具。shell不仅仅是命令的收集,而且是一门非常棒的编程语言。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯