script’s return value is stored in the environment variable represented by $?:

echo $?