Create Bash shell scripts corresponding to windows bat files

Experts,

I am newbie in shell scripting. I want to write Bash shell scripts corresponding to windows bat files. I have installed cygwin at c:\cygwin and i am trying to crate the sh file using vi editor. i am not able to understand how to use linux/unix convention for the code. following is my code.

@ECHO OFF
 
IF NOT DEFINED MY_HOME goto home_not_set
 
IF DEFINED JAVA_HOME GOTO java_defined
ECHO Setting Java Home
set JAVA_HOME="%MY_HOME%\java\jre6_14"
SET PATH=%JAVA_HOME%\bin;%PATH%
 
:java_defined
set ACTIVEMQ_HOME=%MY_HOME%\message
GOTO end
 
:home_not_set
ECHO Set environment variable MY_HOME before running this script
GOTO end
 
:end
ENDLOCAL

where can i find a document or sample code to use in cygwin? i tried with #!/bin/bash. it started to print error at the end of file. do i need to set any path before writing scripts? please suggest or advise.

Thank you.

Isn't it the same as this post: