18 lines
269 B
Text
18 lines
269 B
Text
|
#!/usr/bin/expect
|
||
|
|
||
|
set passwd [lindex $argv 0]
|
||
|
set args [lrange $argv 1 end]
|
||
|
|
||
|
spawn -noecho {*}$args
|
||
|
expect -re {^.*assword.*$}
|
||
|
|
||
|
if { $passwd == "-"} {
|
||
|
send -- "\r"
|
||
|
} else {
|
||
|
send -- "$passwd\r"
|
||
|
}
|
||
|
|
||
|
expect EOF
|
||
|
lassign [wait] pid spawnid os_error_flag value
|
||
|
exit $value
|