Expect predates Linux by years. It is an old school portable program.
It looks like Expect was first released in 1990 and Linux in 1991 although Linux wasn't really that usable until around 1993.
Expect – Linux tool for automating interactive programs
31–40 of 92 posts
Re: Expect – Linux tool for automating interactive programs
#32Re: Expect – Linux tool for automating interactive programs
#33I 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
Meta shells and meta meta shells should be an assumed feature by now, not a hit or miss of terminal program feature sets, and not tied to UI programs.
Re: Expect – Linux tool for automating interactive programs
#34Re: Expect – Linux tool for automating interactive programs
#35Re: Expect – Linux tool for automating interactive programs
#36 #!/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 tool you need when you're in environments you don't deserve.
Re: Expect – Linux tool for automating interactive programs
#37Re: Expect – Linux tool for automating interactive programs
#38Re: Expect – Linux tool for automating interactive programs
#39Many 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.
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+Expressions
[2] https://github.com/postgres/postgres/blob/master/src/backend...
[3] https://stackoverflow.com/questions/1732348/regex-match-open...
Re: Expect – Linux tool for automating interactive programs
#40expect 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