Documentation ¶
Overview ¶
The command works like this: stty [verb] [options] Verbs are: dump -- dump the json of the struct to stdout load -- read a json file from stdin and use it to set raw -- convenience command to set raw cooked -- convenience command to set cooked In common stty usage, options may be specified without a verb.
any other verb, with a ~ or without, is taken to mean standard stty args, e.g. stty ~echo turns off echo. Flags with arguments work too: stty intr 1 sets the interrupt character to ^A.
The JSON encoding lets you do things like this: stty dump | sed whatever > file stty load file Further, one can easily push and pop state in by storing the current state in a file in JSON, making changes, and restoring it later. This has always been inconvenient in standard stty.
While GNU stty can do some of this, its way of doing it is harder to read and not as portable, since the format they use is not self-describing: stty -g 4500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
We always do our operations on fd 0, as that is standard, and we always do an initial termios.GTTY to ensure we have access to fd 0.