linux – 如何重定向结果“!find …”命令来放置lftp命令
发布时间:2020-12-14 01:14:32 所属栏目:Linux 来源:网络整理
导读:我想从lftp中放入来自!find命令的结果的文件. 我试过了: $ lftp -u foo,sftp://barlftp foo@bar$ put !find ./local -type f 但失败了!! 这有效: $ lftp -u foo,sftp://barlftp foo@bar$ !find ./local -type f | awk '{print "put "$1}' /tmp/files.lftp
我想从lftp中放入来自!find命令的结果的文件.
我试过了: $> lftp -u foo,sftp://bar lftp foo@bar$> put < !find ./local -type f 但失败了!! 这有效: $> lftp -u foo,sftp://bar lftp foo@bar$> !find ./local -type f | awk '{print "put "$1}' > /tmp/files.lftp lftp foo@bar$> source /tmp/files.lftp 还有另一种方式!?我想使用stdio重定向(管道,stdin ……). 解决方法
我已经阅读了整个
man lftp(1),看来你选择的方式实际上是最好的.
>!命令不支持与其他命令直接组合,因为您尝试将< !找 ... 因此,唯一的可能性就是:生成脚本并使用source来运行它. 您可以尝试将所有文??件放入一个mput命令: !find ./local -type f | awk -v ORS=" " 'BEGIN{print "mput "}{print}' > /tmp/files.lftp 但要小心:虽然我没有在文档中找到它,但最大行大小可能有限制!所以我认为最终你的方式是最好的方式. 请注意,您还可以将命令编码为高尔夫: !find ./local -type f -printf "put %pn" > /tmp/files.lftp (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |