Afficher un message
Vieux 18/05/2007, 16h22   #1
Atropo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Easy question about expect

I'm a really newbie on this. I wish a simple script to switch a user
and executes a command as the other user.


#!/usr/local/bin/expect
set ACCION [lindex $argv 0]
spawn su - workflow
expect "Password:*" {
send "workpass\n"
}
expect "workflow@*.*" {
send "echo workflow $ACCION\n"
sleep 5
}
exit

it does log in, but does not execute the command.
so i put a logfile, but i don't understand it.
when you log into the user it usually show you a "[YOU HAVE NEW
MAIL]"
does it affect the expect behavior??
why those " match glob pattern ?" says "NO"


expect: does "" (spawn_id 7) match glob pattern "Password:*"? no
workflow's Passw
expect: does "workflow's Passw" (spawn_id 7) match glob pattern
"Password:*"? no
ord:
expect: does "workflow's Password: " (spawn_id 7) match glob pattern
"Password:*"? yes
expect: set expect_out(0,string) "Password: "
expect: set expect_out(spawn_id) "7"
expect: set expect_out(buffer) "workflow's Password: "
send: sending "workpass\n" to { 7 }

expect: does "" (spawn_id 7) match glob pattern "workflow@*.*"? no


expect: does "\r\n" (spawn_id 7) match glob pattern "workflow@*.*"? no
[YOU HAVE NEW MAIL]

expect: does "\r\n[YOU HAVE NEW MAIL]\r\n" (spawn_id 7) match glob
pattern "workflow@*.*"? no
workflow@cofeerd1b>
expect: does "\r\n[YOU HAVE NEW MAIL]\r\nworkflow@cofeerd1b>
" (spawn_id 7) match glob pattern "workflow@*.*"? no
expect: timed out

  Réponse avec citation
 
Page generated in 0,09420 seconds with 9 queries