#!/bin/bash
### script to send email with attachment ###
### Declare Email Subject
SUBJECT="TESTING EMAIL"
## Declare Reciever's Email Id
EMAIL="[email protected]"
## Declare CopyTo Email Id
[email protected]
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."
在這個腳本中執行郵件命令後,終端提示用戶輸入。 當我按ctrl + d只顯示郵件發送的味精。爲什麼在unix中執行郵件命令後提示輸入
它不應該要求用戶輸入。
我該怎麼辦?
你能告訴我爲什麼它會提示用戶輸入嗎?
那麼它可能是值得嘗試但有一個點在郵件的末尾添加一行。就像「\ n」。 –