1

I want to have a script that uses lftp to download a zip file with a variable name. Currently I have the following:

open server
user user pass
set ssl:verify-certificate no
ls -ltA1 | grep .zip$ | head -n 1

Executing this along side lsftp -f returns just the file name I need. Theoretically now I would run

file="$(lftp -f get_list)"
lftp -u user:pass server:21 -e "get ${file}; bye"

and it should work right? When doing this the lftp command ends up in a reconnect loop. So I tried to do the variable name thing in the first block of code but have no idea how to set the output of that ls command to work with the get command. Any ideas?

1
lftp -u user:pass server -e "set ssl:verify-certificate no; get ${file}; bye"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.