I am an absolute newbie to the *ix ,so if my question is dumb please bear with me.I am writing a script where I am trying to export some variable , and after exporting my variable when I am printing, it is printing an extra line after it.Here I am reading from a csv file containing two columns.This script is present in file script.sh and I am executing that file ./script.sh#!/bin/bashwhile IFS=, read f1 f2do      echo Source IP        : $f1     #it is printing without extra line      echo Destination IP   : $f2               #it is printing without extra line      export sourceIP=$f1    export destIP=$f2    ssh -t -t sjain@$f1 <<ENDSSH    #Start copying 33KB File    echo Destination IP Address: $destIP # here it is printing an extra line after destIP    startTime=$(($(date '+%s%N')/1000000))    scp KB_33.txt sjain@$destIP:/home/sjain    endTime=$(($(date '+%s%N')/1000000))    printf 'Elapsed time in copying 33KB file: %s\n' $((endTime-startTime))     #Write the stats to the file    echo $sourceIP','$destIP',33KB,'$((endTime-startTime)) >> report.txt    exit    ENDSSHdone < ipaddress.csvbecause of the above problem when I am executing scp KB_33.txt sjain@$destIP:/home/sjainit is breaking the command into 2 parts , like thisscp KB_33.txt sjain@$X.X.X.X:/home/sjainAnd when I am directly hardcoding the value instead of destIP  , it is working fine.How can I fix this?Input CSV file Data10.0.0.1,10.0.0.2
Remove extra line break from a variable
linux;command
When you split the contents of your CSV file you're splitting on commas, ,. This can be problematic because the second IP address in that file likely has a trailing newline character after it.The easiest method to resolve this would be to simply chomp that character off the end of the $destIP variable like so:export sourceIP=$f1export destIP=$(echo $f2 | tr -d '\n')