I want to do comma separated string from my array. In my script i collecting data to array outputArr
and then i want to echo
it to check it out, but no
To remove any trailing carriage returns from each array element, try
outputArray=( "${outputArray[@]%$'\r'}" )
However, it would probably be better to examine how outputArray
is set in the first place and prevent the carriage returns from being added in the first place. If you are reading from a file that uses DOS line endings, try "cleaning" it first using dos2unix
.