pty - create pseudo terminal and run command
pty [ options ] command [arg ...]
creates a pseudo pty and then runs command
with arguments given by arg
and the standard input, standard
output, and standard error connected to the pseudo terminal. By default, the pty
creates a new session.
If command does not contain a /, the PATH variable will be used to locate the command.
Input to pty will be written to the standard input of this command. The standard output and standard error from the command
will be written to the standard output of pty.
The pty commmand terminates when the command completes.
- -d, --dialogue
Execute the dialogue on the standard input. A dialogue is a sequence of commands, one command
per line. All re patterns are extended regular expressions. The re ?1 will print the subject string on the
standard error and match the string; the re ?0 will print the subject string on the standard error and not match the
string. The re ?. matches EOF. The commands are:
- # comment
- c text
write text to the master; C style escapes in text are converted, including
\E for ESC and \cX for control-X
- d milliseconds
set the delay before each master write to milliseconds; the
default is no delay
- i re
- read a line from the master; if it matches re then execute lines until matching e
- e [re]
else [if match re] then execute lines until matching e or f
- end of i/e block
- m text
write text to the standard error
- p text
peek input until text is found at the beginning of a line; input is not
- r [re]
read a line from the master [and it should match re]
- s milliseconds
sleep for milliseconds
- t milliseconds
set the master read timout to milliseconds; the default is
- u re
- read lines from the master until one matches re
- v level
set the verbose trace level, more output for higher levels, disabled for
- w text
write text\r\n to the master; C style escapes in text are converted,
including \E for ESC and \cX for control-X
- x [code]
exit pty with exit code 0 [code]
- I re
- ignore master lines matching re
- L label
prefix all diagnostics with label:
- P text
delay each master write until the beginning of an unread input line exactly
- -D, --debug=level
Set the debug trace level, higher levels produce more output, disabled for
- -l, --log=file
Log the master stdout and stderr to file.
- -m, --messages=file
Redirect diagnostic message output to file.
- -s, --session
Create a separate session for the process started by pty. On by default; -s means
- -t, --timeout=milliseconds
Set the master read timeout to milliseconds. The default value is 1000
- -T, --tty=stty
Pass stty to the stty(1)
command to initialize the pty.
- -w, --delay=milliseconds
Set the delay before each master write to milliseconds. The default
value is 0.
If the command determined by command
is run the exit status of pty
is that of this command. Otherwise, the exit
status is one of the following:
- The command is found but cannot be executed.
- The command could not be found.