Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Hi someone tell me what is the difference between using -c and -e in a LFTP script?
e.g. of -c:
Lftp default timeout and retry?
e.g. of -e:
https://stackoverflow.com/a/32432851/13862759
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.
[...]
-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.