procmail
[Top] [All Lists]

Re: attachments

2003-11-05 22:17:31
Sean wrote, as quoted by Lukreme:

        # if dir doesn't _already_ exist, create it.
        :0
        * ? test ! -d ${MONTHFOLDER}
        {
                :Wic:MONTHFOLDER$LOCKEXT
                * ! MONTHFOLDER ?? ^^^^
                | mkdir -p $MONTHFOLDER
        }

Well, first, there's no need for the extra level of nesting, and second, the separate test that $MONTHFOLDER is non-null is unnecessary:

 :0Wic:$MONTHFOLDER$LOCKEXT
 * ? test ! -d ${MONTHFOLDER:-/}
 | mkdir -p $MONTHFOLDER

So Kreemsicle asked,

Didn't we decide that

    MAKENEWDIR=`test -d $MONTHFOLDER || mkdir -p $MONTHFOLDER`

was better?

If /bin/test is a shell script, or if /bin/test doesn't exist and procmail treats "test" as a SHELLMETA, it's certainly no worse. But if /bin/test is a binary, I'd say no, it's not so good, because it forks a shell even when the directory already exists or when the variable is null or unset.


_______________________________________________
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>