Posted to tcl by meissa at Tue Oct 29 20:09:43 GMT 2024view raw

  1. #!/usr/bin/expect
  2. set cmd [lrange $argv 2 end]
  3. set timeout [lindex $argv 0]
  4. set password [index $argv 1]
  5. set timeout $timeout
  6. eval spawn -noecho $cmd
  7. log_user 0
  8. expect {
  9. -nocase -re "^.*password.*: " {
  10. send "$password\r"
  11. #log_user 1
  12. exp_continue
  13. }
  14. timeout { exit 1 }
  15. eof
  16. }
  17. catch wait result
  18. puts [string range "$expect_out(buffer)" 2 end-2]
  19. exit [lindex $result 3]

AltStyle によって変換されたページ (->オリジナル) /