Shell语法整理,持续维护
Shell
shell条件表达式:
CONDITIONAL EXPRESSIONS
Conditional expressions are used by the [[ compound command and the test and [ builtin commands to test file attributes and perform string and arithmetic comparisons. Expressions are formed from the following unary or
binary primaries. If any file argument to one of the primaries is of the form /dev/fd/n, then file descriptor n is checked. If the file argument to one of the primaries is one of /dev/stdin, /dev/stdout, or /dev/stderr,
file descriptor 0, 1, or 2, respectively, is checked.Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself.
When used with [[, the < and > operators sort lexicographically using the current locale. The test command sorts using ASCII ordering.
-a file
True if file exists.
-b file
True if file exists and is a block special file.
-c file
True if file exists and is a character special file.
-d file
True if file exists and is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
-g file
True if file exists and is set-group-id.
-h file
True if file exists and is a symbolic link.
-k file
True if file exists and its ``sticky'' bit is set.
-p file
True if file exists and is a named pipe (FIFO).
-r file
True if file exists and is readable.
-s file
True if file exists and has a size greater than zero.
-t fd True if file descriptor fd is open and refers to a terminal.
-u file
True if file exists and its set-user-id bit is set.
-w file
True if file exists and is writable.
-x file
True if file exists and is executable.
-G file
True if file exists and is owned by the effective group id.
-L file
True if file exists and is a symbolic link.
-N file
True if file exists and has been modified since it was last read.
-O file
True if file exists and is owned by the effective user id.
-S file
True if file exists and is a socket.
file1 -ef file2
True if file1 and file2 refer to the same device and inode numbers.
file1 -nt file2
True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not.
file1 -ot file2
True if file1 is older than file2, or if file2 exists and file1 does not.
-o optname
True if the shell option optname is enabled. See the list of options under the description of the -o option to the set builtin below.
-v varname
True if the shell variable varname is set (has been assigned a value).
-z string
True if the length of string is zero.string
-n string
True if the length of string is non-zero.string1 == string2
string1 = string2
True if the strings are equal. = should be used with the test command for POSIX conformance.string1 != string2
True if the strings are not equal.string1 < string2
True if string1 sorts before string2 lexicographically.string1 > string2
True if string1 sorts after string2 lexicographically.arg1 OP arg2
OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respec‐
tively. Arg1 and arg2 may be positive or negative integers.
Shell语法整理,持续维护的更多相关文章
- BAT 前端开发面经 —— 吐血总结 前端相关片段整理——持续更新 前端基础精简总结 Web Storage You don't know js
BAT 前端开发面经 —— 吐血总结 目录 1. Tencent 2. 阿里 3. 百度 更好阅读,请移步这里 聊之前 最近暑期实习招聘已经开始,个人目前参加了阿里的内推及腾讯和百度的实习生招聘, ...
- 2018年最新Java面试题及答案整理(持续完善中…)
2018年最新Java面试题及答案整理(持续完善中…) 基础篇 基本功 面向对象特征 封装,继承,多态和抽象 封装封装给对象提供了隐藏内部特性和行为的能力.对象提供一些能被其他对象访问的方法来改变它内 ...
- Markdown 语法整理
Markdown 语法整理 白宁超 2015年7月24日14:57:49 一.字体设置 A First Level Header == A Second Level Header -- # 标题 ## ...
- makefile中的shell语法
在Makefile中写shell代码有点诡异,和不同的shell语法不太一样,如果不了解,看Makefile会莫名其妙.下面总结了一些. 1:尽在Makefile文件的目标项冒号后的另起一行的代码才是 ...
- 常用的shell命令整理
工作快一年了,shell命令也玩了一年了.还是有点积累的,下面是本人常用的. 1.pwd | xargs -i basename {} 获取当前所在目录的名称 2.ps -ef|grep -w ...
- 开源项目商业模式分析(2) - 持续维护的重要性 - Selenium和WatiN
该系列第一篇发布后收到不少反馈,包括: 第一篇里说的MonicaHQ不一定盈利 没错,但是问题在于绝大多数开源项目商业数据并没有公开,从而无法判断其具体是否盈利.难得MonicaHQ是公开的,所以才用 ...
- JQuery插件之【jqGrid】常用语法整理
jqGrid常用语法整理,包含数据获取.常用函数.触发事件等 jqGrid表格数据获取相关语法 获取表格所有数据 $("#grid").jqGrid("getRowDat ...
- Markdown语法整理
标题 语法格式:'#'+'空格'+'文本',一共6级 # 一级标题 ## 二级标题 ### 三级标题 #### 四级标题 ##### 五级标题 ###### 六级标题 斜体 语法格式:1个星号包裹,我 ...
- Linux的经典shell命令整理
Linux的经典shell命令整理 1.删除0字节文件find -type f -size 0 -exec rm -rf {} \; 2.查看进程按内存从大到小排列ps -e -o “%C : %p ...
随机推荐
- java 坑
时间戳 unix的时间戳和java中的是不同的.unix为10位,java的13位.需要进行转换. long timestamps = 1509783992L; long javaTimstamps ...
- winform c#中子窗体关闭刷新父窗体
父窗体Form1 子窗体Form2 Form1中有一个datagridview控件和一添加按钮,Form2中有一个Text控件和一个保存按钮 要求点击Form1窗体上的添加按钮,弹出Form2,再te ...
- Android 混淆代码有关问题总结
Android 混淆代码问题总结 Android 混淆代码: 最快的方式: 1. 首先更新Android的SDK至最新版本,重新建立1个工程,把源码和资源及其他文件拷到新的工程里面. 2. 工程目录底 ...
- jenkins 启动slave,出现com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://127.0.0.1:8080/jnlpJars/remoting.jar
master: linux slave: win7 64位系统 在配置好系统后,采用jnlp的方式启动slave节点,报错如下: com.sun.deploy.net.FailedDownloadEx ...
- 利用flask将opencv实时视频流输出到浏览器
opencv通过webcam可以获取本地实时视频流,但是如果需要将视频流共享给其他机器调用,就可以将利用flask框架构建一个实时视频流服务器,然后其他机器可以通过向这个服务器发送请求来获取这台机器上 ...
- linux环境中,ssh登录报错,Permission denied, please try again.
问题描述: 今天早上一个同事反应一个问题,通过ssh登录一台测试机的时候,发现两个账号,都是普通账号,一个账号能够登录, 另外一个账号无法登录.问他之前有做过什么变更吗,提到的就是之前有升级过open ...
- windows 环境下 ping 加时间戳 记日志
在c盘下面新建文件 ping.vbs 在 ping.vbs中输入代码如下: Dim args, flag, unsuccOut args="" otherout="&qu ...
- Vim 操作符命令和动作命令
http://www.cnblogs.com/littlerabbit/articles/2349951.html
- PHP基本连接数据库
最简单的代码 connect.php <?php $host="localhost"; $db_user="root"; $db_pass="& ...
- nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
当你执行sudo nginx -s reload时出现nginx: [error] open() "/run/nginx.pid" failed (2: No such file ...