<?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: bash shell script iterate through array values</title>
	<atom:link href="http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:22:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sitami</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-52753</link>
		<dc:creator>sitami</dc:creator>
		<pubDate>Thu, 22 Dec 2011 02:08:36 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-52753</guid>
		<description>what must I do whene I only want to use the frist element of the array?</description>
		<content:encoded><![CDATA[<p>what must I do whene I only want to use the frist element of the array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reginald Pierce</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-33837</link>
		<dc:creator>Reginald Pierce</dc:creator>
		<pubDate>Thu, 28 Jul 2011 02:30:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-33837</guid>
		<description>I have found Notepad++ to be a great tool for Windows since it allows you to convert the line endings to Windows, Mac, or Linux while editing the file.  It also has good code highlighting.</description>
		<content:encoded><![CDATA[<p>I have found Notepad++ to be a great tool for Windows since it allows you to convert the line endings to Windows, Mac, or Linux while editing the file.  It also has good code highlighting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-46512</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Sat, 19 Feb 2011 00:17:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-46512</guid>
		<description>Iterate through a sparse array by using:

ARR=([0]=&quot;zero&quot; [1]=&quot;one&quot; [10]=&quot;ten&quot;)
for INDEX in ${!ARR[@]}
do
   echo index $INDEX &quot;=&gt;&quot; ${ARR[$INDEX]}
done</description>
		<content:encoded><![CDATA[<p>Iterate through a sparse array by using:</p>
<p>ARR=([0]=&#8221;zero&#8221; [1]=&#8221;one&#8221; [10]=&#8221;ten&#8221;)<br />
for INDEX in ${!ARR[@]}<br />
do<br />
   echo index $INDEX &#8220;=&gt;&#8221; ${ARR[$INDEX]}<br />
done</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: minoc</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-46476</link>
		<dc:creator>minoc</dc:creator>
		<pubDate>Thu, 17 Feb 2011 21:08:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-46476</guid>
		<description>Oops., The easiest way to iterate is like you said initially., except you forgot the quotes:

for name in &quot;${names[@]}&quot;; do 

works., and preserves the internal spaces in the elements...</description>
		<content:encoded><![CDATA[<p>Oops., The easiest way to iterate is like you said initially., except you forgot the quotes:</p>
<p>for name in &#8220;${names[@]}&#8221;; do </p>
<p>works., and preserves the internal spaces in the elements&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: minoc</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-46475</link>
		<dc:creator>minoc</dc:creator>
		<pubDate>Thu, 17 Feb 2011 21:02:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-46475</guid>
		<description>as long as names are not separated by IFS (defaulting to white space).. for example 

names=( &quot;foo bar&quot; &quot;ben smith&quot; )
for name in ${names[@]}; do echo &quot;[${name}]&quot;; done
[foo]
[bar]
[ben]
[smith]

whereas this preserves the spacing in array elements:

for ((i=0; i</description>
		<content:encoded><![CDATA[<p>as long as names are not separated by IFS (defaulting to white space).. for example </p>
<p>names=( &#8220;foo bar&#8221; &#8220;ben smith&#8221; )<br />
for name in ${names[@]}; do echo &#8220;[${name}]&#8220;; done<br />
[foo]<br />
[bar]<br />
[ben]<br />
[smith]</p>
<p>whereas this preserves the spacing in array elements:</p>
<p>for ((i=0; i</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sriram</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-46208</link>
		<dc:creator>sriram</dc:creator>
		<pubDate>Tue, 08 Feb 2011 13:36:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-46208</guid>
		<description>it works perfectly

Thanks a lot</description>
		<content:encoded><![CDATA[<p>it works perfectly</p>
<p>Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: annie</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-43761</link>
		<dc:creator>annie</dc:creator>
		<pubDate>Sat, 06 Nov 2010 19:25:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-43761</guid>
		<description>great!...
i really need this 
 thanks</description>
		<content:encoded><![CDATA[<p>great!&#8230;<br />
i really need this<br />
 thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thanish</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-39309</link>
		<dc:creator>Thanish</dc:creator>
		<pubDate>Tue, 25 May 2010 17:43:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-39309</guid>
		<description>Thanks for the for function m8, you just saved me some hours.
Now I can get back to my Script. You guys can also place the &#039;do&#039; on the first line
IMHO it looks better this way.

for name in ${names[@]}; do</description>
		<content:encoded><![CDATA[<p>Thanks for the for function m8, you just saved me some hours.<br />
Now I can get back to my Script. You guys can also place the &#8216;do&#8217; on the first line<br />
IMHO it looks better this way.</p>
<p>for name in ${names[@]}; do</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TuxSax</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-39006</link>
		<dc:creator>TuxSax</dc:creator>
		<pubDate>Sun, 09 May 2010 06:36:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-39006</guid>
		<description>Right, I&#039;ve forgot to mention that option too
If you are working on Ubuntu, like me, then the package &quot;tofrodos&quot; contains the dos2unix utility.
</description>
		<content:encoded><![CDATA[<p>Right, I&#8217;ve forgot to mention that option too<br />
If you are working on Ubuntu, like me, then the package &#8220;tofrodos&#8221; contains the dos2unix utility.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/comment-page-1/#comment-36724</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 11 Jan 2010 07:01:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-36724</guid>
		<description>Thanks a lot..</description>
		<content:encoded><![CDATA[<p>Thanks a lot..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 15/15 queries in 0.005 seconds using memcached
Object Caching 419/419 objects using memcached

Served from: www.tech-recipes.com @ 2012-02-10 09:20:56 -->
