Script exiting on failed nosetests
Add set -e
after the shebang line to make the script exit if any of the command fails:
#!/bin/bash
set -e
git checkout $1
nosetests
From help set
:
-e Exit immediately if a command exits with a non-zero status.
You could try the following.
#!/bin/bash
git checkout $1
nosetests || exit 1
git checkout master
git merge $1
git push
git checkout $1
The ||
will check the return code of nosetests
and will execute the command exit 1
if it is non-zero.
Another variant could be.
#!/bin/bash
git checkout $1
if ! nosetests
then
exit 1
fi
git checkout master
git merge $1
git push
git checkout $1