79194056

Date: 2024-11-15 21:56:43
Score: 0.5
Natty:
Report link

When the spawn terminal completes its task, it can trigger a USR1 signal to the root terminal. What you need to do is trap that signal from the root script and do the housekeeping work.

#!/usr/bin/env bash

sigusr1_received=false

function catch_sigusr1() {
    sigusr1_received=true
    echo "OK"
}

trap catch_sigusr1 USR1

gnome-terminal -- bash -c "bash -ic 'source temp.bash' ; kill -USR1 $$"&

while ! $sigusr1_received ; do
    sleep 1
    echo -n .
done
echo
echo "SIGUSR1 received"
# do something after receiving SIGUSR1
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When the
  • Low reputation (1):
Posted by: wmarini