Tip: Using Autoexpect to Create Interactive Scripts in Linux
Scripting Interactive Tasks
I recently came across expect (the expect package in Debian and Ubuntu): a powerful utility that can script interactive operations.
" If you're not familiar with TCL syntax, you can get autoexpect from Wi-Fizzle.com. This spawns a shell, and then records everything you do in that shell. Hit Ctrl-C when you're done, and then either run the generated expect script as-is, or edit it to tidy it up a bit. In particular, autoexpect records keystrokes one by one, whereas you can put them all in at once. It records the full prompt, where the $ at the end may suffice.
Here's an example of a script generated with autoexpect then tidied-up. It logs into a server...
Read the rest of this Linux scripting tip at ServerWatch.com
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linux 3.10 Goes Long, Linux 3.11 Advances as LXDE Merges
- 3Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 4Why Linux is Super (Computing)
- 5Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic