bash - ftp doesn't work within a function
HI
The following code works: /usr/bin/ftp <<ENDFTP open $intranet_server cd $intranet_publish mput $csv_output-* y bye ENDFTP The problem is when it's within an if statement or called from within a function. In both cases I get the error line (lastline): syntax error: unexpected end of file. If I remove the << the function executes (though of course doesn't actually do anything) Is there something I should be doing to escape the <<? Thanks for any assistance.- Richie-451 |
I've just figured the answer myself.
Within a function or an if statement the ftp commands must NOT have any leading tabs or spaces. I don't know why! |
You are much better off using ncftp. It comes with ncftpget and ncftpput which are desinged to do command line ftp.
www.ncftp.com/ncftp/ |
<ramble>
Another possible route is using scp that comes with OpenSSH http://www.openssh.org and SSH http://ssh.com. With the 'scp' command you can setup public key encryption which would allow your account to securely transfer data without the need to store your password in text files. And your script would be more like scp $files user@$intranet_server:$intranet_publish also, Expect http://expect.nist.gov/ </ramble> |
All times are GMT -5. The time now is 10:57 PM. |