title: Bash loop to read line by line and create folder by line index
body: <p>I am trying to do the following in a bash file:</p>
  
  <pre><code>mybash.sh myinputfile.txt myloopfile.csv
  </code></pre>
  
  <p>Create a <strong>for loop</strong>, that reads <strong>myloopfile.csv</strong> line by line, and then creates a folder which will take the line number as the folder name prefixed to "folder", ex. folder1, folder2...
  and then inside this <code>folder$i</code> create a folder called <strong>input</strong> and another called <strong>output</strong>.
  write the <code>line$i</code> content into a file called <strong>myline.txt</strong> and put this file inside the <code>folder$i/input</code>
  and copy the file <strong>myinputfile.txt</strong> that i will pass as a parameter to the bash file inside the <code>folder$i/input</code> as well.</p>
  
  <p>and then run my personal script that takes two arguments:</p>
  
  <pre><code>python myscript.py -i ./folder$i/input -o ./folder$i/output
  </code></pre>
  
  <p>and done!</p>
  
  <p><strong>myfile.csv</strong></p>
  
  <pre><code>101,1001,10012,100121
  102,101213,11122.1,12.15
  103,122.15,155.2,1515.54
  104,154.4,4551.1,454
  </code></pre>
  
  <p>what I currently have:</p>
  
  <pre><code>#!/bin/bash
  
  while IFS='' read -r line || [[ -n "$line" ]]; do
      mkdir ./folder$line
      echo "$line"  &gt;&gt; Folder$line/input/myline.txt;
      cp myinputfile.txt Folder$line/input
      python myscript.py -i ./folder$i/input -o ./folder$i/output
  
  done &lt; "$1"
  </code></pre>
  
  <p>the problem is that I can't get the line index to pass it as a suffix to the folder name, so I currently get the line content.and I don't know how to read the two files from the arguments that i pass to the <code>mybash.sh</code>.</p>