procmail
[Top] [All Lists]

RE: exactly once

2004-08-25 02:49:00
David W. Tamkin wrote:

Meanwhile, regarding your earlier caution about troubles some 
builds or platforms have with fractional values of x, I tried 
my original code

  :0
  * 1^.-5 ! ? command
  * -.8^0
  action

It does work just fine!  Was stymied until we found the
typo in the first condition above (should be "-.5").

I've tested it on three different systems under three vastly
different platforms.


on the other of the two platforms where I can run procmail, and it 
worked there as well.  The test was like this:

# .onerc
preset=$1

:0
* 1^.-5 ! ? exit $preset ;
* -.8^0
{ LOG="$preset passed
" }
:0E
{ LOG="$preset failed
" }

HOST
# end .onerc

(at a pdksh prompt)

preset=-1

while (( (preset=preset+1) < 256 ))
do procmail -m .onerc $preset < /dev/null
done

= = =


Yup.  Under bash, I did:

$ for n in 0 `yes ' ' | nl | head -256`; do procmail -m .onerc $n
</dev/null; done
0 failed
1 passed
2 failed
3 failed
4 failed
5 failed
6 failed
7 failed
8 failed
9 failed
10 failed
11 failed
12 failed
13 failed
14 failed
15 failed
16 failed
. . . .


That was a Linux system running 3.22.
$ uname -a | sed 's/[a-z]*\.[a-z]*\./munged./'
Linux munged.org 2.4.22-36mdk #1 Sat Jul 3 17:03:11 MDT 2004 i686 unknown
unknown GNU/Linux


Back at $HOME (where you also are, but on a different host with a
different NetBSD build), under tcsh:

[217.228.131.7 -> panix5] {dman} [0.74]
 11:03am [~/Mail] 208[1]> foreach n ( 0 `yes ' ' | nl | head -256` )
foreach? procmail -m .onerc $n < /dev/null
foreach? end
0 failed
1 passed
2 failed
3 failed
4 failed
5 failed
6 failed
7 failed
8 failed
. . . .


And, finally, on a True64 Alpha system, I had to use your syntax for
incrementing because /usr/bin/nl didn't work on stdin!  But the recipe
worked as advertised:

bash-2.05$ preset=-1; while (( (preset=preset+1) < 256 )); do procmail -m
.onerc $preset < /dev/null; done    
0 failed
1 passed
2 failed
3 failed
4 failed
5 failed
6 failed
7 failed
8 failed
. . . .

bash-2.05$ uname -a | sed 's/[a-z]*\.[a-z]*\./munged./'
OSF1 munged.net V5.1 2650 alpha

That's also with procmail 3.22.  There is one other Alpha system I
have a shell account on, but I got "can't execute" when I tried it
there.  The sysadmin apparently won't let me run shells from procmail.
Pity, because it's a 3.15 procmail setup there and I'd like to have
seen the difference.

Wait, I do have some old procmail binaries on panix:

[217.228.131.7 -> panix5] {dman} [0.73]
 11:32am [~/Mail] 221[1]> foreach n ( 0 `yes ' ' | nl | head -256` )
foreach? /users/dman/src/procmail-3.10/src/procmail -m .onerc $n <
/dev/null
foreach? end
0 failed
1 passed
2 failed
3 failed
4 failed
. . . .

Yes, that works with procmail 3.10!

And ditto with

foreach? /users/dman/src/procmail-3.15.2/src/procmail -m .onerc $n <
/dev/null 


Cool beans.

Btw, it is amazing how much faster the run is when I set the
SHELL=/bin/sh in your sample .onerc.

Now, David, you can take a few minutes to tell us *why* it works.  :-)


Dallman


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