Live data from Hacker News

Expect – Linux tool for automating interactive programs

linux.die.net

1–10 of 92 posts

Re: Expect – Linux tool for automating interactive programs

#2
claude.ai just suggested this as a tool for automating a workflow that involves ssh'ing into another machine and running some commands as sudo. I'm surprised I've never heard of this tool before. It works great for this scenario and the script can be used a reference to go in manually.

Re: Expect – Linux tool for automating interactive programs

#4
Many years ago I used the Perl version of Expect (https://metacpan.org/pod/Expect) to automate several workflows that wanted manual inputs.

I thought that it was far better than the TCL Expect because I could also use other CPAN modules and have Perl's regular expressions to parse the system's output.

Expect is a great tool to have in your toolkit.

Re: Expect – Linux tool for automating interactive programs

#5

Many years ago I used the Perl version of Expect ( https://metacpan.org/pod/Expect ) to automate several workflows that wanted manual inputs. I thought that it was far better than the TCL Expect because I could also use other CPAN modules and have Perl's regular expressions to parse the system's output. Expect is a great tool to have in your toolkit.

> Perl version of Expect (https://metacpan.org/pod/Expect)

Still a great answer and latest update in March this year.

Re: Expect – Linux tool for automating interactive programs

#6
I used expect a ton years ago, for AIX system janitoring. A lot of things required telnet’ing into proto-ncurses mainframe applications and going through menus, typing and selecting stuff etc.

The actual productive workflow is to do your task with autoexpect, and then refine the generated output: https://linux.die.net/man/1/autoexpect

Re: Expect – Linux tool for automating interactive programs

#7

Many years ago I used the Perl version of Expect ( https://metacpan.org/pod/Expect ) to automate several workflows that wanted manual inputs. I thought that it was far better than the TCL Expect because I could also use other CPAN modules and have Perl's regular expressions to parse the system's output. Expect is a great tool to have in your toolkit.

Arguably, Tcl can do GUIs much easily and can integrate C less awkwardly than Perl. Both have their use cases, at any rate, and more people should use Tcl, Perl and any version of Expect. Nowadays it falls into the category of tools that were once somewhat used, but now are obscure, like fold/fmt, nl, comm and pr.

Re: Expect – Linux tool for automating interactive programs

#9
We used pexpect to automate deployment from various servers and it would prompt users for passwords then they could login to perform deployment tasks for our software. It powered our entire deployment arch at that time. But it would frequently drop off text or prompts if you started doing nested logins.

We rewrote our deployment arch since then

Post reply on HN