Linux 避免bash脚本等待用户输入enter键
我在bash脚本中得到以下条目Linux 避免bash脚本等待用户输入enter键,linux,bash,unix,mailx,Linux,Bash,Unix,Mailx,我在bash脚本中得到以下条目 echo "Please see attached file" | mailx -S smtp=$smtpServer -s "Subject of the mail" -a $logfile -r "sender@domain.com" receiver1@domain.com receiver2@domain.com 如果在发送邮件时没有错误,它就可以正常工作。但有时如果出现错误,mailx将显示错误消息并等待用户输入enter键(回车)。我想避免这种情况
echo "Please see attached file" | mailx -S smtp=$smtpServer -s "Subject of the mail" -a $logfile -r "sender@domain.com" receiver1@domain.com receiver2@domain.com
如果在发送邮件时没有错误,它就可以正常工作。但有时如果出现错误,mailx将显示错误消息并等待用户输入enter键(回车)。我想避免这种情况。它不应该等待用户输入enter键。如何在bash脚本中实现这一点 您可以使用expect命令查找匹配的文本,并将值设置为输入。这将在看到文本时自动键入值 以下问题的解决方案可能有用。 另请参阅。
将本地邮件服务器配置为$smtpServer的中继。