moved the result variable right after the hadoop command. This ensures that correct exit code is captured.