#!/bin/bash
### script to send email with attachment ###
### Declare Email Subject
SUBJECT="TESTING EMAIL"
## Declare Reciever's Email Id
EMAIL="reciever@testemail.com"
## Declare CopyTo Email Id
COPYTO_EMAIL=copyto@testemail.com
destfile="/home/acer/text.txt"
## Removing output files of the script from previous run
rm -f out.mail
## Remove the message body and sent files used in previous versions
rm -f mailbody.txt
rm -f OUTPUTRESULT.CSV
## Create the mail body message in a text file
## Initialize the text file
cat > mailbody.txt
echo "Hi User,\n" >> mailbody.txt
echo "The result file for the server - SERVERNAME - is attached with this email.\n" >> mailbody.txt
echo "\n\nRegards,\nAdmin" >>mailbody.txt
## Sending email using mail command
cat mailbody.txt > out.mail
# Copy the OUTPUT.CSV file generated to another file OUTPUT_RESULT.CSV
uuencode $destfile >> out.mail
# are in their respenter code hereective variables - $SUBJECT and $EMAIL.
mail -s "$SUBJECT" "$EMAIL" "$COPYTO_MAIL" < out.mail
echo "Email sent."
このスクリプトで mail コマンドを実行した後、端末はユーザー入力を求めます。ctrl+d を押すと、送信されたメッセージのみが表示されます。
ユーザー入力を求めるべきではありません。
私は何ができますか?
ユーザー入力を求める理由を教えてください。