![한 줄의 명령으로 sendmail을 사용하는 방법](https://linux55.com/image/181498/%ED%95%9C%20%EC%A4%84%EC%9D%98%20%EB%AA%85%EB%A0%B9%EC%9C%BC%EB%A1%9C%20sendmail%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
Linux RH에서 이 명령을 한 줄로 어떻게 설정할 수 있습니까? 스크립트를 만들 수 없고, 데이터베이스에 의해 생성되고 호스트 명령을 통해 실행되므로 여러 줄을 입력할 수 없습니다. 고마워요 피에르
cat <<'EOF' - test.html | /usr/sbin/sendmail -t
To: [email protected]
Subject: hello
Content-Type: text/html
EOF
답변1
이는 POSIX 셸에서도 동일해야 합니다.
{ printf '%s\n' 'To: [email protected]' 'Subject: hello' 'Content-Type: text/html'; cat test.html; } | /usr/sbin/sendmail -t