That last answer (by user4533473) helped me. I copied the file into Notepad++ and told it to show all characters (looking for Windows CR LF). That wasn't it, but in my case, the "setenv" was preceded by ENSP characters (en space) rather than a tab. So the output wasn't "setenv: Command not found.", it was actually "ENSPENSPENSPENSPsetenv: Command not found." Of course the csh shell didn't know what "ENSPENSPENSPENSPsetenv" meant.