Q:

Exit status of sh command?

Hi I am calling a shell script from inside another shell script and if that script call goes successful I have to proceed further and I am using sh command to call another script like :
sh payloadjob.sh
if [[ $? -eq 0 ]]; then
    echo Success message 
else
    echo Failure message
fi

But  I am noticing that even script call go successful it gives 
Exit status as 1 however it should return 0 for success why it is happening and how do I come to know that script call via sh command is successful or not ?

A:

If the payload.sh script is not exiting with an explicit exit 0 or exit 1, then the exit status of it will be that of the last command in the script.
If this last command does, for example, rm something 2>/dev/null, then the exit status will be non-zero if something can not be found or removed.
In the script that you have shown, you are correctly testing the $? variable.  You may also simplify the test to the equivalent
if sh payload.sh; then
    echo "Success"
else
    echo "Failure"
fi

