问题
I am trying to automate xterm and it mainly relies on the -S
option while launching the xterm
.
From man page
-Sccn
This option allows xterm to be used as an input and output channel for an existing program and is sometimes used in spe‐ cialized applications. The option value specifies the last few letters of the name of a pseudo-terminal to use in slave mode, plus the number of the inherited file descriptor. If the option contains a “/” character, that delimits the characters used for the pseudo-terminal name from the file descriptor. Otherwise, exactly two characters are used from the option for the pseudo-terminal name, the remainder is the file descriptor. Examples (the first two are equivalent since the descriptor follows the last “/”):
-S/dev/pts/123/45
-S123/45
-Sab34
Note that xterm does not close any file descriptor which it did not open for its own use. It is possible (though probably not portable) to have an application which passes an open file descriptor down to xterm past the initialization or the -S option to a process running in the xterm.
I hope this option is to make use of the input and output channels of xterm and can be customized.
How to use this option ?
回答1:
"How to use" is pretty broad. There are a few examples of its use: a Tcl/Tk script multixterm written a while back, and the ditto program which is part of ncurses-examples.
The latter is mentioned here:
- Get output from Ncurses app on a separate terminal (with screenshots)
- Sending curses input to another terminal in C via a fifo
- Multiple xterm pseudoterminals used as output only from multiple threads
The option is not much used; there was some problem a few years ago which was repaired in patch #314 (newer versions should work as shown).
来源:https://stackoverflow.com/questions/47882198/how-to-use-xterm-with-s-option