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!
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.