How to use the lftp -c option?

Project:lftp (project)
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Project wiki:lftp
Related pages:#175: lftp
Description

How to use the lftp -c option?

Comments

#1

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.

#2

$ 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.

#3

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.

#4

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