On Thu, Jul 24, 2014 at 1:35 PM, jitendra gupta <jitu.ic...@gmail.com> wrote: > Hi All > > My shell script is not throwing any error when I am having some error in > Python code. > > In this case, I dont want to run my second.py > Even I am throwing error from my test.py, but still second.py is getting > executed, which i dont want,
You must expilicitly ask your shell to do exit if something fails. Like this: ~~~~~ shellTest.sh ~~~~~~~ #!/bin/bash set -e python test.py python second.py ~~~~~~~~~~~~~~~~~~~~~~~ I explicitly set the shell to /bin/bash on the shebang line, and then set the -e option to fail when a command exits with a non-zero status. You should always have a shebang line in your shell files, and execute them as ./shellTest.sh (after chmod +x shellTest.sh); moreover, one for Python files is recommended, like this: #!/usr/bin/env python -- Chris “Kwpolska” Warrick <http://chriswarrick.com/> PGP: 5EAAEA16 stop html mail | always bottom-post | only UTF-8 makes sense _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor