I can accept an extra application to communicate between the WM/terminal and the shell.
I do not need to identify the terminal/console type, but the window ID, so I could do some action on the window. The PS way does not simply work with gnome-terminal. The shell is a subprocess of terminal service, not the window itself.
OS: Artful.
echo \
ps | tail -n 1 | awk {'print $2'}`` does what I understand your subject is asking... – guiverc Feb 20 '18 at 05:35echo
and backticks are superfluous in that pipeline, and I would prefer thetty
coreutil for that. But I agree that we may be missing exactly what OP is asking. What does to "know the terminal window" mean? – zwets Feb 20 '18 at 06:33