title: Rewriting a for-loop to use it with "parallel"
body: <p>I am trying to rewrite a for-loop (that works great) and run it as parallel but i having all sorts of problems. Here is my for loop</p>
  
  <pre><code>function no_sam {
      filename=$(basename "$file")
      extension="${file##*.}"
  
      if [ $extension = "sam" ];
        then
          filename="${filename%.*}"
          feat_out=$filename.out
          htseq-count -f $types -r "$pos" -m "$mode" -i "$attribute" -s "$strand" -t "$feature" -a "$qual" "$file" "$input_gff" &gt; "$feat_out"
          grep -v "_" "$feat_out" &gt; temp &amp;&amp; mv temp "$feat_out"
          mv "$feat_out" "$counts_folder"
      elif [ $extension = "bam" ];
        then
          filename="${filename%.*}"
          feat_out=$filename.out
          htseq-count -f $types -r "$pos" -m "$mode" -i "$attribute" -s "$strand" -t "$feature" -a "$qual" "$file" "$input_gff" &gt; "$feat_out"
          grep -v "_" "$feat_out" &gt; temp &amp;&amp; mv temp "$feat_out"
          mv "$feat_out" "$counts_folder"
      fi    
  }
  
  for file in "${multi[@]}"; do 
    no_sam
  done
  </code></pre>
  
  <p>And when i replaced the for loop with GNU parallel, i am getting error</p>
  
  <pre><code>"${multi[@]}" no_sam | parallel 
  
  testfile.sam: command not found
  </code></pre>