从bash脚本电子邮件 [英] email from bash script

查看:125
本文介绍了从bash脚本电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#!/bin/bash
MESSAGE="Line one. /n"

MESSAGE="$MESSAGE Line two. /n"
MESSAGE="$MESSAGE Line three."

echo $MESSAGE | mail -s "test" "example@example.com"

时,我应该怎么弄的每一行,在自己的行?

Is that how I should get each line, on its own line?

推荐答案

使用一个定界符

mail -s "test" "example@example.com" << END_MAIL
Line one.
Line two.
Line three.
END_MAIL

这篇关于从bash脚本电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆