from ilogue.fexpect import expect, expecting, run
prompts = []
prompts += expect('What is your name?', 'John')
prompts += expect('Where do you live?', 'New York')
with expecting(prompts):
    run('command')
How to get Fabric to automatically (instead of user-interactively) interact with shell commands? Combine with pexpect?