<?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"
	>
<channel>
	<title>Comments on: What is wrong with this bash script?</title>
	<atom:link href="http://www.thecodecave.com/article330/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thecodecave.com/article330</link>
	<description>Cold storage before my best ideas melt away...</description>
	<pubDate>Thu, 20 Nov 2008 11:24:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Brian</title>
		<link>http://www.thecodecave.com/article330#comment-8426</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 19 Jan 2007 19:41:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.thecodecave.com/article330#comment-8426</guid>
		<description>Thanks Cindy!

That works Great!



[DOS]
#$bash

ArchiveName="test.tar"
#ArchiveName="test.zip"
#ArchiveName="test.tar.gz"
echo "ArchiveName: $ArchiveName"

if [ $(echo $ArchiveName &#124; grep -i "tar$" ) ]
then
  echo Test1: It is a tar file
else
  echo Test1: It is not a tar file
fi

if [ $(echo $ArchiveName &#124; grep -i "tar.gz$" ) ]
then
  echo Test2: It is a tar.gz file
else
  echo Test2: It is not a tar.gz file
fi

if [ $(echo $ArchiveName &#124; grep -i "tar$" ) ] &#124;&#124; [ $(echo $ArchiveName &#124; grep -i "tar.gz$" ) ]
then
  echo Test3: It is a tar file
else
  echo Test3: It is a zip file
fi
[/DOS]</description>
		<content:encoded><![CDATA[<p>Thanks Cindy!</p>
<p>That works Great!</p>
<div class="igBar"><span id="ldos-1"><a href="#" onclick="javascript:showPlainTxt('dos-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-1">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#$bash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ArchiveName=&quot;test.tar&quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#ArchiveName=&quot;test.zip&quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#ArchiveName=&quot;test.tar.gz&quot;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100; font-weight: bold;">echo</span> &quot;ArchiveName: $ArchiveName&quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">if</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100; font-weight: bold;">echo</span> $ArchiveName | grep -i &quot;tar$&quot; <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test1: It is a tar file</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test1: It is <span style="color: #000000; font-weight: bold;">not</span> a tar file</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">if</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100; font-weight: bold;">echo</span> $ArchiveName | grep -i &quot;tar.gz$&quot; <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test2: It is a tar.gz file</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test2: It is <span style="color: #000000; font-weight: bold;">not</span> a tar.gz file</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">if</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100; font-weight: bold;">echo</span> $ArchiveName | grep -i &quot;tar$&quot; <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span> || <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100; font-weight: bold;">echo</span> $ArchiveName | grep -i &quot;tar.gz$&quot; <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test3: It is a tar file</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test3: It is a zip file</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: digitalramble</title>
		<link>http://www.thecodecave.com/article330#comment-8425</link>
		<dc:creator>digitalramble</dc:creator>
		<pubDate>Fri, 19 Jan 2007 19:16:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.thecodecave.com/article330#comment-8425</guid>
		<description>Cripes.






[DOS]
if [ $(echo $ArchiveName &#124; grep -i "tar$" ) ]
then
  echo Test1: It is a tar file
else
  echo Test1: It is a zip file
fi
[/DOS]

You need a preview plugin :-)</description>
		<content:encoded><![CDATA[<p>Cripes.</p>
<div class="igBar"><span id="ldos-2"><a href="#" onclick="javascript:showPlainTxt('dos-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-2">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">if</span> <span style="color: #66cc66;">&#91;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100; font-weight: bold;">echo</span> $ArchiveName | grep -i &quot;tar$&quot; <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test1: It is a tar file</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00b100; font-weight: bold;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100; font-weight: bold;">echo</span> Test1: It is a zip file</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You need a preview plugin <img src='http://www.thecodecave.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: digitalramble</title>
		<link>http://www.thecodecave.com/article330#comment-8424</link>
		<dc:creator>digitalramble</dc:creator>
		<pubDate>Fri, 19 Jan 2007 19:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.thecodecave.com/article330#comment-8424</guid>
		<description>if [ $(echo $ArchiveName &#124; grep -i "tar$" ) ]
then
  echo Test1: It is a tar file
else
  echo Test1: It is a zip file
fi


that works for me.  (i'm using unix, so put your -i back where it belongs)</description>
		<content:encoded><![CDATA[<p>if [ $(echo $ArchiveName | grep -i "tar$" ) ]<br />
then<br />
  echo Test1: It is a tar file<br />
else<br />
  echo Test1: It is a zip file<br />
fi</p>
<p>that works for me.  (i'm using unix, so put your -i back where it belongs)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.758 seconds -->
