The send Command
Both Tk and Expect have a command named send
.[67] Expectk detects this collision and lets Tk “win” the fight for command names. So if you type "send
“, you get Tk’s send
command. Alternate names are provided for any Expect commands that could collide. In particular, Expect commands that do not already begin with "exp
" can be invoked by prefixing them with "exp_
“. For example, Expect’s send
command can be invoked as exp_send
.
% exp_send "foo\r"
If you accidentally call Tk’s send
when you want Expect’s send
, you will see the following error:
% send "foo\r"
wrong # args: should be "send interpName arg ?arg ..."
The alias exp_send
works in both Expect and Expectk, so you can use exp_send
all the time if you find it simpler to remember or read. You should also stick with exp_send
if you are writing code that is to be portable to both Expectk and Expect.
[67] I will not talk about the function of Tk’s send command until Chapter 18 (p. 405).
Get Exploring Expect now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.