当前位置:网站首页>24、shell编程-流程控制
24、shell编程-流程控制
2022-08-04 15:08:00 【51CTO】
条件选择
if语句
if判断条件是否满足,如果满足,则执行命令1,不满足执行条件2
格式 if commands; then commands;[elif commands;then commands;]...[else commands;] fi
单分支
双分支
多

case语句
case判断为多种条件匹配作为选择,如选择1 执行command1 选择2 执行command2
格式 case word in [pattern [|pattern]...) commands ;;]...esac
pattern支持通配符 * 任意长度任意字符 ?任意单个字符 []指定范围内任意单个字符 | 或 a|b代表a或者b

边栏推荐
- C# 局部函数与事件
- 宣传海报
- Technology sharing | Description of the electronic fence function in the integrated dispatching system
- leetcode: 241. Designing precedence for arithmetic expressions
- [Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
- 实际工作中的高级技术(训练加速、推理加速、深度学习自适应、对抗神经网络)
- 7 天找个 Go 工作,Gopher 要学的条件语句,循环语句 ,第3篇
- 属于程序猿的浪漫
- Resharper 如何把类里的类移动到其他文件
- 技术分享| 融合调度系统中的电子围栏功能说明
猜你喜欢
随机推荐
利用决策树找出最优特征组合
leetcode:212. 单词搜索 II
Next -18- 添加代码复制按钮
Database recovery
leetcode: 250. Count subtrees of equal value
leetcode: 254. Combinations of factors
Qt的QItemDelegate使用
leetcode: 251. Expanding 2D Vectors
关于pnpm包管理器的版本问题
leetcode: 253. How many meeting rooms are required at least
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
RS|哨兵二号(.SAFE格式)转tif格式
Notes for xpath getting node with namespace
基于数据库实现分布式锁
[Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
C# 将dll打包到程序中
普法教育结合VR全景,直观感受和学习法治精神
第十六章 源代码文件 REST API 教程(一)
Hangzhou Electric School Competition (Counter Attack Index)
Android Sqlite3基本命令








