I suggested this to Matthew Saroff,
| > :0bw
| > | while read url; do case "$url" in; *://*) lynx -dump "$url" ;; ; \
| > esac | $SENDMAIL -oi $LOGNAME; done
and he responded,
| I tried the advice, and I am having a bit of a problem.
| Here is the recipe that I came up with:
| ==================================================================
| #Web crawl via email
| :0
| * ^Subject: xxxxx
| {
| :0bw
| | while read url; do case "$url" in; *://*) lynx\
| -traversal -realm -crawl -number_links "$url" | \
| $SENDMAIL -oi msaroff(_at_)pca(_dot_)net ;; ; esac; done
| }
Followed by a logfile excerpt where bash complains of a syntax error near
a semicolon.
First thing, there is no reason to open braces for one unconditional recipe;
second, you have no space between the "x" of "lynx" and the backslash, so if
bash could understand the syntax, it would try to execute a program named
"lynx-traversal".
Third, bash is barfing on a semicolon. It could be that it doesn't
want both ";;" and ";" before esac; I don't know. So let's try this,
a syntax which behaved when I tried it in pdksh:
:0bw
* ^Subject: xxxxx
| while read url; do case "$url" in *://*) lynx \
-traversal -realm -crawl -number_links "$url" | \
$SENDMAIL -oi msaroff(_at_)pca(_dot_)net ;; esac; done
It might be impossible to get bash to take a case structure without
embedded newlines. If that is the case, we can either
1. move the entire while structure into a shell script and call the shell
script on the recipe's action line, or
2. if the message body fits into $LINEBUF, use a recursive INCLUDERC to read
one line at a time.