Exit status in a post command build

How can I get the return code in a post command build?
I have the following post commands in a build definition:
echo "Hello"
echo $?
But $? returns: ? and it should returns 0 because echo "Hello" finished OK. How can I get that status code or what other way exists for getting the status code from echo "Hello"?