0

I have a simple bash script:

#!/bin/bash

file_in="simple.csv"

while IFS=$';' read -r -a arry
do

        echo "<name>Maintenance/'${arry[2]}'</name>"

done < $file_in

and a simple.csv file:

12;18;5

Output:

'</name>intenance/'5

Expected output:

<name>Maintenance/5'</name>

Why is bash trimming/changing the order of letters in my output? I have tried escaping some special characters and the output gets a little better, but not what I want.

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
  • Your input file uses DOS line endings. See https://stackoverflow.com/tags/bash/info, under "Before asking about problematic code". – chepner Nov 01 '21 at 13:07

0 Answers0