tr -d "\r\n" to
tr -d "\n"
, but try both
for f in ~/Desktop/*
new="$(printf %s "$f" | tr -d "\n")"
if [ "$f" != "$new" ]; then
mv "$f" "$new"
Good for you! So long as the thread remains 'unsolved' I see no reason not to offer answers. I for one have found this discussion useful. I wasn't aware of the 'tr' command until reading this thread, and found out some useful tricks you can do with it from exploring the tr man page.
If you hadn't brought this thread back to life, I'd have missed out on that, so here's a 'thanks' from me, too!