我正在尝试使用带有附件的Mailx和uuencode发送邮件,在shellscript中使用以下代码
attachments=uuencode file1 file1;uuencode file2 file2;
(echo BODY ; $attachments )| mailx -s "Attachments" -m someone@mail.com对于上面的脚本,只发送不带附件的邮件,但是当我使用以下代码时
(echo BODY ; uuencode file1 file1;uuencode file2 file2;)| mailx -s "Attachments" -m someone@mail.com现在,邮件随附件一起发送。
我是一个相当新手的shellscripting,热心的帮助。
发布于 2014-07-17 13:47:33
您在命令替换中使用了错误的引号:
attachments=`uuencode file1 file1;uuencode file2 file2`或者更好
attachments=$( uuencode file1 file1;uuencode file2 file2 )请参阅Command Substitution section of the bash man page
然后使用echo输出变量内容
(echo BODY ; echo $attachments )| mailx -s "Attachments" -m someone@example.comhttps://stackoverflow.com/questions/24794703
复制相似问题