Skip to content. | Skip to navigation

Navigation

You are here: Home / Support / Guides / Scripting / Expect / Interact / Introduction

Personal tools

Interact

Expect's interact command

Introduction

Expect's interact command is one of its little secrets. You might be used to it in the form of throwing the interaction with the spawned process back into the hands of the user but it can do much more.

This is the obvious case, lazy-ssh:

#! /usr/bin/expect

spawn ssh host

expect {
  assword: {
    exp_send $password
  }
}

interact

in other words, we have the expect script respond with our password and then the interact command gives us, the user, control over the spawned ssh session.

Document Actions