title: Bash echo of array element not showing up
body: <p>I am reading a file that basically contains a list of binary data (fixed at 8 bits wide per line):</p>
  <pre><code>01011100
  11110001
  ...
  </code></pre>
  <p>For each line that is read, I need to &quot;remap&quot; the bits in chunks of 4 bits to specific positions. So for example in the 1st line above, bits <code>1100</code> and <code>0101</code> will each be remapped that will follow this formula: bit 0 goes to bit 3 position, bit 1 to 2, bit 3 to 1, and lastly bit 2 to 0.</p>
  <p>To do this, I coded as follows:</p>
  <pre><code>function remap {
      echo &quot;Remapper&quot;;
      IFS=
      read -ra din &lt;&lt;&lt; $1;
      echo ${#din};
      echo ${din[1]};
      ## above line is just displaying blank as seen in below result
      echo ${din[*]};
      ## do actual remapping here
  };
  
  for line in `cat $infile`;
  do 
      data0=${line:0:4};
      data1=${line:4:4};
      echo &quot;Read line&quot;;
      echo $data0;
      echo $data1;
      remap $data0;
      remap $data1;
  done
  </code></pre>
  <p>I don't know why I'm not seeing the echoed array element. This is the output from the 1st read line:</p>
  <pre><code>Read line
  0101
  1100
  Remapper
  4
  
  0101
  Remapper
  4
  
  1100
  </code></pre>
  <p>I haven't gotten to coding the actual remapping itself because I couldn't even verify that I'm able to properly split the <code>$1</code> variable of <code>remap()</code> function into the <code>din</code> array.</p>
  <p>Thank you in advance for the help!</p>