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
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers