<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Ops运维 | Mr`kang Blog｜小豆子]]></title> 
<link>https://www.cnmysql.com/index.php</link> 
<description><![CDATA[关注服务器运维技术、DB优化、Docker虚拟化、自动化运维、工作积累]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Ops运维 | Mr`kang Blog｜小豆子]]></copyright>
<item>
<link>https://www.cnmysql.com/post//</link>
<title><![CDATA[Shell 脚本——运算符号]]></title> 
<author>kangyang &lt;kangyang315@qq.com&gt;</author>
<category><![CDATA[SHELL脚本]]></category>
<pubDate>Wed, 20 Aug 2014 06:21:18 +0000</pubDate> 
<guid>https://www.cnmysql.com/post//</guid> 
<description>
<![CDATA[ 
	<span style="font-size: 12px;"><span style="font-family: 宋体;"> 一、测试命令简介<br/><br/>Shell中存在一组测试命令，该组测试命令用于测试某种条件或某几种条件是否真实存在。测试命令一般用于判断语句和循环语句中。<br/><br/>二、测试结构<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;test expression&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #使用test命令测试<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;[ espression ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# 前后必须都有空格<br/><br/>注：[ espression ] 此方法多用于 if 、case、while 语句中<br/><br/>三、整数比较运算符<br/>整数比较运算符 &nbsp;&nbsp;描述<br/>num1 -eq num2 &nbsp;&nbsp;如果num1大于num2，测试结果为0<br/>num1 -ne num2 &nbsp;&nbsp;如果num1不等于num2，测试结果为0<br/>num1 -gt num2 &nbsp;&nbsp;如果num1大于num2，测试结果为0<br/>num1 -lt num2 &nbsp;&nbsp;如果num1小于num2，测试结果为0<br/>num1 -ge num2 &nbsp;&nbsp;如果num1大于等于num2，测试结果为0<br/>num1 -le num2 &nbsp;&nbsp;如果num1小于等于num2，测试结果为0<br/><br/><br/>四、字符串运算符<br/>字符串运算符 &nbsp;&nbsp;描述<br/>-z string &nbsp;&nbsp;测试字符串是否为空，为空则为真<br/>-n string &nbsp;&nbsp;测试字符是否不为空，为空则为假<br/>string1 = string2 &nbsp;&nbsp;测试字符串是否相等<br/>string1 != string2 &nbsp;&nbsp;测试字符串是否不相等<br/>&nbsp;&nbsp;<br/><br/>五、文件运算符<br/><br/>文件运算符- &nbsp;&nbsp;描述<br/>-d file &nbsp;&nbsp;测试file是否为目录<br/>-f file &nbsp;&nbsp;测试file是否为普通文件<br/><br/>-e file<br/>&nbsp;&nbsp;测试file是否为存在<br/>-r file &nbsp;&nbsp;测试file是否为可读<br/>-s file &nbsp;&nbsp;测试file长度是否不为0<br/>-w file &nbsp;&nbsp;测试file是否为可写<br/>-x file &nbsp;&nbsp;测试file是否为可执行<br/>-L file &nbsp;&nbsp;测试file是否为链接文件<br/><br/>六、逻辑运算符<br/><br/>逻辑运算符 &nbsp;&nbsp;描述<br/>！expression &nbsp;&nbsp;如果expression为假，则测试条件为真<br/>expression1 -a expression2 &nbsp;&nbsp;同时为真，则测试条件为真<br/>expression1 -o expression2 &nbsp;&nbsp;有一个为真，则测试条件为真 </span></span><br/>Tags - <a href="https://www.cnmysql.com/tags/shell/" rel="tag">shell</a> , <a href="https://www.cnmysql.com/tags/%25E8%25BF%2590%25E7%25AE%2597/" rel="tag">运算</a> , <a href="https://www.cnmysql.com/tags/%25E5%2588%25A4%25E6%2596%25AD/" rel="tag">判断</a>
]]>
</description>
</item><item>
<link>https://www.cnmysql.com/post//#blogcomment</link>
<title><![CDATA[[评论] Shell 脚本——运算符号]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.cnmysql.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>