I tried the piece of code you have posted, but it gives me error:
./new_script.sh: ret: not found
Status String is 1
./new_script.sh: test: argument expected
Then I declared ret as $ret=$?, then I got another error:
./new_script.sh: =0: not found
Status String is 1
./new_script.sh: test: argument expected