The ptyget package is discussed on the ptyget list.
It's a good idea to have descriptor 3 open to the controlling terminal when using these commands. Some of them do this themselves, for the benefit of commands they run, and others expect it to already be done.
These patches make ptyget work on Linux, more or less. (I'm not happy with
TIOCREMOTE entirely, but I don't know what to put in
its place. It seems to work, though.) Pick one: