[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
- Re: [Nmh-workers] When a message goes only to me, as a cc, (continued)
Re: [Nmh-workers] When a message goes only to me, as a cc, David Levine, 2016/10/11
- Re: [Nmh-workers] When a message goes only to me, as a cc, norm, 2016/10/12
- Re: [Nmh-workers] When a message goes only to me, as a cc, Paul Fox, 2016/10/12
- Re: [Nmh-workers] When a message goes only to me, as a cc, Robert Elz, 2016/10/12
- Re: [Nmh-workers] When a message goes only to me, as a cc, Paul Fox, 2016/10/12
- Re: [Nmh-workers] When a message goes only to me, as a cc, norm, 2016/10/13
- Re: [Nmh-workers] When a message goes only to me, as a cc, Paul Fox, 2016/10/13
Re: [Nmh-workers] When a message goes only to me, as a cc, Paul Fox, 2016/10/11
- Re: [Nmh-workers] When a message goes only to me, as a cc,
Ralph Corderoy <=