Quote:
Originally Posted by pan64
the tab has no pid.
|
Its looks for me, every terminal tab have a pid.
Open a terminal and output the pid of current running terminal tabs
pgrep bash
You get a output like
After than open a additional terminal tab on already opened terminal, p.e by menu item of terminal
Run the follow on 2nd terminal tab and you get the pid of 1st and 2nd terminal tab
pgrep bash
You get a output like
Now its possible to check the pid of 2nd terminal tab is true or wrong
Kill the process of 2nd terminal tab, pe. by a gui driven process manager, perhaps its possible by kill on terminal to.
So you can see, the the 2nd terminal tab are closing on this way and other terminal tabs dont close on this way. Thats sounds for me, the 2`nd terminal tab have a own pid, which are on this sample is the pid 23456.
So I can do it on follow way:
* Create a list of bash pids after open the terminal (before open the 2nd terminal tab
Code:
arr1=$(pgrep bash)
echo $arr1
* Create a list of bash pids after open the 2nd terminal tab
Code:
arr2=$(pgrep bash)
echo $arr2
* doing a diff of arr1 and arr2, reports me usual the wanted pid
Thats should work mostly, a have little bit the the risk to get more than one pids as a diff, if other bash terminal are starting at the same small time frame, depend on what ever are running on same system. Thats should be not a big risk. A the risk are bigger than 0. Perhaps, they are a way, without this risk.