![]() |
| ||
| Automating an FTP upload Hello, I have stared at this script for the last two days and am unable to find the cause of my error message. Any help would be greatly appreciated. The script is
I have removed some of the site specifics but this is the basic script. If I remove the For loop and If condition and just specify the file name, the ftp works. Introduction of the loops causes: uploader.sh: 19: Syntax error: end of file unexpected (expecting "fi") each time. The error is always listed as one line past the length of the script. I am completely baffled as to what I am missing in this script. |
| ||
| Re: Automating an FTP upload I coould be completely wrong, because I always put it against the left edge anyway, but I believe the "END_SCRIPT" marker you are using to end the so-called here document, needs to be against the left hand side, in otherwords at the beginning of the new line. |
| ||
| Re: Automating an FTP upload That worked great. Thanks for saving me from a very long weekend. :p |
| ||
| Re: Automating an FTP upload Quote:
Hope this helps - here is expect: http://sourceforge.net/projects/expect |
| ||
| Re: Automating an FTP upload Greetings, The method you are using is going to hammer the ftp with a connect and disconnect for every file in that dir. I have re-wrote it to make it more connection friendly, I would consider using the for loop on the send only. Like so: #!/bin/sh # Declare Variables HOST='xxx.xxx.com' USER='xxxx' PASSWD='xxxx' # Start FTP Connection ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD ascii # Initiate Loop for Sending File for file in '/xxx/*' do if [ -f /xxx/$file ] then put $FILE fi done END_SCRIPT |
| ||
| Re: Automating an FTP upload If you want to indent you can use the indent option for inline files: if [[ something ]] ; then Note the dash before the introduction to the inline file. |
| ||
| Re: Automating an FTP upload hi can anybody help me in automating ftp. following is my program #!/bin/sh HOST="192.168.1.227" USERNAME="ganesh" PASS="ganesh123" ftp -n -v $HOST << EOF USER $USERNAME PASSWORD $PASS bin hash prompt get messages.properties bye EOF i have problem in login the FTP |
| ||
| Re: Automating an FTP upload Start your own thread. |
| All times are GMT -4. The time now is 4:15 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC