[英]In FTP command mode, how do I redirect command line and the result when using shell script using here document to let ftp command read stdin
我正在尝试编写 shell 脚本来实现 FTP 命令阅读此处的文档。
如何重定向 ftp 命令行和结果 FTP 服务器返回?
我当前的脚本如下
#!/bin/bash
ftp -ivn <<EOF |& tee ftplog.text
open <myFtpserver>
user <username> <password>
pwd
ls -l MYFILE_*
bye
EOF
此代码输出 ftp 服务器的响应,但 ftp 命令输出到 ftplog.txt。 如何重定向两者?
我感谢您的帮助
您应该以这种方式创建脚本:
#!/bin/bash
ftp -ivn >ftplog.text <<EOF
open <myFtpserver>
user <username> <password>
pwd
ls -l MYFILE_*
bye
EOF
重定向到命令,而不是内联块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.