|P is for Practical|
I've come across this problem or variants of it, literally hundreds of times.
Most recently, here at work we were trying to get a packaged java solution to work on a Linux box. The shell script containing the java command wouldn't work, giving us "library not found" errors, but the command pasted to the command line, worked just fine.
I'm ashamed to say that it took me a while to realise that the \r was to blame since I'd only encountered it before in a perl context. dos2unix solved the problem of course.
In a previous job we used to run a cron job that dos2unix'ed everything in certain directories and if changes were made, e-mailed the owner/programmer that his script had been fixed.
hbriem AT f-prot DOT com