procmail
[Top] [All Lists]

Conditional statement problem

2005-05-02 01:37:59
   Dear All
   Hi,
   I am trying to write a recipe to check the existence of
of MAILDIR directory. The recipe is:
SHELL   = '/bin/sh'
DEFAULT = '/dev/null'
VERBOSE = 'on'
LINEBUF = 8192
MAILDIR = /ext3/pkgs2/ztmp/Test/Procmail_1 ### A non-existing directory
DIR_1   = /ext3/pkgs2/ztmp/Test/Procmail_1 ### A non-existing directory
DIR_2   = /ext3/pkgs2/ztmp/Test_1          ### A non-existing directory
TMP_DIR = /ext3/pkgs2/ztmp/Test/Procmail   ### An existing directory
MY_DIR=


:0
*? ! [[ -d $MAILDIR || -d $DIR_2 ]]
{
  :0 fwi
  | MAILDIR=`mktemp -d $TMP_DIR/procmail.XXXXXX`; \
    echo $MAILDIR >> $TMP_DIR/zzz.txt
}

The above conditional statement returns FALSE with the following
LOG messages:{{{
...
procmail: Assigning "MAILDIR=/ext3/pkgs2/ztmp/Test/Procmail_1"
procmail: Couldn't chdir to "/ext3/pkgs2/ztmp/Test/Procmail_1"
...
procmail: Executing " ! [[ -d $MAILDIR || -d $DIR_2 ]]"
procmail: Non-zero exitcode (1) from " ! [[ -d $MAILDIR || -d $DIR_2 ]]"
procmail: No match on " ! [[ -d $MAILDIR || -d $DIR_2 ]]"
}}}

But the following works fine as expected:

:0
*? ! [[ -d $DIR_1 || -d $DIR_2 ]]
{
  :0 fwi
  | MY_DIR=`mktemp -d $TMP_DIR/procmail.XXXXXX`; \
    echo $MY_DIR >> $TMP_DIR/zzz.txt
}

In this case the LOG messages are:{{{
...

procmail: Assigning "MAILDIR=/ext3/pkgs2/ztmp/Test/Procmail_1"
procmail: Couldn't chdir to "/ext3/pkgs2/ztmp/Test/Procmail_1"
...
procmail: Executing " ! [[ -d $DIR_1 || -d $DIR_2 ]]"
procmail: Match on " ! [[ -d $DIR_1 || -d $DIR_2 ]]"
....
}}}

I cannot figure what am I doing wrong. Any help would be gratefully
appreciated.

Thanks,
Hossein

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