title: get each line of a command in an array bash raspbian
body: <p>I'm trying to improve my scripting skills.
  I know there's online converters that are doing it but i'd like to make a script that compare in a certain folder (<code>/opt/Citrix/ICAClient/keystore/cacerts/</code>), if the .crt are already in the .pem format and if not convert them.</p>
  <p>So i know this clearly isn't the best way to do so... But i've started like this:</p>
  <p>`</p>
  <pre><code>#!/bin/bash
  #remove both files if they already exists
  rm crt.txt
  rm pem.txt 
  #certificate selection in .crt format
  Certificate_crt=$(sudo ls /opt/Citrix/ICAClient/keystore/cacerts/ | grep .crt | sed 's/\(.*\)\..*/\1/')
  
  #certificate selection in .pem format
  Certificate_pem=$(sudo ls /opt/Citrix/ICAClient/keystore/cacerts/ | grep .pem | sed 's/\(.*\)\..*/\1/') 
  
  #sending results in text files
  echo &quot;$Certificate_crt&quot; &gt;&gt; crt.txt
  echo &quot;$Certificate_pem&quot; &gt;&gt; pem.txt
  
  #recovery of certificate names in .crt not having a .pem equivalent
  Certificate_crt_WO_pem=$(cat crt.txt | grep -v &quot;$Certificate_pem&quot; | tr &quot; &quot; &quot;\n&quot;)
  #echo &quot;$Certificate_crt_WO_pem&quot;
  
  
  #initialisation 
  
  i=0
  
  #Print the split string
  
  for i in &quot;${Certificate_crt_WO_pem[@]}&quot;
  do
      name_certificate=$(echo $i | tr &quot; &quot; &quot;\n&quot;)  
      echo &quot;${name_certificate[@]}&quot;  
      echo &quot;$i&quot;
      i=i+1   
  done
  </code></pre>
  <p>`</p>
  <p>The thing is that when my &quot;for&quot; is launched, it stores all the result of &quot;Certificate_crt_WO_pem&quot; in the array $name_certificate[0] and then stop it self.</p>
  <p>What i want is to store, line by line, the result of &quot;<code>cat crt.txt | grep -v &quot;$Certificate_pem&quot; | tr &quot; &quot; &quot;\n&quot;</code>&quot; into the array name_certificate.</p>
  <p>This array will be use to launch something like this &quot; <code>openssl -in $name_certificate[$i].crt -out $name_certificate[$i].pem PEM</code>&quot; (in a for loop in the will to convert every namefile.crt in every namefile.pem).</p>
  <p>If someone can help me i'll be more than gratefull... (And yes i've already tried to search on the net, had followed some online courses but none of them was saying the same thing about the bash's arrays, so i'm a bit lost...)</p>