Posted to tcl by aspect at Tue Sep 30 13:34:23 GMT 2014view pretty

log_user 0
spawn /bin/cat /etc/passwd
expect {
    ^sys {
        # the pattern you want should come first
        puts "Found the sys account!"
    }
    \n  {
        # fallback pattern
        puts "That's not the line I'm looking for!"
        exp_continue    # exp_continue will restart this expect block
    }
}
puts "Done!"