The problem is likely that your apply_amps.sh is in a none-UNIX format. It appears to have the sign ^M added to the end of lines, which might be due to it having been opened in a text editor in Windows for some reason. I recently installed 3.2 in CentOS 5.3 and have not had this problem, so it doesn't appear to be a general error.
There is a utility to fix this, dos2unix (which I believe is installed by default in CentOS 5.3), but you could also do it in vi for instance, manually removing all ^M and other signs that shouldn't be there.