在FTP命令模式下,使用shell脚本(使用here文档)使ftp命令读取stdin时,如何重定向命令行和结果

我正在尝试编写实现FTP命令的shell脚本,在此处读取文件。

如何重定向ftp命令行并导致FTP服务器返回?

我当前的脚本在

以下
RUN apt-get install  -y openssl libssl-dev libcurl4-openssl-dev
RUN pecl install mongodb-1.6.0
RUN docker-php-ext-enable /usr/local/lib/php/extensions/no-debug-non-zts-20180731/mongodb.so

此代码输出ftp服务器的响应,但将ftp命令输出到ftplog.txt。 我该如何重定向两者?

感谢您的帮助

j5210 回答:在FTP命令模式下,使用shell脚本(使用here文档)使ftp命令读取stdin时,如何重定向命令行和结果

您应该以这种方式创建脚本:

#!/bin/bash
ftp -ivn >ftplog.text  <<EOF 
open <myFtpserver>
user <username> <password>
pwd
ls -l MYFILE_*
bye
EOF

重定向到命令,而不是内联块

本文链接:https://www.f2er.com/3090968.html

大家都在问