5
votes

I am trying to use LFTP to pull down new file from a server and thing seem to be working fairly well. However, every time I run the script, I get an "Unknown command `;'" error followed by my echo "Download Complete". I have dug through a ton of resources and can't seem to see anything wrong, here is the script, hopefully someone more skilled can find my error.

#!/bin/bash
HOST='sftp://host'
USER='user'
PASS='password'
REMOTE='/remote/dir'
LOCAL='/local/dir'

#Download from the host
lftp -f "
open $HOST
user $USER $PASS
lcd $LOCAL
mirror --verbose --only-newer --exclude .git/ $REMOTE $LOCAL
quit
"

echo "Download Complete"
1
Which line is throwing that message? - admdrew
Is there a good way to tell? I am new to bash. The process from LFTP does seem to complete as all my files are downloading. The error is coming in before "Download Complete" is echoing. - Paige
Yes, do some standard debugging on your script. Maybe $PASS? - admdrew
lftp supports a debug cmd in your ` ~/.lftprc and ~/.lftp/rc` files. man lftp for more ideas. Good luck. - shellter
I used lftp before and it sucked. Then I built PHPloy - nicer to work with. - Banago

1 Answers

6
votes

Just ran into the same problem by using a sample script and found a solution on another forum. The right command to issue is:

lftp -e ...

Cheers,