Skip to content

Instantly share code, notes, and snippets.

@fionn
Created August 22, 2017 15:17
Show Gist options
  • Save fionn/49cdd1bd3e051a66b601b65a6bbfc3ea to your computer and use it in GitHub Desktop.
Save fionn/49cdd1bd3e051a66b601b65a6bbfc3ea to your computer and use it in GitHub Desktop.
Repeat a Python program until it fails
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Requires 1 argument; $# given"
exit 1
fi
while true; do
python $1
if [[ $? -ne 0 ]]; then
exit $?
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment