reading from csv file in shell scripting
<p>I am running a script run.sh. 
The script is executed as follows. $./run.sh read.csv
The contents of the script are as follows.</p>

<pre><code>   tail -n +2 $1 | while IFS="," read -r A B C D E F;
    do
        python test.py ${A} ${B} ${C} ${D} ${E} ${F}
    done
</code></pre>

<p>My question is "If i need to pass in additional command line arguments along with read.csv from the terminal like this (for Ex: <code>$./run.sh name sex DOB read.csv</code>) how do i modify the code so that it works fine. </p>

<p>Because if i pass any other command line arguments along with the file name(read.csv) i am getting access errors to the file read.csv</p>

<p>Positional parameters is what you are after. This is how you can do it:</p>

<pre><code>tail -n +2 $4 | while IFS="," read -r A B C D E F;##note now you would pass $4 to tail command which is your file name
do
    python test.py ${A} ${B} ${C} ${D} ${E} ${F}
done
</code></pre>

<p>You could access those values like name in $1, sex in <code>$2</code>, DOB with $3 and read.csv in $4</p>

python bash shell csv