procmail
[Top] [All Lists]

Re: Newbee shell problem

2002-09-30 13:26:55
On Mon, 30 Sep 2002, raphael wrote:

r> Hi there,
r>
r> Now I hope you guy's don't start laughing out loud, but I'm just getting
r> involved with procmail since 2 month's and I'm cornered with a little
r> problem.
r>
r> What I want to do is the following. I want to take the date from the Date
r> field of a message and use that to create a string in the format
r> yymmdd corresponding with the date of the message. This is what I got:
r>
r> DATE=\"`formail -xDate:`\"
r> DATEFILE=`date -d $DATE +%y-%m-%d`
r>
r> If I take a look at the log output I come up with:
r>
r> procmail: Assigning "DATE=" Tue, 17 Sep 2002 19:22:12 +0100""
r> procmail: Executing "date,-d,",Tue,,17,Sep,2002,19:22:12,+0100",+%y-%m-%d"
r> date: too many non-option arguments
r> Try `date --help' for more information.
r> procmail: Assigning "DATEFILE="
r>

$DATE is being expanded by procmail and being passed to date as a series
of arguments.  I have "" around my "$DATE"



# remove the variable
DATE_SECS
: 0
* ^Date: \/.*
{
   DATE_SECS=`date --date "$MATCH" +%s`
}
# check for missing or bad date outside the recipe
DATE_SECS=${DATE_SECS:-"Bad date"}



Alan

( Please do not email me AS WELL as replying to the list. Personal
  email is welcome but may invoke a password autoresponder. )


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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