I wrote this one liner in bash:
while read line; printf $line' '; do : ; done < someFile
and it seemed to go over the lines of the files fine, but then it went into an infinite loop typing spaces. I realized my mistake was putting the printf before the do instead of after, but I still don't understand what's going on in here. Why do I get an infinite loop?
printf $line' 'which will most likely fail if the value oflinestarts with a dash (this is BTW a way to unintentionally break your infinite loop). Doprintf '%s ' "$line"instead.