[英]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.