<?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: shell scripting</title>
	<atom:link href="http://antipaucity.com/2009/10/15/shell-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://antipaucity.com/2009/10/15/shell-scripting/</link>
	<description>fighting the lack of good ideas</description>
	<lastBuildDate>Fri, 30 Jul 2010 13:08:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: antipaucity</title>
		<link>http://antipaucity.com/2009/10/15/shell-scripting/comment-page-1/#comment-16773</link>
		<dc:creator>antipaucity</dc:creator>
		<pubDate>Sat, 17 Oct 2009 07:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://antipaucity.com/?p=443#comment-16773</guid>
		<description>Fair enough - rarely if ever see the $() construct in the environments I&#039;ve been exposed-to: but good to know about :)</description>
		<content:encoded><![CDATA[<p>Fair enough &#8211; rarely if ever see the $() construct in the environments I&#8217;ve been exposed-to: but good to know about <img src='http://antipaucity.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexei</title>
		<link>http://antipaucity.com/2009/10/15/shell-scripting/comment-page-1/#comment-16772</link>
		<dc:creator>Alexei</dc:creator>
		<pubDate>Fri, 16 Oct 2009 15:28:24 +0000</pubDate>
		<guid isPermaLink="false">http://antipaucity.com/?p=443#comment-16772</guid>
		<description>Legibility. I work with UNIX for about 15 yrs now, shell-scripting probably the same. I *know* the ticks well enough. But every now and then, I still get caught in a messy sequence of &#039; and &quot; and `, mostly when they&#039;re nested.

Thus, replacing the backtick with $( ) makes things one degree less messy.

IMHO, naturally ;-)</description>
		<content:encoded><![CDATA[<p>Legibility. I work with UNIX for about 15 yrs now, shell-scripting probably the same. I *know* the ticks well enough. But every now and then, I still get caught in a messy sequence of &#8216; and &#8221; and `, mostly when they&#8217;re nested.</p>
<p>Thus, replacing the backtick with $( ) makes things one degree less messy.</p>
<p>IMHO, naturally <img src='http://antipaucity.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: antipaucity</title>
		<link>http://antipaucity.com/2009/10/15/shell-scripting/comment-page-1/#comment-16771</link>
		<dc:creator>antipaucity</dc:creator>
		<pubDate>Fri, 16 Oct 2009 03:51:38 +0000</pubDate>
		<guid isPermaLink="false">http://antipaucity.com/?p=443#comment-16771</guid>
		<description>Thanks, @Alexei - I do typically do a usage of some kind, and of course checking your input is *always* a good idea =D

Curious, though - why is the $() preferable to `` for grabbing the output of an exec&#039;d command into the variable?</description>
		<content:encoded><![CDATA[<p>Thanks, @Alexei &#8211; I do typically do a usage of some kind, and of course checking your input is *always* a good idea =D</p>
<p>Curious, though &#8211; why is the $() preferable to &#8220; for grabbing the output of an exec&#8217;d command into the variable?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexei</title>
		<link>http://antipaucity.com/2009/10/15/shell-scripting/comment-page-1/#comment-16769</link>
		<dc:creator>Alexei</dc:creator>
		<pubDate>Fri, 16 Oct 2009 01:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://antipaucity.com/?p=443#comment-16769</guid>
		<description>Also, you might want to turn the usage message into a function. I do that all the time:

---------- cut here -----------
usage() {
  echo &quot;usage: ${0##*/}  [on&#124;off]&quot; &gt;&amp;2
  exit 1
}

# and then, some parameter checking
[[ -z &quot;$1&quot; &#124;&#124; -z &quot;$2&quot; ]] &amp;&amp; usage
[[ &quot;$2&quot; == &quot;on&quot; &#124;&#124; &quot;$2&quot; == &quot;off&quot; ]] &#124;&#124; usage
---------- cut here -----------</description>
		<content:encoded><![CDATA[<p>Also, you might want to turn the usage message into a function. I do that all the time:</p>
<p>&#8212;&#8212;&#8212;- cut here &#8212;&#8212;&#8212;&#8211;<br />
usage() {<br />
  echo &#8220;usage: ${0##*/}  [on|off]&#8221; &gt;&amp;2<br />
  exit 1<br />
}</p>
<p># and then, some parameter checking<br />
[[ -z "$1" || -z "$2" ]] &amp;&amp; usage<br />
[[ "$2" == "on" || "$2" == "off" ]] || usage<br />
&#8212;&#8212;&#8212;- cut here &#8212;&#8212;&#8212;&#8211;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexei</title>
		<link>http://antipaucity.com/2009/10/15/shell-scripting/comment-page-1/#comment-16768</link>
		<dc:creator>Alexei</dc:creator>
		<pubDate>Fri, 16 Oct 2009 01:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://antipaucity.com/?p=443#comment-16768</guid>
		<description>Warren,

just a style/good-practice recommendation:

Instead of:
SERVICES=`chkconfig --list &#124; cut -f 1 &#124; grep -v ^$ &#124; grep -v &#039;:&#039; &#124; sort`

Use:
SERVICES=$(chkconfig --list &#124; cut -f 1 &#124; grep -v ^$ &#124; grep -v &#039;:&#039; &#124; sort)

It&#039;s easier to read than the ticks. ;-)</description>
		<content:encoded><![CDATA[<p>Warren,</p>
<p>just a style/good-practice recommendation:</p>
<p>Instead of:<br />
SERVICES=`chkconfig &#8211;list | cut -f 1 | grep -v ^$ | grep -v &#8216;:&#8217; | sort`</p>
<p>Use:<br />
SERVICES=$(chkconfig &#8211;list | cut -f 1 | grep -v ^$ | grep -v &#8216;:&#8217; | sort)</p>
<p>It&#8217;s easier to read than the ticks. <img src='http://antipaucity.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
