I had else instead of fi at the end of if statement.
else
fi
if [ -z $SOMEVAR ]; then echo "hello, some var is set" else # <--- here I should have had `fi` # if ... do some other stuff # other stuff # exit