Yes that was the problem, cygwin is no longer in my system, but it was a ".profile" file in my home dir.
Thank you
Maybe you have already set the HOME environment variable before starting MSYS, and maybe that directory contains a ".profile" or a similar file? That would not be a problem in itself, but you would need to make sure the script doesn't try to use any commands (like whoami) that don't exist in MSYS. If the existing script is for Cygwin you could use the output of "uname" in the script to check whether MSYS or Cygwin is running. And again, you need to make sure Cygwin is not in your PATH while running MSYS.
 
Luke Dunstan