当前位置:网站首页>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以内的奇数列举出来

边栏推荐
- 设置工作模式与环境(下):探查和收集信息
- 软测人每个阶段的薪资待遇,快来康康你能拿多少?
- The principle and use of AOSP CameraLatencyHistogram
- Internet user account information management regulations come into effect today: must crack down on account trading and gray products
- 软件测试内卷严重,如何提升自己的竞争力呢?
- CAS:178744-28-0,mPEG-DSPE,DSPE-mPEG,甲氧基-聚乙二醇-磷脂酰乙醇胺供应
- OPC UA 与IEC61499 深度融合(1)
- 创建函数报错,提示DECLARE定义语法问题
- complete binary tree problem
- Fluorescein-PEG-CLS, cholesterol-polyethylene glycol-fluorescein scientific research reagent
猜你喜欢

encapsulation, package, access modifier, static variable

设置工作模式与环境(下):探查和收集信息

Embedded systems: overview

(PC+WAP)织梦模板不锈钢类网站

Interpretation of ML: A case of global interpretation/local interpretation of EBC model interpretability based on titanic titanic rescued binary prediction data set using interpret

Deep integration of OPC UA and IEC61499 (1)
![[N1CTF 2018] eating_cms](/img/09/3599d889d9007eb45c6eab3043f0c4.png)
[N1CTF 2018] eating_cms

PowerMockup 4.3.4::::Crack

Code Casual Recording Notes_Dynamic Programming_416 Segmentation and Subsetting

redis持久化方式
随机推荐
Nine ways to teach you to read the file path in the resources directory
单例模式使用饿汉式和懒汉式创建一定安全?很多人不知
Internet user account information management regulations come into effect today: must crack down on account trading and gray products
用两个栈模拟队列
图论-虚拟节点分层建图
禾匠编译错误记录
complete binary tree problem
What is the difference between the generator version and the viewer version?
[RYU] rest_router.py source code analysis
Diazo Biotin-PEG3-DBCO | Diazo Compound Modified Biotin-Tripolyethylene Glycol-Dibenzocyclooctyne
Fluorescein-PEG-CLS, cholesterol-polyethylene glycol-fluorescein scientific research reagent
ts用法大全
Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素科研试剂
云平台建设解决方案
设置工作模式与环境(下):探查和收集信息
.NET6之MiniAPI(十四):跨域CORS(上)
雅思大作文写作模版
RPA助力商超订单自动化!
Quickly build a website with static files
AOSP CameraLatencyHistogram的原理与使用