Cygwin error when doing if…then…fi – Bash script-Collection of common programming errors

I just started bash shell programming. I have installed Cygwin on my Windows 7 computer. I started writing a script using this tutorial. My script requires an argument to be passed to it, if it doesn’t it should display an error message. This is the code directly from the tutorial and the same one in my code:

[ $# -eq 0 ] && { echo "usage: someArgument";  exit 1; }

When I do the following:

sh ./myscript.sh

it gives me this error:

-bash: /home/Me/myscript.sh: line 5: syntax error: unexpected end of file

“Unexpected end of file” means I have missed a fi or done, etc. somewhere.

I double-checked my code, but found nothing. Plus, when I comment out the line the script works perfectly fine.

I tried using a if...then...fi:

if [ $# -eq 0 ]
then
    echo "usage: someArgument"
    exit 1;
fi

but to no avail!

Please help, it’s been stumping me.