#!/bin/sh cd "$(dirname "$0")" . ./.env . venv/bin/activate while [ 1 ] ; do LOGFILE=log-$(date +%Y%m%d-%H%M%S).txt python doctor.py|tee logs/$LOGFILE # Only 3rd '>' counts. We should also skip '' in the header ;) if [ $(grep -c '>' logs/$LOGFILE) -lt 3 ] ; then rm logs/$LOGFILE dialog --title "Session aborted" --msgbox "Hit to continue..." 5 60 else python genlogs.py dialog --title "Session saved" --msgbox "Session saved to file $LOGFILE" 5 60 fi done