Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

albacor

macrumors newbie
Original poster
In Terminal, I'm trying to replace SUBJECT and BODY from the command below:

Code:
printf "From: Sender Name <sender@domain.com>\nTo: recipient@domain.com\nSubject: [COLOR="SeaGreen"][B]SUBJECT[/B][/COLOR]\n\n[COLOR="Red"][B]BODY[/B][/COLOR]\n" | /usr/sbin/sendmail -F "Sender Name" -f "sender@domain.com" "recipient@domain.com"

with the piping of
Code:
ls *

I just can't figure out how to do it, any kind soul to help me with this please?
 
Last edited:
Code:
printf "From: Sender Name <sender@domain.com>\nTo: recipient@domain.com\nSubject: $(ls *)" | /usr/sbin/sendmail -F "Sender Name" -f "sender@domain.com" "recipient@domain.com"

Note that file names containing % in the `ls` may be interpreted as format specification by the printf
 
Last edited:
Code:
printf " "From: Sender Name <sender@domain.com>\nTo: recipient@domain.com\nSubject: $(ls *)" | /usr/sbin/sendmail -F "Sender Name" -f "sender@domain.com" "recipient@domain.com"

Damn, why was it so simple? I feel like a fool 😡

Thanks a lot pal 🙂
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.