Autoexpect
Autoexpect is a built-in script with expect [[1]] that auto-generates an expect script from watching a session, basically autoexpect watches you interacting with another program and creates an Expect script that reproduces your interactions.
just type autoexpect
and a new session will start. autoexpect will then begin recording your interactions until you stop it.
This has the downside of recording full output and putting them into an expect field. This can be avoided by using the - p
flag which will put auto expect into prompt mode. In this mode, autoexpect will only look for the the last line of program output - which is usually the prompt. This handles the date problem (see above) and most others.
See Also: Expect [[2]]