<?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: Scripting, Part Two: Looping for Fun and Profit</title>
	<atom:link href="http://www.linux-mag.com/id/8797/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linux-mag.com/id/8797/</link>
	<description>Open Source, Open Standards</description>
	<lastBuildDate>Sat, 05 Oct 2013 13:48:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: jlrobins</title>
		<link>http://www.linux-mag.com/id/8797/#comment-1234567</link>
		<dc:creator>jlrobins</dc:creator>
		<pubDate>Fri, 20 Sep 2013 14:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-1234567</guid>
		<description>OK, you introduce the &quot;getent&quot; command. Explain what it does!  The awk was bad enough.  For a novice, it could use a bit of explaining.  But getent is not a command most novices are going to necessarily know.</description>
		<content:encoded><![CDATA[<p>OK, you introduce the &#8220;getent&#8221; command. Explain what it does!  The awk was bad enough.  For a novice, it could use a bit of explaining.  But getent is not a command most novices are going to necessarily know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stargazer</title>
		<link>http://www.linux-mag.com/id/8797/#comment-1064843</link>
		<dc:creator>stargazer</dc:creator>
		<pubDate>Fri, 19 Jul 2013 19:13:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-1064843</guid>
		<description>Some sites to learn bash based on material, accuracy, and best
practices: www.linuxcommand.org, bash reference, tldp.org,
mywiki.wooledge.org, stackoverflow.com for specific questions. 
Bash man page for reference.

It&#039;s all over the net :-(, but seldom pipe cat into while. Why? One,
it is often unnecessary/redundant (if a file use stdin redirect),
two, it creates a subprocess/child process. Take a look at process
substitution, like:

while read name; do echo $name; done &lt; &lt;(..) 

Regarding this article, here&#039;s another option:

pat=&#039;/home/*&#039;
while IFS=: read -r user _ _ _ name homeDir _; do 
  if [[ &quot;${homeDir}&quot; == ${pat} ]]; then 
    echo &quot;${user}&quot; 
    printf -- &#039;Just another way to output: %s\n&#039; &quot;${user}&quot;
  fi 
done &lt; /etc/passwd

NOTE: (1) IFS is the field separator; (2) _ is just a placeholder,
could be anything; (3) [[ == ]] right-hand side quoted - literal
string; not quoted - a glob pattern (patterns are not regular
expressions); (4) For safety and reliability, it is almost always
better to quote parameter expansions. I use the brace too because as
scripts grow, I may need them, so my eyeballs are use to seeing them
and I&#039;m consistent.

Bash has come a long way and is always getting better. Where once
sed and awk and other external commands were the only way, bash can
do it. There is the &#039;=~&#039; operator to do regular expressions w/in
[[]], and many forms of parameter expansions to create strings, get
substrings, or substitution. I&#039;d keep the bash, awk, and sed
articles separate, but maybe a final one combining as needed.</description>
		<content:encoded><![CDATA[<p>Some sites to learn bash based on material, accuracy, and best<br />
practices: <a href="http://www.linuxcommand.org" rel="nofollow">http://www.linuxcommand.org</a>, bash reference, tldp.org,<br />
mywiki.wooledge.org, stackoverflow.com for specific questions.<br />
Bash man page for reference.</p>
<p>It&#8217;s all over the net :-(, but seldom pipe cat into while. Why? One,<br />
it is often unnecessary/redundant (if a file use stdin redirect),<br />
two, it creates a subprocess/child process. Take a look at process<br />
substitution, like:</p>
<p>while read name; do echo $name; done &lt; &lt;(..) </p>
<p>Regarding this article, here&#039;s another option:</p>
<p>pat=&#039;/home/*&#039;<br />
while IFS=: read -r user _ _ _ name homeDir _; do<br />
  if [[ &quot;${homeDir}&quot; == ${pat} ]]; then<br />
    echo &quot;${user}&quot;<br />
    printf &#8212; &#039;Just another way to output: %s\n&#039; &quot;${user}&quot;<br />
  fi<br />
done &lt; /etc/passwd</p>
<p>NOTE: (1) IFS is the field separator; (2) _ is just a placeholder,<br />
could be anything; (3) [[ == ]] right-hand side quoted &#8211; literal<br />
string; not quoted &#8211; a glob pattern (patterns are not regular<br />
expressions); (4) For safety and reliability, it is almost always<br />
better to quote parameter expansions. I use the brace too because as<br />
scripts grow, I may need them, so my eyeballs are use to seeing them<br />
and I&#039;m consistent.</p>
<p>Bash has come a long way and is always getting better. Where once<br />
sed and awk and other external commands were the only way, bash can<br />
do it. There is the &#039;=~&#039; operator to do regular expressions w/in<br />
[[]], and many forms of parameter expansions to create strings, get<br />
substrings, or substitution. I&#039;d keep the bash, awk, and sed<br />
articles separate, but maybe a final one combining as needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris F.A. Johnson</title>
		<link>http://www.linux-mag.com/id/8797/#comment-1023807</link>
		<dc:creator>Chris F.A. Johnson</dc:creator>
		<pubDate>Sun, 30 Jun 2013 20:26:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-1023807</guid>
		<description>An excellent example of how not to do it.</description>
		<content:encoded><![CDATA[<p>An excellent example of how not to do it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris F.A. Johnson</title>
		<link>http://www.linux-mag.com/id/8797/#comment-1023805</link>
		<dc:creator>Chris F.A. Johnson</dc:creator>
		<pubDate>Sun, 30 Jun 2013 20:23:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-1023805</guid>
		<description>How is using an unnecessary command keeping it simple? It&#039;s just the opposite.</description>
		<content:encoded><![CDATA[<p>How is using an unnecessary command keeping it simple? It&#8217;s just the opposite.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Wallace</title>
		<link>http://www.linux-mag.com/id/8797/#comment-779807</link>
		<dc:creator>Brian Wallace</dc:creator>
		<pubDate>Fri, 22 Feb 2013 14:25:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-779807</guid>
		<description>Start on free websites. No point in paying while you learn. I use mine as bookmarks mostly so I don&#039;t have to put them in every browser I use.</description>
		<content:encoded><![CDATA[<p>Start on free websites. No point in paying while you learn. I use mine as bookmarks mostly so I don&#8217;t have to put them in every browser I use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Wallace</title>
		<link>http://www.linux-mag.com/id/8797/#comment-779791</link>
		<dc:creator>Brian Wallace</dc:creator>
		<pubDate>Fri, 22 Feb 2013 14:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-779791</guid>
		<description>Fine, but it should work or should show the troubleshooting to make it work (fix users.txt to names.txt).</description>
		<content:encoded><![CDATA[<p>Fine, but it should work or should show the troubleshooting to make it work (fix users.txt to names.txt).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Manfred</title>
		<link>http://www.linux-mag.com/id/8797/#comment-731871</link>
		<dc:creator>Matthew Manfred</dc:creator>
		<pubDate>Sun, 20 Jan 2013 22:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-731871</guid>
		<description>I always tell young and up becoming programmers. Decide before you start a project if you&#039;re working for profit or not, deciding mid project is never a good idea and will usually effect your project . negatively &lt;a href=&quot;http://www.precisionbits.com/router-bit-sets.html&quot; rel=&quot;nofollow&quot;&gt;like this one here&lt;/a&gt; that could of been a big script.</description>
		<content:encoded><![CDATA[<p>I always tell young and up becoming programmers. Decide before you start a project if you&#8217;re working for profit or not, deciding mid project is never a good idea and will usually effect your project . negatively <a href="http://www.precisionbits.com/router-bit-sets.html" rel="nofollow">like this one here</a> that could of been a big script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erick</title>
		<link>http://www.linux-mag.com/id/8797/#comment-261109</link>
		<dc:creator>Erick</dc:creator>
		<pubDate>Wed, 20 Jun 2012 20:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-261109</guid>
		<description>He is attempting to begin simple tutorials right off the bat, as the last person mentioned. He isn&#039;t trying to blast those that aren&#039;t use to scripting out of the water with a nuclear warhead. So he was KISSing it. He did fail to define a couple of the commands so that you fully understood what it was doing at every second, but using the man page can give you a bit of understanding as you&#039;re looking through it. 

He is, as he had said, starting at the beginning. What you did, while it maybe correct, has absolutely no place (Nor did YOU give a full explanation) in a beginning tutorial. While your method works and may be a bit more robust, you basically lost all credibility and probably scared half of the green users trying to cut their teeth into not wanting to touch a script at all. 

It is, as the other comment inferred, like taking someone trying to learn to swim, and throwing them off the boat, and refusing to get them unless they drown. Simple building blocks helps others gain that greater understanding and expand their own intellect. 

I am currently enjoying the article, as I haven&#039;t messed with scripts in years, and reestablishing very rusty pathways. I think he is doing a very good job, and would only ask that, (unless there&#039;s a word limit for his file) to give a few more explanations of some of the path he is using rather than just immediately expose. It&#039;s easy for someone re-familiarizing them self with it, a newbie might get a little more confused. All in all, I think Mr. Hess is doing a wonderful job, and want to thank him specifically for the information he is delivering to the community in clear, concise learning baby steps.</description>
		<content:encoded><![CDATA[<p>He is attempting to begin simple tutorials right off the bat, as the last person mentioned. He isn&#8217;t trying to blast those that aren&#8217;t use to scripting out of the water with a nuclear warhead. So he was KISSing it. He did fail to define a couple of the commands so that you fully understood what it was doing at every second, but using the man page can give you a bit of understanding as you&#8217;re looking through it. </p>
<p>He is, as he had said, starting at the beginning. What you did, while it maybe correct, has absolutely no place (Nor did YOU give a full explanation) in a beginning tutorial. While your method works and may be a bit more robust, you basically lost all credibility and probably scared half of the green users trying to cut their teeth into not wanting to touch a script at all. </p>
<p>It is, as the other comment inferred, like taking someone trying to learn to swim, and throwing them off the boat, and refusing to get them unless they drown. Simple building blocks helps others gain that greater understanding and expand their own intellect. </p>
<p>I am currently enjoying the article, as I haven&#8217;t messed with scripts in years, and reestablishing very rusty pathways. I think he is doing a very good job, and would only ask that, (unless there&#8217;s a word limit for his file) to give a few more explanations of some of the path he is using rather than just immediately expose. It&#8217;s easy for someone re-familiarizing them self with it, a newbie might get a little more confused. All in all, I think Mr. Hess is doing a wonderful job, and want to thank him specifically for the information he is delivering to the community in clear, concise learning baby steps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Regrowth</title>
		<link>http://www.linux-mag.com/id/8797/#comment-248043</link>
		<dc:creator>Regrowth</dc:creator>
		<pubDate>Thu, 07 Jun 2012 12:26:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-248043</guid>
		<description>I am trying to generate a weekly HTML report using LINUX Scripting. This will have record counts of some files</description>
		<content:encoded><![CDATA[<p>I am trying to generate a weekly HTML report using LINUX Scripting. This will have record counts of some files</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tony</title>
		<link>http://www.linux-mag.com/id/8797/#comment-205715</link>
		<dc:creator>tony</dc:creator>
		<pubDate>Tue, 01 May 2012 15:03:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-205715</guid>
		<description>Two things I am having a problem with here:
First, it writes no html to user_space.html

Second, what is this &quot;names.txt&quot; file for?
I see the script writing data to it, but then not doing anything with that file.
I think parts of the code are not displayed.</description>
		<content:encoded><![CDATA[<p>Two things I am having a problem with here:<br />
First, it writes no html to user_space.html</p>
<p>Second, what is this &#8220;names.txt&#8221; file for?<br />
I see the script writing data to it, but then not doing anything with that file.<br />
I think parts of the code are not displayed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: i_hack_sites</title>
		<link>http://www.linux-mag.com/id/8797/#comment-187811</link>
		<dc:creator>i_hack_sites</dc:creator>
		<pubDate>Thu, 12 Apr 2012 23:26:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-187811</guid>
		<description>Good article. More sysadmins should automate stuff. It makes you a better admin. If it gets the job done and does not break anything, is a small inefficency in the script really a problem?

for i in `cat boring_tasks`; do
automate $i
done

now_do_fun_stuff</description>
		<content:encoded><![CDATA[<p>Good article. More sysadmins should automate stuff. It makes you a better admin. If it gets the job done and does not break anything, is a small inefficency in the script really a problem?</p>
<p>for i in `cat boring_tasks`; do<br />
automate $i<br />
done</p>
<p>now_do_fun_stuff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad</title>
		<link>http://www.linux-mag.com/id/8797/#comment-150329</link>
		<dc:creator>Brad</dc:creator>
		<pubDate>Fri, 17 Feb 2012 13:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-150329</guid>
		<description>Good article.  Very informative for beginners, and a nice refresher for Linux veterans.
http://www.techopedia.com/2/28282/networks/wireless/80211ac-gigabit-wireless-lan</description>
		<content:encoded><![CDATA[<p>Good article.  Very informative for beginners, and a nice refresher for Linux veterans.<br />
<a href="http://www.techopedia.com/2/28282/networks/wireless/80211ac-gigabit-wireless-lan" rel="nofollow">http://www.techopedia.com/2/28282/networks/wireless/80211ac-gigabit-wireless-lan</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: npazegaf</title>
		<link>http://www.linux-mag.com/id/8797/#comment-144115</link>
		<dc:creator>npazegaf</dc:creator>
		<pubDate>Wed, 08 Feb 2012 17:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-144115</guid>
		<description>yrJ3Uo  &lt;a href=&quot;http://cwcgecvwisjc.com/&quot; rel=&quot;nofollow&quot;&gt;cwcgecvwisjc&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>yrJ3Uo  <a href="http://cwcgecvwisjc.com/" rel="nofollow">cwcgecvwisjc</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Breitlinger</title>
		<link>http://www.linux-mag.com/id/8797/#comment-142709</link>
		<dc:creator>Breitlinger</dc:creator>
		<pubDate>Tue, 07 Feb 2012 08:55:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-142709</guid>
		<description>Jon /     Nneke&#8230;I have to cefnoss, I&#8217;m still running 2.0.1 on here.   I want to move it to a different hosting account so I&#8217;ve been procrastinating on the upgrade, so I can do both at the same time.</description>
		<content:encoded><![CDATA[<p>Jon /     Nneke&#8230;I have to cefnoss, I&#8217;m still running 2.0.1 on here.   I want to move it to a different hosting account so I&#8217;ve been procrastinating on the upgrade, so I can do both at the same time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gitesh</title>
		<link>http://www.linux-mag.com/id/8797/#comment-61621</link>
		<dc:creator>gitesh</dc:creator>
		<pubDate>Tue, 29 Nov 2011 11:20:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-61621</guid>
		<description>We are trying to develop a GPL opensource product for database monitoring and &lt;a href=&quot;http://www.dbametrix.com&quot; rel=&quot;nofollow&quot;&gt;database support&lt;/a&gt;. Shell scripting and SQL are best tools to develop this and achieve our goal. Nice article and information found here. I bookmarked this.</description>
		<content:encoded><![CDATA[<p>We are trying to develop a GPL opensource product for database monitoring and <a href="http://www.dbametrix.com" rel="nofollow">database support</a>. Shell scripting and SQL are best tools to develop this and achieve our goal. Nice article and information found here. I bookmarked this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hang tags</title>
		<link>http://www.linux-mag.com/id/8797/#comment-41575</link>
		<dc:creator>hang tags</dc:creator>
		<pubDate>Wed, 16 Nov 2011 07:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-41575</guid>
		<description>&lt;a href=&quot;http://www.bestgarmentaccessories.com/&quot; rel=&quot;nofollow&quot;&gt;hang tags&lt;/a&gt;
Any recommendations?</description>
		<content:encoded><![CDATA[<p><a href="http://www.bestgarmentaccessories.com/" rel="nofollow">hang tags</a><br />
Any recommendations?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hang tags</title>
		<link>http://www.linux-mag.com/id/8797/#comment-41573</link>
		<dc:creator>hang tags</dc:creator>
		<pubDate>Wed, 16 Nov 2011 07:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-41573</guid>
		<description>I&#039;m planning to start my own website soon but I&#039;m a little lost on everything. Would you recommend starting with a free platform like Wordpress or go for a paid option? There are so many choices out there that I&#039;m completely confused .. Any recommendations? Cheers!</description>
		<content:encoded><![CDATA[<p>I&#8217;m planning to start my own website soon but I&#8217;m a little lost on everything. Would you recommend starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I&#8217;m completely confused .. Any recommendations? Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noneya</title>
		<link>http://www.linux-mag.com/id/8797/#comment-29285</link>
		<dc:creator>Noneya</dc:creator>
		<pubDate>Wed, 09 Nov 2011 01:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-29285</guid>
		<description>You are a great teacher.  By far more helpful and knowledgeable than most of my professors in college.  To hell with what the naysayers nitpick about, you are correct, if it works then it&#039;s CORRECT.

Thank you for all your effort and patience.</description>
		<content:encoded><![CDATA[<p>You are a great teacher.  By far more helpful and knowledgeable than most of my professors in college.  To hell with what the naysayers nitpick about, you are correct, if it works then it&#8217;s CORRECT.</p>
<p>Thank you for all your effort and patience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noneya</title>
		<link>http://www.linux-mag.com/id/8797/#comment-29245</link>
		<dc:creator>Noneya</dc:creator>
		<pubDate>Wed, 09 Nov 2011 01:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-29245</guid>
		<description>HE&#039;S TRYING NOT TO OVERWHELM NEWBIES WITH TOOOOOOOO MANY NEW COMMANDS. They&#039;ll figure out the shortcuts later.  It&#039;s building blocks until they work up to cursive.</description>
		<content:encoded><![CDATA[<p>HE&#8217;S TRYING NOT TO OVERWHELM NEWBIES WITH TOOOOOOOO MANY NEW COMMANDS. They&#8217;ll figure out the shortcuts later.  It&#8217;s building blocks until they work up to cursive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: term</title>
		<link>http://www.linux-mag.com/id/8797/#comment-27395</link>
		<dc:creator>term</dc:creator>
		<pubDate>Tue, 08 Nov 2011 07:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.linux-mag.com/?p=8797#comment-27395</guid>
		<description>I am sorry but JSON is no way near competing with XML. XML is far superior to JSON!! &lt;a href=&quot;http://www.pelletmillguide.com/germany_is_the_most_promising_pellets_market_in_europe.html&quot; rel=&quot;nofollow&quot;&gt;wood pellet business&lt;/a&gt; I don\’t really know on what grounds is the author basing his conclusions!</description>
		<content:encoded><![CDATA[<p>I am sorry but JSON is no way near competing with XML. XML is far superior to JSON!! <a href="http://www.pelletmillguide.com/germany_is_the_most_promising_pellets_market_in_europe.html" rel="nofollow">wood pellet business</a> I don\’t really know on what grounds is the author basing his conclusions!</p>
]]></content:encoded>
	</item>
</channel>
</rss>