Running Java scripts in Cygwin bash scripts becomes a little tricky because you want to treat most paths in Cygwin as normal UNIX paths but Java expects DOS paths. Therefore to get around this you can use the mixed option for cygpath.
For example:
if [ -e /usr/bin/cygpath ] || [ -e /bin/cygpath ] then export FOO=`cygpath --mixed "e:\work\betweengo/target/foo"` else export FOO="e:\work\betweengo/target/foo" fi
The result on Cygwin is that FOO will be set to “e:/work/betweengo/target/foo” which will work both in DOS and UNIX.