script to find whether shell command is available

I am running shell scripts on windows using Cygwin tool.

In my shell scripts, i want to add an error check, that verify whether a certain command is available or not.

For example if SED comamnd is not available in Cygwin, then it should exit with error message.

How do i write such shell script?

depends on your sygwin install but you should have which command to help.
It may depends on your shell (which should be bash by default)

then in this case :
# which sed > /dev/null 2> /dev/null
(will return 0 if found 1 if not)
you have to test then var $? to check this result with if command (like if [ $? != 0 ] ; then ...)

Check man for details on syntax.

type is a bash builtin that behaves like which.
Did you not install unix tools with your cygwin? By the way sed is lowercase. Most unix commands are.