procmail
[Top] [All Lists]

calling external programs using variable assignment

2006-06-25 21:56:03
I have a recipe that successfully detaches e-mail attachments and puts 
them in a separate directory, it then calls ftp to send those off and 
all is well.

But, before I send them off, I want to gzip them.... no problem...BUT 
the problem is I need to keep the original file as well as the .gz file.

So... I've been fighting with this for hours.... trying to use a 
combination of ls and xargs...

DUMMY = `( \
    cd ${DELIVERY_DIR} \
    find * -print0 | xargs -0trI {fn} gzip -c \"{fn}\"" > \"{fn}.gz\""; \
    )`

I do not know why I need those extra " after \" but it seems to generate 
the correct command.

I use the -t option in xargs so I can see the actual command in the 
procmail log (errout)
That shows:
gzip -c "$DOCUMENT CHANGES LOG.DOC" > "$DOCUMENT CHANGES LOG.DOC.gz"

looks great... but, followed by
gzip: "$DOCUMENT CHANGES LOG.DOC" > "$DOCUMENT CHANGES LOG.DOC.gz": No 
such file or directory

It appears the (redirection arrow) > is being interpreted as part of the 
file name.


This SHOULD be such a simple thing to do....

Too bad gzip doesn't have an option to keep the original file.... oh 
well, if wishes were horses, beggars would ride. :-)

Any ideas on how to beat this thing into submission? :-)

Thank you.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>