Concanate odd behaviour in mail pipe

My objective is to combine two text files and send them through Unix mail as message body.

The script to combine the two files into one works just fine:

do shell script "cat " & (quoted form of PosixPath & "errorlog.txt ") & (quoted form of PosixPath & "camcapture.jpg") & "  >> " & (quoted form of PosixPath & "concat.txt")

But when I try to do the same with mail I get only part of the total, with at least the contents from errorlog.txt completely missing.

do shell script ("cat " & (quoted form of PosixPath & "errorlog.txt ") & (quoted form of PosixPath & "camcapture.jpg") & " | mail -s \"" & theSubject & "\" " & theAddress)

(please note that the .jpg files are actually uuencoded imagefiles, so they are actually text files.)

Anybody any clue?

Hi Stadsman,

Placement of ‘quoted form’ looks wrong. For example:


set some_text to "/some_text/"
quoted form of some_text & "more text"

→ “'/some_text/'more text”

You see how you get the single quotes around the first block of text. So ‘cat’ will look for the file 'more text and not find it. Also, I’m assuming there is a space between the two posix paths.

Edited: and BTW, all you need to do is add parenthesis:


set some_text to "/some_text/"
quoted form of (some_text & "more text")

gl,

Good eye! That was the problem indeed! I’ve been up too late too often I didn’t catch that.

I know what you mean. I can bearly see single quotes.