shell script check function return value