<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[Shell Scripts学习之if ]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Mon, 07 Dec 2009 14:57:46 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	if[空格&nbsp;&nbsp;条件&nbsp;&nbsp;空格] 注意空格！！否则shell无法解析<br/>Shell Scripts学习之if<br/>–b 当file存在并且是块文件时返回真 -c 当file存在并且是字符文件时返回真 -d 当pathname存在并且是一个目录时返回真 -e 当pathname指定的文件或目录存在时返回真 -f 当file存在并且是正规文件时返回真 -g 当由pathname指定的文件或目录存在并且设置了SGID位时返回为真 -h 当file存在并且是符号链接文件时返回真，该选项在一些老系统上无效 -k 当由pathname指定的文件或目录存在并且设置了“粘滞”位时返回真 -p 当file存在并且是命令管道时返回为真 -r 当由pathname指定的文件或目录存在并且可读时返回为真 -s 当file存在文件大小大于0时返回真 -u 当由pathname指定的文件或目录存在并且设置了SUID位时返回真 -w 当由pathname指定的文件或目录存在并且可执行时返回真。一个目录为了它的内容被访问必然是可执行的。 -o 当由pathname指定的文件或目录存在并且被子当前进程的有效用户ID所指定的用户拥有时返回真。<br/><br/>UNIX Shell 里面比较字符写法：<br/>-eq&nbsp;&nbsp; 等于 -ne&nbsp;&nbsp;&nbsp;&nbsp;不等于 -gt&nbsp;&nbsp;&nbsp;&nbsp;大于 -lt&nbsp;&nbsp;&nbsp;&nbsp;小于 -le&nbsp;&nbsp;&nbsp;&nbsp;小于等于 -ge&nbsp;&nbsp; 大于等于 -z&nbsp;&nbsp;&nbsp;&nbsp;空串 =&nbsp;&nbsp;&nbsp;&nbsp; 两个字符相等 !=&nbsp;&nbsp;&nbsp;&nbsp;两个字符不等<br/><br/>1.字符串测试<br/>string1 = string2 string1等于string2(=两侧必须有空格）<br/>string1 != string2 string1不等于string2(!=两侧必须有空格）<br/>string (string不为空)<br/>-z string (string的长度为0)<br/>-n string (string的长度不为0)<br/>例子：<br/>test -n $word<br/>test tom = sun<br/><br/>3.逻辑测试：<br/>expr1 -a expr2 逻辑与<br/>expr1 -o expr2 逻辑或<br/>!expr&nbsp;&nbsp;逻辑非<br/><br/>1.字符串测试<br/>string1 = string2 string1等于string2(=两侧必须有空格）<br/>string1 != string2 string1不等于string2(!=两侧必须有空格）<br/>string (string不为空)<br/>-z string (string的长度为0)<br/>-n string (string的长度不为0)<br/>例子：<br/>test -n $word<br/>test tom = sun<br/><br/>3.逻辑测试：<br/>expr1 -a expr2 逻辑与<br/>expr1 -o expr2 逻辑或<br/>!expr&nbsp;&nbsp;逻辑非<br/><br/>字符串比较<br/>~$ if [ &quot;r&quot; = &quot;a&quot; ]; then echo &quot;aa&quot;; else echo &quot;bb&quot;; fi<br/>bb<br/>多行输入 “；”换成 “回车”<br/>~$ if [ &quot;r&quot; = &quot;a&quot; ]<br/>&gt; then<br/>&gt; echo &quot;aa&quot;<br/>&gt; else<br/>&gt; echo &quot;bb&quot;<br/>&gt; fi<br/>bb<br/>整数比较<br/><br/>~$ if [ 1 -eq 2 ]<br/>&gt; then<br/>&gt; echo &quot;aa&quot;<br/>&gt; else<br/>&gt; echo &quot;bb&quot;<br/>&gt; fi<br/>bb
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Shell Scripts学习之if ]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>