What do you expect?
Recently at work, we had to write a script to upload several files to an ftp server. Initially, we developed a first version using here documents. It was not bad, but it wasn't exactly what we needed. We told ourselves: "We just want to do this as if we were typing it". After googling for a couple of minutes, we found expect. expect is an utility to program a dialogue with interactive programs. How does this work? It is something like the following:
I would launch this program
I would expect something in the terms of this string as a result
I would ...