문제

i need to send a weekly email containing some dynamic information that will be collected in a txt file. what i can't accomplish is adding the content of that file into the subject of my email. my file is named bkp.txt and has one line "weekly backups; total: 10; size: 3gb"

is there any way i can send an email using this format

mailx -s "weekly backups; total: 10; size: 3gb" "email.address@domain.com" < another.txt, keeping in mind the content of bkp txt can modidy every week?

thanks!

도움이 되었습니까?

해결책

Use bash command substitution:

mailx -s "$(<bkp.txt)" ......
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top