-1

I'm working on a bash script to automate FTP sessions, so I can run the same commands on multiple servers automatically)

lftp -u username,password ip_address -e **FILE_WITH_COMMANDS**

So the problem is that I somehow can't use a file with -f because I get an error like this:

Unknown command `commands'.

Does anybody know how to get around this problem?

Thank you very much!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Tewdyn
  • 687
  • 3
  • 16

1 Answers1

1

To execute commands loaded from a file, use the -f switch:

-f execute commands from the file and exit


The -e switch is for executing a command specified on the command-line:

-e execute the command

So when you use -e commands, the lftp interprets it as a request to run the commands command. And there's no commands command, hence the error.


See also https://lftp.yar.ru/lftp-man.html

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992