I have a script which starts 3 terminal emulator windows:
#!/bin/sh
terminator --role='terminator-left' 2>/dev/null &
sleep 0.1
terminator --role='terminator-center' 2>/dev/null &
sleep 0.1
terminator --role='terminator-right' 2>/dev/null &
(I am using the --role option, so that I can automatically place the windows on different monitors, defined in my openbox configuration file)
I start this script multiple times, on different virtual desktops.
How can I start these 3 terminals in some kind of a "process group", so that I can then kill all of the remaining processes, in case any one of the processes terminates?
Important: I don't want to kill all terminals that might have been launched in a different instance of my script (I cannot just use pkill or pgrep to kill any process matching a pattern)
So, in other words, lets say I launch my script on virtual desktop 1 and virtual desktop 2.
I have now 3 terminal windows on 2 different virtual desktops.
When I exit one terminal on virtual desktop 1, I would like the remaining 2 windows to automatically terminate, but without affecting the independent instance of 3 other windows running on my virtual desktop 2.
Is what I describe possible ?
How can I achieve this ?
bashshell?zsh