当前位置:网站首页>Shell编程之循环语句与函数
Shell编程之循环语句与函数
2022-08-03 23:01:00 【吉吉吉吉吉吉吉吉吉吉】
一、循环语句
1、for循环语句
2、for语句的结构
for 循环语句的语法结构
for 变量名 in 取值列表
do
命令序列
done
扩展:
for i in {1..50..2} 1-50的奇数
for i in {2..50..2} 1-50的偶数
for i in {10..1} 1-10倒序排列
for i in $(seq 10) 1-10正序排列
for i in $(seq 10 -1 1) 1-10倒序排列
for i in $(seq 1 2 10) 1-10的奇数,中间为步长
for i in $(seq 2 2 10) 1-10的偶数,中间为步长
3、语句应用示例
①打印1-5个数

②数字炸弹游戏Ⅰ: 要求在1-100内定义一个数字,与用户交互,要求,每次提醒用户,数字猜>大了还是猜小了,直到猜中为止,最后统计猜的次数

③10以内的奇数列举出来

边栏推荐
- utlis 线程池
- 《数字经济全景白皮书》金融数字用户篇 重磅发布!
- Summary bug 】 【 Elipse garbled solution project code in Chinese!
- First domestic open source framework 】 【 general cloud computing framework, any program can be made into cloud computing.
- 云平台建设解决方案
- 2022/8/3 考试总结
- 举一个 web worker 的例子
- 工作小计 QT打包
- 走迷宫 BFS
- On the Qixi Festival of 2022, I will offer 7 exquisite confession codes, and at the same time teach you to quickly change the source code for your own use
猜你喜欢

FinClip最易用的智能电视小程序

走迷宫 BFS

node连接mysql数据库报错:Client does not support authentication protocol requested by server

rosbridge-WSL2 && carla-win11

易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元

BMN: Boundary-Matching Network for Temporal Action Proposal Generation阅读笔记

Pytest learn-setup/teardown

Creo9.0 绘制中心线

Analysys Analysis: The transaction scale of China's online retail B2C market in Q2 2022 will reach 2,344.47 billion yuan

complete binary tree problem
随机推荐
[Paper Reading] TRO 2021: Fail-Safe Motion Planning for Online Verification of Autonomous Vehicles Using Conve
LabVIEW code generation error 61056
响应式织梦模板除尘器类网站
生成器版和查看器版有什么区别?
Work Subtotal QT Packing
HDU 5655 CA Loves Stick
OPC UA 与IEC61499 深度融合(1)
冰河又一MySQL力作出版(文末送书)!!
软件测试内卷严重,如何提升自己的竞争力呢?
golang写的存储引擎,基于b+树,mmap
关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
Unity2021 releases WebGL fog effect disappearing problem
雅思大作文写作模版
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list
Bytebase database schema change management tool
On the Qixi Festival of 2022, I will offer 7 exquisite confession codes, and at the same time teach you to quickly change the source code for your own use
What is Adobe?
设置工作模式与环境(下):探查和收集信息
响应式织梦模板餐饮酒店类网站
Creo 9.0二维草图的诊断:加亮开放端点