Right now, I'm trying to fix an issue in my PrintBans.sh script.
The problem is, the program that generates this file saves it with \r\n line endings, so I need the while
loop to be able to read \r\n lines, otherwise there's an extra \r at the end of the last line which results in the arithmetic failing:
- 621355968000000000")syntax error: invalid arithmetic operator (error token is "
I've tried these.
while read ban
do
...
done < dos2unix $file
while read ban
do
...
done < `dos2unix $file`
cat $file > dos2unix > while read ban
do
...
done
while read ban
do
...
done < dos2unix < $file
I also see that some people set IFS='\r\n'
, but this did not work for me.
Is it impossible to pipe files through dos2unix without overwriting the original file?