<?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: Bash Arrays</title>
	<atom:link href="http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/</link>
	<description>Made with only the finest 1's and 0's</description>
	<lastBuildDate>Thu, 26 Jan 2012 21:20:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: exceed</title>
		<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/comment-page-1/#comment-45332</link>
		<dc:creator>exceed</dc:creator>
		<pubDate>Fri, 03 Sep 2010 11:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.protocolostomy.com/?p=464#comment-45332</guid>
		<description>I know this is a little late, but..

@Steve, to add an element you can just use &quot;$myarr = (${myarr[@]} newelement) ..there is a space between myarr and newelement.</description>
		<content:encoded><![CDATA[<p>I know this is a little late, but..</p>
<p>@Steve, to add an element you can just use &#8220;$myarr = (${myarr[@]} newelement) ..there is a space between myarr and newelement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Hollenback</title>
		<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/comment-page-1/#comment-7842</link>
		<dc:creator>Phil Hollenback</dc:creator>
		<pubDate>Wed, 21 Jan 2009 07:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.protocolostomy.com/?p=464#comment-7842</guid>
		<description>If you want to get even crazier then try using bash arrays to emulate perl &lt;code&gt;split&lt;/code&gt;:

http://advogato.org/person/philiph/diary/0.html

another argument against using bash as a &#039;real&#039; programming language I guess.</description>
		<content:encoded><![CDATA[<p>If you want to get even crazier then try using bash arrays to emulate perl <code>split</code>:</p>
<p><a href="http://advogato.org/person/philiph/diary/0.html" rel="nofollow">http://advogato.org/person/philiph/diary/0.html</a></p>
<p>another argument against using bash as a &#8216;real&#8217; programming language I guess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m0j0</title>
		<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/comment-page-1/#comment-7642</link>
		<dc:creator>m0j0</dc:creator>
		<pubDate>Fri, 16 Jan 2009 14:50:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.protocolostomy.com/?p=464#comment-7642</guid>
		<description>@Steve, 

The rule I learned, just a little over a decade ago now, is &quot;always double quote your variables, period.&quot; I have to say that the rule has served me pretty well in general, and I have been bitten in at least a few cases over the years when I&#039;ve forgotten the rule. I also remember running into a snag when I interpreted the rule to mean &quot;double quote anything that will later be replaced by something else&quot;: double quoting a command substitution can be harmful in certain circumstances. The rule is specific to variables. 

Thanks for making the link in my brain between $* and myarr[*]. I hadn&#039;t made that link for whatever reason. Bash is somewhat unique in that your use of it as a utility unto itself is kind of a prerequisite to using it as a scripting language. My understanding is also that it was never intended to be used for programming, so some of the inconsistencies I see in the shell are, I&#039;m sure, a result of the incremental growth of the shell over the years to support constructs that support more advanced use as a scripting language. I&#039;ll post more of these things in the future and maybe you can help me make sense of them. :-D</description>
		<content:encoded><![CDATA[<p>@Steve, </p>
<p>The rule I learned, just a little over a decade ago now, is &#8220;always double quote your variables, period.&#8221; I have to say that the rule has served me pretty well in general, and I have been bitten in at least a few cases over the years when I&#8217;ve forgotten the rule. I also remember running into a snag when I interpreted the rule to mean &#8220;double quote anything that will later be replaced by something else&#8221;: double quoting a command substitution can be harmful in certain circumstances. The rule is specific to variables. </p>
<p>Thanks for making the link in my brain between $* and myarr[*]. I hadn&#8217;t made that link for whatever reason. Bash is somewhat unique in that your use of it as a utility unto itself is kind of a prerequisite to using it as a scripting language. My understanding is also that it was never intended to be used for programming, so some of the inconsistencies I see in the shell are, I&#8217;m sure, a result of the incremental growth of the shell over the years to support constructs that support more advanced use as a scripting language. I&#8217;ll post more of these things in the future and maybe you can help me make sense of them. <img src='http://www.protocolostomy.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Holden</title>
		<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/comment-page-1/#comment-7638</link>
		<dc:creator>Steve Holden</dc:creator>
		<pubDate>Fri, 16 Jan 2009 12:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.protocolostomy.com/?p=464#comment-7638</guid>
		<description>I believe you&#039;ll find that the myarr[*] vs. myarr[@] notation is merely reflecting the same difference that exists between $* and $@. Traditionally (?) in shell scripting the correct way to pass all your arguments, quoted, to another scripts has been 

  otherscript &quot;$@&quot;

Or so I seem to remember from about twenty years ago. So it might seem like a wtf, but it&#039;s not unreasonable to differentiate between the two cases.</description>
		<content:encoded><![CDATA[<p>I believe you&#8217;ll find that the myarr[*] vs. myarr[@] notation is merely reflecting the same difference that exists between $* and $@. Traditionally (?) in shell scripting the correct way to pass all your arguments, quoted, to another scripts has been </p>
<p>  otherscript &#8220;$@&#8221;</p>
<p>Or so I seem to remember from about twenty years ago. So it might seem like a wtf, but it&#8217;s not unreasonable to differentiate between the two cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius Gedminas</title>
		<link>http://www.protocolostomy.com/2009/01/15/shell-scripting-bash-arrays/comment-page-1/#comment-7637</link>
		<dc:creator>Marius Gedminas</dc:creator>
		<pubDate>Fri, 16 Jan 2009 12:10:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.protocolostomy.com/?p=464#comment-7637</guid>
		<description>The thing that was hardest for me was figuring out the syntax for appending an element to the end of an array:

  myarr[${#myarr[*]}]=&quot;$newitem&quot;</description>
		<content:encoded><![CDATA[<p>The thing that was hardest for me was figuring out the syntax for appending an element to the end of an array:</p>
<p>  myarr[${#myarr[*]}]=&#8221;$newitem&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

