1

In my script I have a variable named $message. I want to send this message together with a jpeg using mpack.

One way that works:

echo "$message" > myText
mpack -s "test mail" -d myText myImage.jpg [email protected]

However, I would like to dispense with writing the file myText and directly pass the contents of $message to the -d parameter.

How can this be done?

BTW: My $message variable contains two sub-strings separated by a linefeed.

1 Answer 1

1

Figured it out. A named pipe did the trick:

mkfifo fifo
echo "$message" > fifo &
mpack -s "test mail" -d fifo myImage.jpg [email protected]
rm fifo

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.