shell if condition
2019独角兽企业重金招聘Python工程师标准>>>
String Comparison | Description |
---|---|
Str1 = Str2 | Returns true if the strings are equal |
Str1 != Str2 | Returns true if the strings are not equal |
-n Str1 | Returns true if the string is not null |
-z Str1 | Returns true if the string is null |
Numeric Comparison | Description |
expr1 -eq expr2 | Returns true if the expressions are equal |
expr1 -ne expr2 | Returns true if the expressions are not equal |
expr1 -gt expr2 | Returns true if expr1 is greater than expr2 |
expr1 -ge expr2 | Returns true if expr1 is greater than or equal to expr2 |
expr1 -lt expr2 | Returns true if expr1 is less than expr2 |
expr1 -le expr2 | Returns true if expr1 is less than or equal to expr2 |
! expr1 | Negates the result of the expression |
File Conditionals | Description |
-d file | True if the file is a directory |
-e file | True if the file exists (note that this is not particularly portable, thus -f is generally used) |
-f file | True if the provided string is a file |
-g file | True if the group id is set on a file |
-r file | True if the file is readable |
-s file | True if the file has a non-zero size |
-u | True if the user id is set on a file |
-w | True if the file is writable |
-x | True if the file is an executable |
转载于:https://my.oschina.net/invictuslee/blog/225196
shell if condition相关推荐
- Linux shell 学习笔记(16)— shell 入门总结
1. Shell 变量 Shell 变量包括自定义变量和环境变量: 自定义变量:脚本中自己命名定义的变量,通常为局部变量,其他 Shell 程序不能访问到: 环境变量,操作系统已定义的变量,如 PAT ...
- Linux shell 学习笔记(8)— 使用结构化命令(if-then 语句、数值比较、字符串比较、文件比较、case 语句)
1. 使用 if-then 语句 最基本的结构化命令就是if-then语句.if-then语句有如下格式. if command then commands fi 或者 if command; t ...
- shell基础04 结构化命令
几乎和别的编程语言思想一样,只是关键字写法稍有不同.总结主要包括如下几种:if-then,for,while 1. if-then 格式: if command #根据command的状态码是否 ...
- php写一个shell脚本文件格式,一篇文章学会——shell脚本编写
用了caffe有一段时间了,感觉自己写shell脚本的能力有待提高,特地从菜鸟笔记处系统的看了一遍,其实学习基础就可,内容也不多,我就不总结了.把网站上的内容用markdown重新编辑了一下,各位可以 ...
- 一篇文章学懂Shell脚本
Shell脚本,就是利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能,也可以说Shell脚本就是一系列命令的集合. Shell可以直接使用在win/Unix/Linux上面 ...
- Linux shell笔记
由于工作的需要,越来越多的接触到linux系统.最近看了<Linux与Unix Shell>这本书,安装书的章节整理了一些自己认为比较重要的命令,方便以后查阅. No.001 文件安全与权 ...
- 3.Linux Shell流程控制
1.if/else结构 if condition thenstatements elif condition thenstatements elsestatements fi 2.条件 与C语言不同的 ...
- linux shell bash 内置变量参考
特殊的shell变量 变 量 含义 $0 脚 本名字 $1 位置参数 #1 $2 - $9 位置参数 #2 - #9 ${10} 位置参数 #10 $# 位置参数的个数 "$*" ...
- Shell常用内容汇总
文章目录 概述 Shell解析器 Linux提供的Shell解析器 bash和sh的关系 CentOS默认的解析器是bash Shell脚本入门 脚本格式 第一个Shell脚本:helloworld ...
最新文章
- 【USACO training】Chapter 1 入门
- 软件重构过程中的思维转换: 遗留代码如何变废为宝
- Bitcoin代码中的Boost signals(1)
- 版本控制入门-----搬进Github
- Linux 用户篇——用户管理的配置文件
- 浙江义乌发现桥头遗址,将5000年中华文明,再前推4000年?
- llinux c 语言延时,linux下写个C语言程序,要求有0.5微秒以下的延时,要怎样写
- [高级光照]球谐光照
- php 循环中return,php中for循环遇上return的示例代码分享
- LD_PRELOAD实现API劫持
- NeRF 从入门到精通
- echarts中的自定义tooltips
- ckfinder使用
- PySpark 之 连接变换 union、intersection、subtract、cartesian
- 36氪:超级表格想把企业协作做得“轻”一点
- html后代选择器的语法,[转]CSS子选择器与后代选择器
- Excel多列筛选同一个数据
- html鼠标放上虚化背景图片,如何将网页CSS背景图高斯模糊且全屏显示
- Redis原理以及底层数据结构初探
- CAS . . . .