lftp:登录,将文件放入远程目录并在单个命令中退出:正确引用帮助

Rec*_*cct 28 shell lftp

我想lftp -c一次性完成整个会话(因为我稍后会从脚本中启动它)并且我成功了,-e但是那个 ofc 给我留下了我不想要的交互式会话。

手动状态

-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.
Run Code Online (Sandbox Code Playgroud)

但我不明白我应该如何正确引用和串接我的命令/交互。

lftp -e "put -O remote/dir/ /local/file.txt" -u user,pass ftpsite.com 效果很好。但是我想在执行命令后退出;

lftp -c "open -u user,pass ftpsite.com" || put -O "remote/dir/ /local/file.txt" 只是对我大喊大叫,或者实际上我尝试过的任何引号组合(||&&不管)

gle*_*man 43

$ lftp -c "open -u user,pass ftpsite.com; put -O remote/dir/ /local/file.txt" 
Run Code Online (Sandbox Code Playgroud)

应该这样做。

如果这不起作用,请尝试添加/etc/lftp.conf以下行:

set ftp:ssl-protect-data true
set ftp:ssl-force true
set ftp:ssl-auth TLS
set ssl:verify-certificate no
Run Code Online (Sandbox Code Playgroud)

  • 如果密码中包含诸如“”之类的字符,是否可以使这项工作正常进行:;` (2认同)

Moh*_*ish 14

lftp -e "put -O remote/dir/ /local/file.txt; bye" -u user,pass ftpsite.com