How to use the lftp -c option?

Project:lftp (project)
Category:support request
Project wiki:lftp
Related pages:#175: lftp

How to use the lftp -c option?



I can open a bookmark this way:

lftp bookmark

If I want to cd to the 'test' directory, the following does not work:

$ lftp -c "cd test" bookmark
Unknown command `cd test'.
$ lftp -c cd test bookmark
Usage: cd remote-dir

The commands must be put in order, so open the connection first:

$ lftp  -c open bookmark cd test

exept that changing directory does not work.


$ lftp  -c open bookmark; ls; pwd;

The result of the commands ls and pwd are that of the local directory, not the remote server as expected.

If I replace -c with -e, the same commands are executed only after exiting.


The man page says:

Commands can be separated with a semicolon, `&&' or `||'.

but I don't get the same results when using different options.

with ; and with &&, the ls and pwd command are executed after exit. With || they are not executed at all.


Ok, I get it. The whole command must be put within quotes.