initial commit
This commit is contained in:
33
chapter8/ftp-get-file-cmd-line.exp
Executable file
33
chapter8/ftp-get-file-cmd-line.exp
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/local/bin/expect -f
|
||||
#
|
||||
# SCRIPT: ftp-get-file-cmd-line.exp
|
||||
#
|
||||
|
||||
set force_conservative 0 ;# set to 1 to force conservative mode even if
|
||||
;# script wasn't run conservatively originally
|
||||
if {$force_conservative} {
|
||||
set send_slow {1 .1}
|
||||
proc send {ignore arg} {
|
||||
sleep .1
|
||||
exp_send -s -- $arg
|
||||
}
|
||||
}
|
||||
|
||||
set rem_host [lindex $argv 0]
|
||||
set rem_dir [lindex $argv 1]
|
||||
set rem_file [lindex $argv 2]
|
||||
|
||||
set timeout -1
|
||||
spawn ftp $rem_host
|
||||
match_max 100000
|
||||
expect "Name *: "
|
||||
send -- "prodmgr\r"
|
||||
expect "Password:"
|
||||
send -- "Abc1234\r"
|
||||
expect "ftp>"
|
||||
send -- "cd $rem_dir \r"
|
||||
expect "ftp>"
|
||||
send -- "get $rem_file \r"
|
||||
expect "ftp>"
|
||||
send -- "bye\r"
|
||||
expect eof
|
||||
Reference in New Issue
Block a user