Issue
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.
Solution
I have to say the initially accepted answer is not correct because
- The real char sequence is not the same for different terminal types;
send -- "[2~"
is wrong because[
in Tcl has special meaning (command substitution) so it should be backslash-escaped;- The ESC char (
\E
as ininfocmp
'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-T
is specified, then the shell variablesLINES
andCOLUMNS
will also be ignored.
For the magic strings kf12
and kich1
, search in the terminfo manual page.
Answered By - pynexj