Created
July 24, 2018 23:42
-
-
Save kylebarron/d5253d3a1f69d67e983b546ba88f1f4b to your computer and use it in GitHub Desktop.
Check Stata log for errors and issue a non-zero return code if an error occurred.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Check Stata log for errors and issue a non-zero return code if an error | |
# occurred. | |
# | |
# The idea for this came from | |
# https://gist.github.com/pschumm/b967dfc7f723507ac4be | |
# Accepts either: | |
# a single argument, the log file | |
# the log file piped to stdin | |
if egrep --before-context=1 --max-count=1 "^r\([0-9]+\);$" "${1:-/dev/stdin}" | |
then | |
exit 1 | |
else | |
exit 0 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment