我试图通过电子邮件发送多个文件,但也在电子邮件中包含一条正文消息,我尝试了两种方法,但没有运气,下面的代码用于发送多个文件:
(uuencode file1.txt file1.txt ; uuencode file2.txt file2.txt) | mailx -s "test" email@test.com
我尝试过这个选择,但没有运气:
echo "This is the body message" | (uuencode file1.txt file1.txt ; uuencode file2.txt file2.txt) | mailx -s "test" email@test.com
知道密码是怎么回事吗?
发布于 2017-01-31 22:46:15
试试这个:
(echo "This is the body message"; uuencode file1.txt file1.txt; uuencode file2.txt file2.txt) | mailx -s "test" email@test.com您的命令的问题是,您正在将echo的输出输送到子subshell中,并且由于uuencode没有从stdin读取,所以它被忽略了。
您可以使用{ ... }来避免子subshell:
{ echo "This is the body message"; uuencode file1.txt file1.txt; uuencode file2.txt file2.txt; } | mailx -s "test" email@test.com如果您在脚本中这样做,并且希望它看起来更易读,那么:
{
echo "This is the body message"
uuencode file1.txt file1.txt
uuencode file2.txt file2.txt
} | mailx -s "test" email@test.comhttps://stackoverflow.com/questions/41968746
复制相似问题