#!/usr/bin/env bash while true; do termpdf.py resume.pdf if [ $? -ne 0 ]; then echo "The command failed, restarting..." else echo "crashed, trying again" fi sleep 1 # Optional: sleep for 1 second before rerunning the command done