Ever ran into weird errors when trying to run a shell script which you believed was 100% correct but the shell won't accept it? I did! Well, it turned out that the bash shell (may be others as well) expects a script file to be saved with UNIX end of line format *not* Windows end of line format.
I am using CentOS 5 with KDE. I use the Kate editor for scripting and programming. Until I started getting insane errors whenever I would try to execute any of my recently developed shell scripts, Kate was configured to save files with Windows end of line format. Now that I changed the end of line format back to UNIX, bash is happy as ever!