How to run shell script on Teamcity Windows agent?
This is quite easy to resolve. The error does not come from Cygwin of course, but from CMD. The export
command only makes sense within a Bash script; cmd has no way of knowing what to do with it.
What you need to do is simply specify to CMD that the script should run using Cygwin's command interpreter (bash
). So you can either just specify the long path to the bash
executable and your script, as in
C:\dev\tools\cygwin\bin\bash D:\myscript.sh
or you can just add the path to the cygwin directory to your machine's PATH variable. You can do this by changing the System Settings and append the path there, or you can do it as part of your script above:
# this is not necessary if you have already changed the System Variable to include the pathset PATH=C:\dev\tools\cygwin\bin;%PATH%bash D:\myscript.sh