2017-07-14 135 views
0

我在bash腳本中輸入了以下內容。避免bash腳本等待用戶輸入回車鍵

echo "Please see attached file" | mailx -S smtp=$smtpServer -s "Subject of the mail" -a $logfile -r "[email protected]" [email protected] [email protected] 

它的工作正常,如果沒有發送郵件的錯誤。但有時如果出現錯誤,mailx將顯示錯誤消息並等待用戶輸入回車鍵(回車)。我想避免這種情況,不應等待用戶輸入回車鍵。如何在bash腳本中做到這一點?

+0

將本地郵件服務器配置爲中繼到$ smtpServer。 – Cyrus

回答