Hacker News new | ask | show | jobs
by tangus 3429 days ago
You simply use it to wait for the appropriate prompt before sending anything. If the expected prompt never arrives, something is wrong (CLI changed), so abort. The snippet for this particular case could be something like

    set timeout=1
    expect {
      "enter \"p\" for pre-configured paranoia mode"  { puts p\n }
      timeout     abort
      eof         abort
    }