![Bash의 굵은 텍스트](https://linux55.com/image/12803/Bash%EC%9D%98%20%EA%B5%B5%EC%9D%80%20%ED%85%8D%EC%8A%A4%ED%8A%B8.png)
여기에 굵게 표시된 단어를 텍스트로 굵게 표시하고 이메일을 통해 보내려는 샘플 스크립트가 있습니다. 여러 가지 방법을 시도했지만 작동하지 않는 것 같습니다.
BODY="Hello. I want to BOLD this"
{
echo "From: [email protected]"
echo "To: [email protected]"
echo "Subject: Texting"
echo "X-Mailer: htmlmail" $VERSION
echo "Mime-Version: 1.0"
echo "Content-Type: text/html; charset=US-ASCII"
print "<html><FONT COLOR=BLACK FACE="Geneva,Arial"SIZE=8><body>${BODY} </body>"
print "<html><FONT COLOR=BLACK FACE="Geneva,Arial"SIZE=10> ${BODY} </html>"
} | /usr/sbin/sendmail -t
답변1
- 이메일 헤더와 본문 사이에 빈 줄을 추가해야 합니다.
- 큰따옴표로 묶인 문자열에 큰따옴표를 잘못 넣으려고 했습니다.
이 시도:
/usr/sbin/sendmail -t <<END_EMAIL
From: [email protected]
To: [email protected]
Subject: Texting
X-Mailer: htmlmail $version
Mime-Version: 1.0
Content-Type: text/html; charset=US-ASCII
<html><body><p><b>${BODY}</b></p></body></html>
END_EMAIL
답변2
이러한 변수는 유용할 수 있습니다.
reset_colour=$( tput sgr0)
bold=$( tput bold)
black=$( tput setaf 0)
red=$( tput setaf 1)
green=$( tput setaf 2)
yellow=$( tput setaf 3)
blue=$( tput setaf 4)
magenta=$( tput setaf 5)
cyan=$( tput setaf 6)
white=$( tput setaf 7)
default_colour=$( tput setaf 9)