2017-01-31 12 views
1

メールで複数のファイルを送信しようとしていますが、本文に本文を含めています。運は、次のコードは、送信、複数のファイルのためではありません:電子メールで複数のファイルを送信し、電子メールに本体メッセージを追加する(Unix Korn Shell)

echo "This is the body message" | (uuencode file1.txt file1.txt ; uuencode file2.txt file2.txt) | mailx -s "test" [email protected]

任意のアイデアどのようにコードのようになります。

(uuencode file1.txt file1.txt ; uuencode file2.txt file2.txt) | mailx -s "test" [email protected]

が、私は運では、このオプションを試してみましたか?あなたのコマンドを使用して、問題はあなたがサブシェルにechoの出力をパイプしていることで、uuencodeは、標準入力からの読み込みをされていないとして、それは無視なっている

(echo "This is the body message"; uuencode file1.txt file1.txt; uuencode file2.txt file2.txt) | mailx -s "test" [email protected] 

答えて

1

はこれを試してみてください。

あなたがサブシェルを避けるために{ ... }を使用することができます。

{ echo "This is the body message"; uuencode file1.txt file1.txt; uuencode file2.txt file2.txt; } | mailx -s "test" [email protected] 

スクリプトでこれをやっている場合とは、あなたがそれをより読み見てみたい、そして:

{ 
    echo "This is the body message" 
    uuencode file1.txt file1.txt 
    uuencode file2.txt file2.txt 
} | mailx -s "test" [email protected] 
+1

素晴らしいです!魅力として働く! –

関連する問題