循环的问题!!!
我想循环取文件test1.c..test10.c
#!/bin/csh
set var=1
ftp -n 192.168.50.45 < <EOF
user administrator password
cd vc
whle($var <11)
get test${var}.c
@ var++
end
bye
EOF
提示:
Invalid command.
------解决方案--------------------用.netrc试试
编辑一下 .netrc 然后运行ftp就可以了!
----------------------------------
/home/jerry$ cat $HOME/.netrc
default login anonymous password name@host.domian
macdef init
binary
hash on
prompt off
cd /pub/FreeBSD/releases/i386/ISO-IMAGES/5.5
size 5.5-RELEASE-i386-disc1.iso
modt 5.5-RELEASE-i386-disc1.iso
quit
/home/jerry$ ftp ftp.freebsd.org
Trying 2001:6c8:6:4::7...
ftp: connect to address 2001:6c8:6:4::7: No route to host
Trying 2001:4f8:0:2::e...
ftp: connect to address 2001:4f8:0:2::e: No route to host
Trying 204.152.184.73...
Connected to ftp.freebsd.org.
220 Welcome to freebsd.isc.org.
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
binary
200 Switching to Binary mode.
hash on
Hash mark printing on (1024 bytes/hash mark).
prompt off
Interactive mode off.
cd /pub/FreeBSD/releases/i386/ISO-IMAGES/5.5
250 Directory successfully changed.
size 5.5-RELEASE-i386-disc1.iso
5.5-RELEASE-i386-disc1.iso 536201216
modt 5.5-RELEASE-i386-disc1.iso
5.5-RELEASE-i386-disc1.iso Tue May 23 15:33:27 2006
quit
421 Service not available, remote server has closed connection.
/home/jerry$