Originally posted by Paulo Góes
In my network there are:
Machine A (ftp server running ProFTPd)
In Machine B, at /root, there is .netrc file that controls successfully auto-login to Machine A. From the command line the connection and login are fine, but how can I do to, via shell script, execute the connection, login and upload some files as I do interactively in command line?
Thanks in advance
1)One way is to write like this.
ftp command 1
ftp command 2
There shouldn't be iany leading space before the last EOF. You can use any string in place of EOF.
2) Second way is
(ftp command1 ; sleep 1; ftp command 2 ; sleep 1; ftp command 3; sleep 1 )| ftp server
This should work fine . Note the "sleeps" .. they are added to give the server some time to respond. The only problem is it sends it as a bunch to the server and if the server is slow then it may not work correctly(1%).
3) Third way is to use TCL expect. Expect allows you to automate anything. It's brilliant.