3 ms·
I'm going to try this out on my own because what I read in the comments makes me think I will find use for it, but if I had to be honest, I did so because of th
by danso 10y ago
I'm going to try this out on my own because what I read in the comments makes me think I will find use for it, but if I had to be honest, I did so because of the HN comments. The OP was clearly written and nicely formatted, but as someone with moderate CLI/Bash experience (I do almost all of my data processing via Bash programs and pipes), I didn't really understand what `expect` does. Maybe I needed a simpler example, because I don't uss most of the other parts that are in the example, such as `interact` and `send`. As a Pythonist/Rubyist, I have the added baggage of associating `expect` with unit/line testing.
Maybe expect is not for me, but given the title, I would've loved to see maybe a couple paragraphs of why `expect` is underappreciated...that is, what do typical Unix programmers use instead, because they're ignorant of expect. Much easier for me to understand the perspective of ignorance :)
- qwertyuiop924 10y agoExpect is a TCL-based command-line scripting tool. It's designed for scripting things that don't have a scripting interface, and weren't designed to be scripted. Essentially, expect scripts run a program, send it some input, look for some regexes on stdout, and then send more input, which may change depending on what the regex matches. And so on. This is useful, say, if you have a package management tool that requires you to explicitly confirm every update. Or if you want to automatically drive a shell on a remote machine over SSH, and you can't use ssh -c for some reason. You don't need it often. But when you do, it's very useful.
- shermanyo 10y agoThe simplest but one of the most useful example I've run into is in scripts that run an installer that forces a keypress. eg. Running the installer displays a licence agreement, then prompts to accept or decline.