Live data from Hacker News

Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

blog.robertelder.org

51–60 of 106 posts

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#51

Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things. It's always better and more robust to have a proper interface to script things instead of relying on matching brittle text/regex responses and timers and such. Of course sometimes it's not possible, so expect comes in handy.

Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things.

When I was a graduate Comp Sci TA in the 1990's, it was the perfect way to automate grading the Unix shell that the Systems Software class was supposed to write. Effectively, I was also writing a regression/functional testing system for the class. I explained that the Expect/Tcl script was going to be used to grade their project, and I provided the code.

One of my students said I was the best TA ever! There were a few students who complained that they shouldn't be marked off for a feature breaking, because it had worked a week or two ago. There were a few students who never figured out that the script was going to be used to grade their project, even though I provided weekly email updates explaining this.

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#53

I use pexpect as the basis of an automation framework I use a lot: https://github.com/ianmiell/shutit/blob/master/README.md Recently I used it to migrate an etcd cluster within OpenShift reproducibly: https://medium.com/@zwischenzugs/migrating-an-openshift-etcd...

PS I also wrote autopexpect, which is based on another underrated tool (autoexpect) https://github.com/ianmiell/autopexpect http://expect.sourceforge.net/example/autoexpect.man.html

Oh this is really nice! I've used pexpect (and pxssh) extensively along with expect in a previous lifetime. I'd always meant to write an "autopexpect" or "autopxssh" and never did.

Thanks!

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#54
post #47

Shameless self promotion: if you want to automate subprocesses with python in an intuitive way, give sh a try: https://github.com/amoffat/sh

Man, I was so happy when I discovered your library. It's how I always felt subprocess should be. With split('\n') and basic string parsing there's little that can't be automated with sh. Keep up the good work!

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#56
post #53

Earlier quoted context omitted.

PS I also wrote autopexpect, which is based on another underrated tool (autoexpect) https://github.com/ianmiell/autopexpect http://expect.sourceforge.net/example/autoexpect.man.html

Oh this is really nice! I've used pexpect (and pxssh) extensively along with expect in a previous lifetime. I'd always meant to write an "autopexpect" or "autopxssh" and never did. Thanks!

Glad to hear it! It's very raw, so please do contribute if you can.

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#59

Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things. It's always better and more robust to have a proper interface to script things instead of relying on matching brittle text/regex responses and timers and such. Of course sometimes it's not possible, so expect comes in handy.

Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things. When I was a graduate Comp Sci TA in the 1990's, it was the perfect way to automate grading the Unix shell that the Systems Software class was supposed to write. Effectively, I was also writing a regression/functional testing system for the class. I explained that the Expect/T…

Nice use of expect. I expect (pun intended, though realized after the fact) that you used it to simulate sending user input to their shell? and checking that the shell's response was as expected? (not doing the second on purpose either, honest, it just seems the right word to use).

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#60
Don Libes' daughter went to my high school, and I was working as the "webmaster" for the high school newspaper's website at the time. He would ruthlessly criticize via email the product our self-taught and earnest 2010-era PHP web development. I am not a fan of Don Libes. For those interested, the website was/is: http://theblackandwhite.net/
Post reply on HN