how to get the return code of a command

how to get the return code of a command??

you can get the retun code of a command using $? operator.Make sure to save the returncode in a variable just after the command completed.otherwise this will hold the code of the next command executed after your desired.
have a look

ncftpput -u user-name -p P@sswORD 192.168.168.9 / $filename
RET=$?
echo $RET