[lug] expect script

Jeffrey S. Haemer jeffrey.haemer at gmail.com
Fri Nov 6 11:05:23 MST 2015


Stephen,

The canonical use case for Expect is writing scripts that talk to programs
that require a login and a password.
Such programs typically do I/O from /dev/tty, instead of stdin & stdout, so
typical Unix and Linux I/O redirection -- pipes, etc. -- won't help.

Don Libes, who was writing conformance test scripts for things like
FIPS-151 (POSIX), at NIST in Gaithersburg, built Expect as a DSL for
testing, using a pseudo-tty in a creative hack-around. At the time, Tcl was
all the rage, so he made it a Tcl extension. Since then, lots of languages
have added their own packages to do the same thing in the same way, so you
can now write such scripts in your language of choice: haskell, clojure,
golang, ....

Me, I'm a shell programmer, so I like *empty*.
<http://seejeffrun.blogspot.com/2009/08/empty-turns-hard-into-not-so-hard.html>

On Fri, Nov 6, 2015 at 10:24 AM, Davide Del Vento <
davide.del.vento at gmail.com> wrote:

> I agree with Zan, my only difference is that I use it even more
> infrequently than once in two years.
> Many other things, even when dealing with interactive text, are way
> more used (pipes, python, perl, grep, awk, etc as you certainly know).
>
> On Fri, Nov 6, 2015 at 9:58 AM, Zan Lynx <zlynx at acm.org> wrote:
> > On 11/06/2015 09:52 AM, Stephen Queen wrote:
> >> Earlier this week, I found myself writing an expect script, for the
> >> first time in several years. I've only had to use expect one other time,
> >> so have never become very proficient at it.
> >>
> >> I downloaded the .pdf book from O'reilly called Exploring Expect. I've
> >> read just a short part of chapter 1. I can see where it maybe useful to
> >> learn this language. On the other hand, I've only needed it once before.
> >> Once I've learned it, I may find a lot of uses. My question is, does
> >> anyone actually find this useful anymore? In other words, will I be
> >> wasting time going through this entire book?
> >
> > I find that expect is occasionally useful. Like once every two years
> > kind of thing.
> >
> > Besides the original expect which IIRC is a TCL program, there are
> > expect libraries for other languages as well, like Perl and Python.
> >
> > I think that web APIs have reduced the need for reading and reacting to
> > text. Also there are more system administration tools that do a lot of
> > things for you without needing to do interactive text.
> >
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> > Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>



-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
*פרייהייט? דאס איז יאַנג דינען וואָרט.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20151106/9263b019/attachment.html>


More information about the LUG mailing list