当前位置: 技术问答>linux和unix
shell中使用mail发邮件的时候正文换行的问题
来源: 互联网 发布时间:2016-08-10
本文导语: 我在shell中使用mail来发邮件的时候,在正文中要写入多行数据,下面是部分代码,但是收到邮件后,发现第二行没有顶格写,不知道是什么原因, filename1=$(ls /pt88/pt845/interface/ist88prd/bhgl/IDD-WWCN-FINGL0015.PEOPLESOFT3.*.TXT) s...
我在shell中使用mail来发邮件的时候,在正文中要写入多行数据,下面是部分代码,但是收到邮件后,发现第二行没有顶格写,不知道是什么原因,
filename1=$(ls /pt88/pt845/interface/ist88prd/bhgl/IDD-WWCN-FINGL0015.PEOPLESOFT3.*.TXT)
sendoutmessage="Successfully uploaded ${filename1} to ${FTPSERVER}"
sendouttime=$(date '+%Y-%m-%d %H:%M:%S')
echo "${sendouttime}
${sendoutmessage}" | mail -s "GL report for ISTC had been uploaded to BH successfully" tonyhf@cn.ibm.com
filename1=$(ls /pt88/pt845/interface/ist88prd/bhgl/IDD-WWCN-FINGL0015.PEOPLESOFT3.*.TXT)
sendoutmessage="Successfully uploaded ${filename1} to ${FTPSERVER}"
sendouttime=$(date '+%Y-%m-%d %H:%M:%S')
echo "${sendouttime}
${sendoutmessage}" | mail -s "GL report for ISTC had been uploaded to BH successfully" tonyhf@cn.ibm.com
|
估计是你内容里有空格吧
你先把内容定向到文件里echo "${sendouttime} ${sendoutmessage}" >> test.mail
然后看看test.mail第二行也没顶格
你先把内容定向到文件里echo "${sendouttime} ${sendoutmessage}" >> test.mail
然后看看test.mail第二行也没顶格