Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the autoexpect command. You can use it to build expect scripts that let you run scripts without having to provide answers interactively.
Say you have a script that requires you to supply a lot of information. Here’s an example:
Now you want to generate an expect script that will run this script and supply all of the answers for you. The easiest way to do that is with autoexpect.
If you look at the end of the new script with the tail command, you’ll see that it’s set up to run the askMe script without requiring your help. It’s probably a good idea to rename script.exp:
That’s your Linux tip for autoexpect.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.