I am trying to read the contents of a csv and pass it to another function using shell scripting. I am new to shell scripting and cannot figure out how to do it.
ConvertedCSVpath="/home/test/Desktop/Outfile.csv"
converttoCSV()
{
for i in /home/test/repos/pgp-automation/TestSuite/Suite1495088054448/Outfile.xlsx;
do libreoffice --headless --convert-to csv "$i" ;
done
IFS=,
while read Tstcase OrderID MID
do
echo "Testcase: -> $Tstcase"
echo "OrderID: $OrderID"
echo "ID: $MID"
done < $ConvertedCSVpath
}
It has converted to CSV file
TestCase_002-,1495088066891,atoRef79606157945546 TestCase_002,218271828172187,C192819821981
PassVariable()
{
echo The order ID is $OrderID
}
converttoCSV
PassVariable
I need to take the OrderID and use it in PassVariable function one by one. i.e, first it should take 1495088066891 and pass it to PassVariable and then 218271828172187 and again pass it to PassVariable and print. How can I do this?