procmail
[Top] [All Lists]

Re: INCLUDERC

2004-03-14 11:11:49
On Sat, 13 Mar 2004, 01:11 GMT-06 David W. Tamkin wrote:

Robert Allerstorfer wrote:

  * $ ?"$TEST -r $my_INCLUDEFILE"

I still don't see why you're enclosing the command string in quotes and
then using an extra dollar modifier to undo them instead of simply doing
neither.  It's like going up one flight of stairs and then down one 
flight to get to another room on the same floor of the building instead
of just walking along the hall.

You're doing all this in the name of the possible greater efficiency of
using /usr/bin/test instead of calling /bin/sh to use its test built-in.
  But then you add a layer of quoting and remove it instead of just 
leaving it off.  Sounds like spending EUR20 to save EUR15.

Again, it's enough to use

  * ? $TEST -r $my_INCLUDEFILE

The *reason* why my original, quickly posted solution included the
double quotes surrounding the entire command to be executed was not to
pay EUR 20 for saving EUR 15, but rather ensuring not to loose EUR 100
after having payed EUR 20.

It was simply known by me that it would work because I have tested
that way previously, as you know from our previous thread. And, as of
that post, I have not found the time to test other possible ways. I
did test another way which failed horribly, as you also know from our
previous discussion. So, for the quick solution, I prefered to be save
and not to risk anything by using an yet untested code.

In the meantime, I did found time to test other ways and, I now prefer
the following way:

* ? $TEST -r "$my_INCLUDEFILE"

As you can see, I followed your suggestion to remove the quotes from
the entire command, along with removing the dollar modifier. In
addition, I prefer to put the path to be tested within quotes, to be
save should the path include a space character.

or heck, you also might as well hard-code /usr/bin/test and not waste
the environment handling on a variable for it.

I also don't like environment pollution. What I like is to recycle
things whenever possible. That's exactly my reason for *not*
hardcoding the path to 'test' in each and every condition, but instead
only defining it once (in a place where users could and should look
for their preferences) and then re-use the value in all routines when
needed. Something which may be called code design.

rob.


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