A ChatGPT based emulation of the therapist Doctor Kernel from the book "A digital Affair" by Neora Shem Shaul
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

run.sh 754B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. cd "$(dirname "$0")"
  3. . ./.env
  4. . venv/bin/activate
  5. trap 'echo "Caught Ctrl-C"' INT
  6. while [ 1 ] ; do
  7. LOGFILE=log-$(date +%Y%m%d-%H%M%S).txt
  8. python doctor.py|tee logs/$LOGFILE
  9. # We expect at least
  10. # * '<Enter>' in the header
  11. # * first '>' prompt
  12. # A third '>' means at least a single prompt from the user
  13. if [ $(grep -c '>' logs/$LOGFILE) -lt 3 ] ; then
  14. rm logs/$LOGFILE
  15. dialog --title "Session aborted" --msgbox "Hit <Enter> to continue..." 5 60
  16. else
  17. # clear aborted logs that somehow weren't caught
  18. grep -c ">" logs/*.txt | grep ':[12]$'| sed 's/:.*//' | xargs rm
  19. python genlogs.py
  20. dialog --title "Session saved" --msgbox "Session saved to file $LOGFILE" 5 60
  21. fi
  22. done