pdflatex paper
if [ $? -ne 0 ]; then
    exit;
fi
bibtex paper
if [ $? -ne 0 ]; then
    exit;
fi
pdflatex paper
if [ $? -ne 0 ]; then
    exit;
fi
bibtex paper
if [ $? -ne 0 ]; then
    exit;
fi
pdflatex paper
if [ $? -ne 0 ]; then
    exit;
fi
bibtex paper
if [ $? -ne 0 ]; then
    exit;
fi
