任何人都知道会出现什么问题?
#!/bin/bash -x
HOST='192.163.3.3'
USER='ftpuser'
PASSWD='apple'
Logfile=a.log
while :; do
ftp -n -p -v $HOST < example.script >> a.log
grep -qF "Connected" a.log &&
grep -qF "File successfully transferred" a.log && break
done
quote USER $USER
quote PASS $PASSWD
example.script 包含
put example.txt
运行后它给出
grep: a.log: No such file or directory
grep: a.log: No such file or directory
.
.
example.script 和创建的 a.log 位于 /home 目录
a.log 包含
Connected to 192.163.3.3.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 9 of 50 allowed.
220-Local time is now 14:38. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Remote system type is UNIX.
Using binary mode to transfer files.
local: example.txt remote: example.txt
530 You aren't logged in
Passive mode refused.
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
为什么我无法登录?
HOST='192.163.3.3'
USER='ftpuser'
PASSWD='apple'
FILE='example.txt'
Logfile=a.log
ftp -n -p -v $HOST << SCRIPT_END >> a.log
quote USER $USER
quote PASS $PASSWD
put $FILE
SCRIPT_END
有了这个它可以工作,但为什么?会有什么区别?