Hi nick65go
... I propose to add few instructions to "sudo kill" two of them, so it will remain only sleep and aterm -geometry. Is it OK? ...
I'm not sure what you want to kill, but I think you'll break it if you try.
Take a look at what's really happening and see if you still think you can kill something.
When you open a terminal, here is what you get:
tc@ASUS:~$ pstree -p 12953
aterm(12953)---sh(12954)
tc@ASUS:~$
A terminal and a shell.
Now I launch BatteryMonitorDisplay.sh from that terminal into the background:
tc@ASUS:~$ BatteryMonitorDisplay.sh BATC &
tc@ASUS:~$ pstree -p 12953
aterm(12953)---sh(12954)---BatteryMonitorD(12973)-+-aterm(12974)---sh(12981)---cat(12983)
`-sleep(13015)
tc@ASUS:~$
BatteryMonitorDisplay.sh launches a terminal in the background that runs cat on its tty.
BatteryMonitorDisplay.sh sends the value of $RemainingCapacity to the terminals tty.
BatteryMonitorDisplay.sh executes a 5 minute sleep command. The script will do nothing for 5 minutes.
As long as nothing is being sent to the terminals tty , it will block cat from executing. The cat command sleeps until data is available.
When sleep times out and exits, BatteryMonitorDisplay.sh is allowed to run.
BatteryMonitorDisplay.sh sends the value of $RemainingCapacity to the terminals tty.
Then sleep 5 minutes, send $RemainingCapacity, sleep 5 minutes, send $RemainingCapacity ........
Now I close the original terminal that I started with and we are left with this:
tc@ASUS:~$ pstree -p 12973
BatteryMonitorD(12973)-+-aterm(12974)---sh(12981)---cat(12983)
`-sleep(13015)
tc@ASUS:~$
With the original terminal gone, BatteryMonitorDisplay.sh now belongs to init , also known as PID #1.