<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Tech-Recipes - Latest Comments in bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><language>en</language><lastBuildDate>Tue, 28 Apr 2009 07:35:28 -0000</lastBuildDate><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-8770142</link><description>Well done man! Thanks for the tip!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bob.experience</dc:creator><pubDate>Tue, 28 Apr 2009 07:35:28 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-8110680</link><description>Good one</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Manav</dc:creator><pubDate>Mon, 13 Apr 2009 05:49:19 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-5647468</link><description>Reading a line, while preseriving whitespaces seems har dto do from a  file&lt;br&gt;&lt;br&gt;You can do it this way:&lt;br&gt;&amp;lt;pre&amp;gt;&lt;br&gt;cat $file | while read line; do&lt;br&gt;		echo "$line";&lt;br&gt;done&lt;br&gt;&amp;lt;/pre&amp;gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Erik J</dc:creator><pubDate>Thu, 29 Jan 2009 09:00:11 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-5460018</link><description>One way to merge two arrays:&lt;br&gt;&lt;br&gt;#existing array&lt;br&gt;existing=(item1, item2, item3);&lt;br&gt;&lt;br&gt;#items to merge (including an item requiring correct quoting)&lt;br&gt;merge=(item4 item5 "${item6}*");&lt;br&gt;&lt;br&gt;count=${#existing[@]};&lt;br&gt;num_new_items=${#merge[@]};&lt;br&gt;# this loop appends items to the end of the array&lt;br&gt;for (( i=0;i&amp;lt;$num_new_items;i++)); do&lt;br&gt;    echo ${i};&lt;br&gt;    existing[$count]=${merge[${i}]};&lt;br&gt;    let count+=1;&lt;br&gt;done&lt;br&gt;&lt;br&gt;count=${#existing[@]}&lt;br&gt;for (( i=0;i&amp;lt;$count;i++)); do&lt;br&gt;    echo ${existing[${i}]};&lt;br&gt;done</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">secoif</dc:creator><pubDate>Thu, 22 Jan 2009 07:19:51 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-4427525</link><description>Here is another method of adding elements in the array.. It works best with korn shell&lt;br&gt;&lt;br&gt;set -A array_example 1 2 3 4 5&lt;br&gt;i=0&lt;br&gt;echo ${array_example[$i]}</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Punit</dc:creator><pubDate>Tue, 16 Dec 2008 08:01:50 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-4246290</link><description>Wow!!! The trick for initializing an array from a file is superb!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Barun</dc:creator><pubDate>Mon, 08 Dec 2008 05:09:04 -0000</pubDate></item><item><title>Re: bash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comment-2768605</link><description>here is another method to add elements to an array&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;for foo in $&amp;#40;find -type f -iname &amp;quot;*.png&amp;quot; -printf &amp;quot;%fn&amp;quot;&amp;#41;; do&lt;br&gt;  file&amp;#91;$&amp;#123;#file&amp;#91;*&amp;#93;&amp;#125;&amp;#93;=$foo&lt;br&gt;done&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;will create an array of all png files</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">move all array</dc:creator><pubDate>Mon, 13 Jun 2005 11:05:13 -0000</pubDate></item></channel></rss>