Instead:
IFS=$'\n' for i in `cat "$1"`; do echo "$i" >> xtempfile.tmp; done
You can do something like:
while IFS=$'\n' read -r line; do echo "$line" done < "$1" >> xtempfile.tmp
This would set the IFS variable during the while loop .
* Add-on based on samveen comments. Anytime a change in IFS occurs in a subshell, the changes are automatically returned. However, this is not the case when you made changes to the interactive shell. The above sentence is the required processing so that we do not accidentally change the IFS for the entire shell. *
source share