nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] When a message goes only to me, as a cc


From: Ralph Corderoy
Subject: Re: [Nmh-workers] When a message goes only to me, as a cc
Date: Tue, 11 Oct 2016 18:45:33 +0100

Hi Paul,

> i'll post my script here, because i always learn something when ralph
> corrects my scripts.  ;-)

:-)

>     if egrep -q '^(To:|Resent-To:)[[:space:]]*$' $draft ||
>         ! egrep -q '^(To:|Resent-To:)' $draft

-i for insensitive?
Factor?  `^ *(Resent-)?To *:'.  Helps the reader and potentially egrep.
Test for the opposite, two become one?  «! egrep -q '^ *To *: *[^ ]'»?

>         echo "ERROR: missing or empty 'To:' header...."

`>&2' for stderr?

>     numfroms=$(sed -n -e '/^\(From:\|Resent-From:\)/p' -e '/^$/q' $draft |
>       wc -l)

`egrep -c'?

>         tolap=$(whom $draft | grep ' at laptop\.org')
>         fromfox=$(formail -c -x From: < $draft | egrep '@foxharp\.')
>         if [ "$tolap" -a "$fromfox" ]

Not likely to be a problem here, but "x$tolap" protects from tolap
starting with a `-'.  But then each needs to become «"x$s" != x», which
is a bit tedious.  [[...]] is much preferred if the shell you're using
has it.

>         then
>             echo "$attachments"
>             echo "(pwd is $PWD)"
>         else
>             echo "$attachments"
>         fi

Duplicate echo can be factored to before the if statement.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]