<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Tech-Recipes - Latest Comments in bash array operations | Bourne shell scripting | Tech-Recipes</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><language>en</language><lastBuildDate>Fri, 29 Aug 2008 02:26:47 -0000</lastBuildDate><item><title>Re: bash array operations | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/910/bash-array-operations/#comment-2769517</link><description>&lt;code&gt;#remove i from array&lt;br&gt;unset array&amp;#91;$i&amp;#93;&lt;br&gt;array=&amp;#40; $&amp;#123;array&amp;#91;@&amp;#93;&amp;#125; &amp;#41;&lt;/code&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Fri, 29 Aug 2008 02:26:47 -0000</pubDate></item><item><title>Re: bash array operations | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/910/bash-array-operations/#comment-2769516</link><description>so looking at the tip found here:&lt;br&gt;&lt;a href="http://www.tech-recipes.com/bourne_shell_scripting_tips910.html" rel="nofollow"&gt;http://www.tech-recipes.com/bourne_shell_script...&lt;/a&gt;&lt;br&gt;&lt;br&gt;:oops: works as long as you do not try and remove element 0. Look at just this part:&lt;br&gt;&lt;code&gt;$&amp;#123;array&amp;#91;@&amp;#93;&amp;#58;0&amp;#58;$i&amp;#125;&lt;/code&gt;&lt;br&gt; and you will notice the array is rebuilt using items 0 through $i. The 0 will cause element 0 to stay in the array even if &lt;code&gt; i=0&lt;/code&gt;&lt;br&gt; Does anyone have a better fix than this:&lt;br&gt;&lt;code&gt;#remove i from array&lt;br&gt;if &amp;#91; $i -ne 0 &amp;#93;; then&lt;br&gt;	array=&amp;#40; $&amp;#123;array&amp;#91;@&amp;#93;&amp;#58;0&amp;#58;$i&amp;#125; $&amp;#123;array&amp;#91;@&amp;#93;&amp;#58;$&amp;#40;&amp;#40;$i + 1&amp;#41;&amp;#41;&amp;#125; &amp;#41;&lt;br&gt;else&lt;br&gt;	array=&amp;#40; $&amp;#123;array&amp;#91;@&amp;#93;&amp;#58;$&amp;#40;&amp;#40;$i + 1&amp;#41;&amp;#41;&amp;#125; &amp;#41;&lt;br&gt;fi&lt;br&gt;&lt;/code&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sun, 25 Mar 2007 11:41:06 -0000</pubDate></item></channel></rss>