<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Bourne/bash shell scripts: string comparison</title>
	<atom:link href="http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Sat, 21 Nov 2009 16:14:40 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: BhupinderSingh is a layer</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-16418</link>
		<dc:creator>BhupinderSingh is a layer</dc:creator>
		<pubDate>Wed, 18 Nov 2009 16:20:10 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-16418</guid>
		<description>You&#039;re lying. That dosen&#039;t work.&lt;br&gt;test: 40: ==: unexpected operator</description>
		<content:encoded><![CDATA[<p>You&#39;re lying. That dosen&#39;t work.<br />test: 40: ==: unexpected operator</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: netuddki</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-15851</link>
		<dc:creator>netuddki</dc:creator>
		<pubDate>Sun, 25 Oct 2009 21:59:53 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-15851</guid>
		<description>The correct solution is here a year ago. It should be corrected in the article too, so one won&#039;t try those for 10 minutes before finding the answer here.</description>
		<content:encoded><![CDATA[<p>The correct solution is here a year ago. It should be corrected in the article too, so one won&#39;t try those for 10 minutes before finding the answer here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Florin</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-10438</link>
		<dc:creator>Florin</dc:creator>
		<pubDate>Thu, 16 Apr 2009 10:35:45 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-10438</guid>
		<description>This is the method i curently to test if a string is empty:&lt;br&gt;&lt;br&gt;if [ &quot;X${VAR}&quot; = &quot;X&quot; ]; then&lt;br&gt;          echo &quot;Empty string&quot;&lt;br&gt;fi&lt;br&gt;&lt;br&gt;Testing for equality follows the same logic but without X.</description>
		<content:encoded><![CDATA[<p>This is the method i curently to test if a string is empty:</p>
<p>if [ "X${VAR}" = "X" ]; then<br />          echo &#8220;Empty string&#8221;<br />fi</p>
<p>Testing for equality follows the same logic but without X.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: asd</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-10004</link>
		<dc:creator>asd</dc:creator>
		<pubDate>Thu, 02 Apr 2009 06:58:39 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-10004</guid>
		<description>These examples don&#039;t work.</description>
		<content:encoded><![CDATA[<p>These examples don&#39;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bhargav</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-9815</link>
		<dc:creator>bhargav</dc:creator>
		<pubDate>Fri, 27 Mar 2009 15:15:41 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-9815</guid>
		<description>if  [  &quot;$var&quot;  = &quot;value&quot; ]&lt;br&gt;then&lt;br&gt;echo not the same&lt;br&gt;fi</description>
		<content:encoded><![CDATA[<p>if  [  "$var"  = "value" ]<br />then<br />echo not the same<br />fi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-4401</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 22 Oct 2008 01:38:39 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-4401</guid>
		<description>i believe the $var needs to be in quotes, like so:&lt;br&gt;&lt;br&gt;if [ -z &quot;$var&quot; ];then&lt;br&gt;echo null&lt;br&gt;fi&lt;br&gt;&lt;br&gt;Best Regards,&lt;br&gt;Kibokina</description>
		<content:encoded><![CDATA[<p>i believe the $var needs to be in quotes, like so:</p>
<p>if [ -z "$var" ];then<br />echo null<br />fi</p>
<p>Best Regards,<br />Kibokina</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BhupinderSingh</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-1949</link>
		<dc:creator>BhupinderSingh</dc:creator>
		<pubDate>Fri, 10 Jun 2005 04:43:20 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-1949</guid>
		<description>this can also be used to compare 2 strings

s1 = &quot;as&quot;
s2 = &quot;bs&quot;

if test $s1 == $s2
then 
echo s1 and s2 are equal
fi</description>
		<content:encoded><![CDATA[<p>this can also be used to compare 2 strings</p>
<p>s1 = &#8220;as&#8221;<br />
s2 = &#8220;bs&#8221;</p>
<p>if test $s1 == $s2<br />
then<br />
echo s1 and s2 are equal<br />
fi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guest</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-117</link>
		<dc:creator>guest</dc:creator>
		<pubDate>Fri, 05 Mar 2004 00:35:13 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-117</guid>
		<description>the following syntax is wrong 

if [ $var == &quot;&quot; ] ......

because if the variable $var is empty the test is  
if [ == &quot;&quot; ] and gives an error 

you are obliged to quote the var :
if [ &quot;$var&quot; == &quot;&quot; ] ... 


Sergio</description>
		<content:encoded><![CDATA[<p>the following syntax is wrong </p>
<p>if [ $var == "" ] &#8230;&#8230;</p>
<p>because if the variable $var is empty the test is<br />
if [ == "" ] and gives an error </p>
<p>you are obliged to quote the var :<br />
if [ "$var" == "" ] &#8230; </p>
<p>Sergio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/comment-page-1/#comment-80</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 01 Feb 2004 15:47:19 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-80</guid>
		<description>Wouldn&#039;t the following be better?

if [ -z $var ];then
     echo null
fi</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t the following be better?</p>
<p>if [ -z $var ];then<br />
     echo null<br />
fi</p>
]]></content:encoded>
	</item>
</channel>
</rss>
