#pdflatex introduction.tex pdflatex introduction.tex pgrep -f "xpdf -remote 127.0.0.1 introduction.pdf" 2>&1 > /dev/null if [ $? == 0 ]; then xpdf -remote 127.0.0.1 -reload -raise else xpdf -remote 127.0.0.1 introduction.pdf & fi