How to know return value of the script

I have a script and when it is running it is showing PASSED or FAILED.But I would like to pass the results into return code.So pls provide suggession how to add return code into this script

AgcfIp=`GetSoftatcValue AgcfIp_1`
AgcfShell=`GetSoftatcValue AgcfShell_1`
AgcfPath=`GetSoftatcValue AgcfPath_1`
AgcfUser=`GetSoftatcValue AgcfUser_1`

E=`${AgcfShell} -l ${AgcfUser} ${AgcfIp} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; /usr/bin/hostname"`
D=`${AgcfShell} -l ${AgcfUser} ${AgcfIp} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; /usr/bin/uname -a"`
if [ "$D" == "SunO111S $E 5.10 Generic_127112-10 i86pc i386 i86pc" ]
then
echo "PASSED";
else
echo "FAILED";
fi

Use "exit" code.

u can do it by two ways...

1)u can echo the value in the child script and catch it from calling script
eg.export temp=testing.ksh
2)another way is u can write in a temp file in chile script and read from it in the parent script and remove it