Computers are meant to reduce our workload. We can help you do that. Expect is a program that lets us turn our interactions with computers into programs. This eliminates having to type and documents processes so they are done exactly the same every time.
Combined with a scheduler like Cron, all the workload, time spent and knowledge become the job of the computer, so you can get on to better things.
The big payoff is especially evident for tasks that are done repeatedly, day after day, year after year. The cost savings of automation rises as does the frequency of the task thats automated. High frequency tasks automated produced better profits and reduced demands on your time.
Expect is written in TCL language. The key commands are send, expect and interact.
The code reminds you of writing a shell program in bash. If you write a command in the program like
- echo "here I am"
this command is written to your local terminal screen. But if you use Secure Shell (SSH) first (using the program) then do the same command like this:
- send "echo here I am\n"
Then this command is written to the remote terminal screen.
What it means
lets say you have 10 machines and you have to log in to each of them daily and run a download program. With Expect, you can automate this task. Expect can login to an unlimited number of machines and run commands on them just as if you logged in manually. Its a fantastic time saver.