1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/local/bin/expect -- # ftp-rfc <rfc-number> # ftp-rfc -index # retrieves an rfc (or the index) from uunet exp_version -exit 5.0 if {$argc!=1} { send_user "usage: ftp-rfc \[#] \[-index]\n" exit } set file "rfc$argv.Z" set timeout 60 spawn ftp ftp.uu.net expect "Name*:" send "anonymous\r" expect "Password:" send "bilbrey@orbdesigns.com\r" expect "ftp>" send "binary\r" expect "ftp>" send "cd inet/rfc\r" expect "550*ftp>" exit "250*ftp>" send "get $file\r" expect "550*ftp>" exit "200*226*ftp>" close wait send_user "\nuncompressing file - wait...\n" exec uncompress $file |
1 2 3 4 5 6 7 8 9 10 11 | #!../expect -f # wrapper to make passwd(1) be non-interactive # username is passed as 1st arg, passwd as 2nd set password [lindex $argv 1] spawn passwd [lindex $argv 0] expect "password:" send "$password\r" expect "password:" send "$password\r" expect eof |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/local/bin/expect # Script to enforce a 10 minute break # every half hour from typing - # Written for someone (Uwe Hollerbach) # with Carpal Tunnel Syndrome. # If you type for more than 20 minutes # straight, the script rings the bell # after every character until you take # a 10 minute break. # Author: Don Libes, NIST # Date: Feb 26, '95 spawn $env(SHELL) # set start and stop times set start [clock seconds] set stop [clock seconds] # typing and break, in seconds set typing 1200 set notyping 600 interact -nobuffer -re . { set now [clock seconds] if {$now-$stop > $notyping} { set start [clock seconds] } elseif {$now-$start > $typing} { send_user "\007" } set stop [clock seconds] } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |