Core iTOps Tube

Sunday, 6 May 2012

Process Substitution Question?

Hello to all. I'm new to this forum, so please go easy on me. =)

I am working on a script to send two e-mail attachments in a single e-mail, and am running into a little bit of an issue when using process substitution. I am using the following:


cat <(uuencode $1 <(basename $1)) <(uuencode $2 <(basename $2)) | mailx -s $3 $4

Basically, I am attempting to encode the attachments with a command functionally similar to:


uuencode /apps/out/report.html report.html

uuencode has 2 parameters, one is the input file, and the other is the output file name. I basically want the user to see the attachment with the name report.html instead of /apps/out/report.html

For this task, I am using basename, which outputs just the filename, but, when I use it in process substitution with uuencode, what I get is /dev/fd/63 instead of the expected report.html "

I don't think the problem is uuencode, because I can use the following commands and get the following results:


cat <(basename /apps/out/report.html)




however, echo yields a different result:


echo <(basename /apps/out/report.html)




I guess I don't understand why echo is getting a different parameter than cat.. Can someone shed some light on why this is, and perhaps suggest how I might get around it?


No comments:

Post a Comment