Score:0

When to use LFTP -c versus -e versus nothing

ca flag
Bio

Hi someone tell me what is the difference between using -c and -e in a LFTP script?

Can someone point me to where it is in the manual? https://lftp.yar.ru/lftp-man.html

I would like to know in what situations it is correct to use -c, -e or nothing.

Score:2
us flag

These options are described in the ... OPTIONS section of the manual:

OPTIONS
   -e commands
          Execute given commands and don't exit.
   [...]
   -c commands
          Execute  the given commands and exit. Commands can be separated with a semicolon, `&&'
          or `||'. Remember to quote the commands argument properly in the shell.   This  option
          must be used alone without other arguments (except --norc)

The lftp command has an interactive mode. If you use -c, the lftp will exit without starting this interactive mode. If you use -e, then it won't exit, and you can continue running commands manually. So you could use -e for running some initial setup and then use the interactive mode to do whatever you actually wanted to do (though you could also use the --rcfile option for this).

For examples of -e, you might have aliases like:

alias lftp_debug='lftp -e "debug -o lftp-debug-output 3"'
alias lftp_no_cahce='lftp -e "set cache:enable false"

For -c, basically any time you have a complete set of commands to execute with lftp with no further manual input to be provided, you can use -c. You don't need to use exit like the example answer you linked to, since lftp will automatically exit anyway.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.