job_status=`curl https://jenkins/view/job/other-job/lastBuild/api/json | grep "\"result\":\"SUCCESS\""`
if [ -n "$job_status" ]
then
# Run your script commands here
else
echo "BUILD FAILURE: Other build is unsuccessful or status could not be obtained."
exit 1
fi