Reputation: 361
I am running this shell script to get a file from FTP server.
#!/bin/sh
HOST='mininet-vm'
USER='mininet'
PASSWD='mininet'
FILE='index.html'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
ls
pwd
get $FILE
quit
END_SCRIPT
exit 0
The output of ls
and pwd
is redirected to the file but the output of get
is not redirected. I want this to be saved in the file, too.
Output of get
command:
local: index.html remote: index.html
200 PORT command successful.
150 Opening BINARY mode data connection for 'mininet/index.html' (104857600 bytes).
226 Transfer complete.
104857600 bytes received in 0.69 secs (148902.1 kB/s)
Please help me figure out the solution.
Thanks.
Upvotes: 0
Views: 2437
Reputation: 202340
Some ftp
implementations inhibit some output, if the output or input is redirected.
You can force the output back using -v
switch (verbose).
ftp -v -n $HOST > /tmp/ftp.worked
Upvotes: 2