E.g. does the bash debugger support attaching to existing processes and examining the current state?
Or can I easily find out by looking at the bash process entries in /
No real solution. But in most cases a script is waiting for a child process to terminate:
ps --ppid $(pidof yourscript)
You could also setup signal handlers in you shell skript do toggle the printing of commands:
#!/bin/bash
trap "set -x" SIGUSR1
trap "set +x" SIGUSR2
while true; do
sleep 1
done
Then use
kill -USR1 $(pidof yourscript)
kill -USR2 $(pidof yourscript)