I don't understand what this means, but it sounds like an interesting piece of 'how we used to do things'?
Expect – Linux tool for automating interactive programs
61–70 of 92 posts
Re: Expect – Linux tool for automating interactive programs
#62expect is one of those true love/hate things. Probably because the situations in which you need to use it are likely cursed. My time spent dealing with expect scripts is always miserable, and yet I don't know what I'd do without it
So true, and yet so common.
Re: Expect – Linux tool for automating interactive programs
#63My go-to example for `expect` is password-based SSH. Since we're all enlightened beings these days who surely never use this anymore, there's no risk to it: #!/bin/bash expect -c " spawn ssh user@10.0.0.1 expect \"password:\" send \"12345\r\" interact " `interact` hands you back control to do whatever you want, but you don't actually need to do that. You can have `expect` run every command, fill out every field. The…
Re: Expect – Linux tool for automating interactive programs
#64Earlier quoted context omitted.
It looks like Expect was first released in 1990 and Linux in 1991 although Linux wasn't really that usable until around 1993.
I don't think it's unfair to say that they iterated on Linux until it could run expect :-)
Re: Expect – Linux tool for automating interactive programs
#65Good example of an LLM suggesting something useful, even if just RTFM for forgotten tools. O’Reilly put out a book about expect back in the old days (1995). I used expect a few times to automate remote admin, and even to scrape terminal-based applications.
What? It's a manual page.
Re: Expect – Linux tool for automating interactive programs
#66> Cause your computer to dial you back, so that you can login without paying for the call. I don't understand what this means, but it sounds like an interesting piece of 'how we used to do things'?
Re: Expect – Linux tool for automating interactive programs
#67My go-to example for `expect` is password-based SSH. Since we're all enlightened beings these days who surely never use this anymore, there's no risk to it: #!/bin/bash expect -c " spawn ssh user@10.0.0.1 expect \"password:\" send \"12345\r\" interact " `interact` hands you back control to do whatever you want, but you don't actually need to do that. You can have `expect` run every command, fill out every field. The…
Re: Expect – Linux tool for automating interactive programs
#68Many years later I heard they were still relying on that tool!
Re: Expect – Linux tool for automating interactive programs
#69Many 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's regular expressions to parse […] To be fair, Tcl has Henry Spencer’s regexp[0][1], and is awesome; Postgres also base their regex on Henry’s work for Tcl[2]. Perl is certainly famous for its regex and popularizing thinking of problems in terms of regexes (for better or for worse[3]), but it’s not the only game in town. [0] https://en.wikipedia.org/wiki/Henry_Spencer [1] https://wiki.tcl-lang.org/page/Regular…
Agreed.
In that old system we did not have any TCL scripts or third-party libraries--just C, Perl, and C shell (no Bash; it was Unix).
C shell scripting is painful (https://www.grymoire.com/Unix/Csh.html), so practically all scripting was Perl or occasionally AWK.
Re: Expect – Linux tool for automating interactive programs
#70My go-to example for `expect` is password-based SSH. Since we're all enlightened beings these days who surely never use this anymore, there's no risk to it: #!/bin/bash expect -c " spawn ssh user@10.0.0.1 expect \"password:\" send \"12345\r\" interact " `interact` hands you back control to do whatever you want, but you don't actually need to do that. You can have `expect` run every command, fill out every field. The…
For the case of entering passwords, you can just use ssh authentication instead