<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Interesting Shell Script Problem [Solved]</title>
	<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/</link>
	<description>Misunderstood by everyone, everywhere.</description>
	<pubDate>Fri, 21 Nov 2008 15:02:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: DoC</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-236</link>
		<dc:creator>DoC</dc:creator>
		<pubDate>Fri, 13 May 2005 16:22:06 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-236</guid>
		<description>I win! \o/</description>
		<content:encoded><![CDATA[<p>I win! \o/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cliph</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-235</link>
		<dc:creator>Cliph</dc:creator>
		<pubDate>Fri, 13 May 2005 15:40:01 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-235</guid>
		<description>I tried yours and it didn't work, for me at least. Good effort though.

Thanks to everyone who replied.</description>
		<content:encoded><![CDATA[<p>I tried yours and it didn&#8217;t work, for me at least. Good effort though.</p>
<p>Thanks to everyone who replied.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnke</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-234</link>
		<dc:creator>johnke</dc:creator>
		<pubDate>Fri, 13 May 2005 15:38:13 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-234</guid>
		<description>Surely I should get some points for elegance and lack of disruption to your original script? :(</description>
		<content:encoded><![CDATA[<p>Surely I should get some points for elegance and lack of disruption to your original script? :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cliph</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-233</link>
		<dc:creator>Cliph</dc:creator>
		<pubDate>Fri, 13 May 2005 15:35:15 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-233</guid>
		<description>DoC wins for the first working solution and an explaination.

Learning is fun.</description>
		<content:encoded><![CDATA[<p>DoC wins for the first working solution and an explaination.</p>
<p>Learning is fun.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnke</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-232</link>
		<dc:creator>johnke</dc:creator>
		<pubDate>Fri, 13 May 2005 15:30:25 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-232</guid>
		<description>if grep -vq " $user " $GROUPFILE
then

... seems to work for me (ubuntu hoary).</description>
		<content:encoded><![CDATA[<p>if grep -vq &#8221; $user &#8221; $GROUPFILE<br />
then</p>
<p>&#8230; seems to work for me (ubuntu hoary).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DoC</title>
		<link>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-231</link>
		<dc:creator>DoC</dc:creator>
		<pubDate>Fri, 13 May 2005 15:29:00 +0000</pubDate>
		<guid>http://chicks-dig-unix.net/2005/05/13/interesting-shell-script-problem/#comment-231</guid>
		<description>On the other hand, I don't think that grep will actually return a 1 or 0 in your script. backticks return the output from a statement, not the return value. So, you're NOTing nothing (i.e. 0) which evaluates to true.

Do the grep in a statement before your if, then use the if to test the value of $? 

grep -w $user $GROUPFILE
if [ ! $? == "1"]
etc

</description>
		<content:encoded><![CDATA[<p>On the other hand, I don&#8217;t think that grep will actually return a 1 or 0 in your script. backticks return the output from a statement, not the return value. So, you&#8217;re NOTing nothing (i.e. 0) which evaluates to true.</p>
<p>Do the grep in a statement before your if, then use the if to test the value of $? </p>
<p>grep -w $user $GROUPFILE<br />
if [ ! $? == &#8220;1&#8243;]<br />
etc</p>
]]></content:encoded>
	</item>
</channel>
</rss>
