I know that in order to send return in an expect script I do something like this:
send -- "\r"
What is the send command for the INSERT and F12 keys? I've looked online and cannot find it anywhere.
I have to say the initially accepted answer is not correct because
send -- "[2~" is wrong because
[ in Tcl has special meaning (command substitution) so it should be backslash-escaped;\E as in infocmp's output) is missing;The correct way:
set kf12 [exec tput kf12]
set kins [exec tput kich1]
... ...
send $kf12
If you need to manually specify the TERM type, use tput -T:
-Ttype
indicates the type of terminal. Normally this option is unnecessary, because the default is taken from the environment variable
TERM. If-Tis specified, then the shell variablesLINESandCOLUMNSwill also be ignored.
For the magic strings kf12 and kich1, search in the terminfo manual page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With