<?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: Shelling scripting is a necessary skill</title>
	<atom:link href="http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/feed" rel="self" type="application/rss+xml" />
	<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html</link>
	<description>Learn the UNIX/Linux command line</description>
	<lastBuildDate>Mon, 06 Jun 2011 01:35:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ben Hartshorne</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-47646</link>
		<dc:creator>Ben Hartshorne</dc:creator>
		<pubDate>Thu, 19 May 2011 04:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-47646</guid>
		<description>The trick of using &quot;grep [a]pplication&quot; works because it alters the line representing ps to a point where the regex no longer matches.

In other words, when you put &quot;grep [a]pplication&quot; in your pipe, the ps output shows exactly that (my test uses grep -v so I can see it):
ben     8886 17330  0 21:07 pts/17   00:00:00 grep -v [a]pplication

The regex of [a]pplication will match application, but you would have to escape the brackets for it to match [a]pplication.  Because of that, the grep line no longer matches the regex and doesn&#039;t appear.</description>
		<content:encoded><![CDATA[<p>The trick of using &#8220;grep [a]pplication&#8221; works because it alters the line representing ps to a point where the regex no longer matches.</p>
<p>In other words, when you put &#8220;grep [a]pplication&#8221; in your pipe, the ps output shows exactly that (my test uses grep -v so I can see it):<br />
ben     8886 17330  0 21:07 pts/17   00:00:00 grep -v [a]pplication</p>
<p>The regex of [a]pplication will match application, but you would have to escape the brackets for it to match [a]pplication.  Because of that, the grep line no longer matches the regex and doesn&#8217;t appear.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MK</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-47498</link>
		<dc:creator>MK</dc:creator>
		<pubDate>Thu, 24 Mar 2011 02:29:21 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-47498</guid>
		<description>How does this trick of omitting grep from the results of grep work ?

pid = $(ps -ef &#124; grep [a]pplication)

Thanks!</description>
		<content:encoded><![CDATA[<p>How does this trick of omitting grep from the results of grep work ?</p>
<p>pid = $(ps -ef | grep [a]pplication)</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: timeout &#8211; new coreutils command</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-47352</link>
		<dc:creator>timeout &#8211; new coreutils command</dc:creator>
		<pubDate>Sat, 15 Jan 2011 18:46:04 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-47352</guid>
		<description>[...] 7.0 Beta (2008-10-05) is an exceedingly useful command. Often I write a script which needs to run a particular command for a period of time and then stop and restart. Before timeout this was quite painful. Some commands such as nc (netcat) [...]</description>
		<content:encoded><![CDATA[<p>[...] 7.0 Beta (2008-10-05) is an exceedingly useful command. Often I write a script which needs to run a particular command for a period of time and then stop and restart. Before timeout this was quite painful. Some commands such as nc (netcat) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-43301</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Mon, 04 Oct 2010 22:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-43301</guid>
		<description>To simplify things:

pid=$(ps -ef &#124; grep application &#124; egrep -v grep &#124; awk ‘{print $2}’)

Could be rendered:

pid=$(ps -ef &#124; grep [a]pplication &#124; awk ‘{print $2}’)</description>
		<content:encoded><![CDATA[<p>To simplify things:</p>
<p>pid=$(ps -ef | grep application | egrep -v grep | awk ‘{print $2}’)</p>
<p>Could be rendered:</p>
<p>pid=$(ps -ef | grep [a]pplication | awk ‘{print $2}’)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-39910</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Thu, 29 Apr 2010 20:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-39910</guid>
		<description>i&#039;m sure you&#039;d fall in love with /usr/bin/pgrep if you knew it... :-)</description>
		<content:encoded><![CDATA[<p>i&#8217;m sure you&#8217;d fall in love with /usr/bin/pgrep if you knew it&#8230; <img src='http://bashcurescancer.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peko</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-38863</link>
		<dc:creator>Peko</dc:creator>
		<pubDate>Wed, 24 Mar 2010 23:37:35 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-38863</guid>
		<description>&quot;there was thoughts of automatically restarted the application to fix the issue at hand&quot;

Do you mean &quot;restarting&quot;? (not &quot;restarted&quot;)</description>
		<content:encoded><![CDATA[<p>&#8220;there was thoughts of automatically restarted the application to fix the issue at hand&#8221;</p>
<p>Do you mean &#8220;restarting&#8221;? (not &#8220;restarted&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peko</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-38862</link>
		<dc:creator>Peko</dc:creator>
		<pubDate>Wed, 24 Mar 2010 23:36:21 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-38862</guid>
		<description>&quot;there was thoughts of automatically __restarted__ the application to fix the issue at hand&quot;

Do you mean &quot;restarting&quot; ?</description>
		<content:encoded><![CDATA[<p>&#8220;there was thoughts of automatically __restarted__ the application to fix the issue at hand&#8221;</p>
<p>Do you mean &#8220;restarting&#8221; ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peko</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-38861</link>
		<dc:creator>Peko</dc:creator>
		<pubDate>Wed, 24 Mar 2010 23:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-38861</guid>
		<description>This : 
&lt;code&gt;
pid=$(ps -ef &#124; grep application &#124; egrep -v grep &#124; awk ‘{print $2}’)
&lt;/code&gt;

Could be simplier:
&lt;code&gt;
pid=$(pgrep application)
&lt;/code&gt;

Or at least more effective if &quot;pgrep&quot; is unvailable:
&lt;code&gt;
pid=$(ps -ef&#124;grep [a]pplication&#124;awk ‘{print $2}’)
&lt;/code&gt;

Using the good ol&#039; trick preventing &quot;grep&quot; from listing itself.</description>
		<content:encoded><![CDATA[<p>This :<br />
<code><br />
pid=$(ps -ef | grep application | egrep -v grep | awk ‘{print $2}’)<br />
</code></p>
<p>Could be simplier:<br />
<code><br />
pid=$(pgrep application)<br />
</code></p>
<p>Or at least more effective if &#8220;pgrep&#8221; is unvailable:<br />
<code><br />
pid=$(ps -ef|grep [a]pplication|awk ‘{print $2}’)<br />
</code></p>
<p>Using the good ol&#8217; trick preventing &#8220;grep&#8221; from listing itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brock Noland</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-38858</link>
		<dc:creator>Brock Noland</dc:creator>
		<pubDate>Wed, 24 Mar 2010 17:53:07 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-38858</guid>
		<description>Just so if the strace fails, the script does not go berserk.  A &quot;safety&quot; mechanism of sorts.</description>
		<content:encoded><![CDATA[<p>Just so if the strace fails, the script does not go berserk.  A &#8220;safety&#8221; mechanism of sorts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://bashcurescancer.com/shelling-scripting-is-a-necessary-skill.html/comment-page-1#comment-38854</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 24 Mar 2010 17:12:51 +0000</pubDate>
		<guid isPermaLink="false">http://bashcurescancer.com/?p=180#comment-38854</guid>
		<description>What is the purpose of the &quot;while sleep 60&quot; line?</description>
		<content:encoded><![CDATA[<p>What is the purpose of the &#8220;while sleep 60&#8243; line?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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

