Re: select line from file, and then the next line a week later
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 01/30/05
- Next message: alan_at_ljubljana.agtrz.com: "Re: adding leading zeros to a filename"
- Previous message: William: "Re: extrapoled variable"
- In reply to: Stephane CHAZELAS: "Re: select line from file, and then the next line a week later"
- Next in thread: Janis Papanagnou: "Re: select line from file, and then the next line a week later"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 19:19:26 GMT
On Sun, 30 Jan 2005 10:23:12 +0000, Stephane CHAZELAS <this.address@is.invalid> wrote:
>
<snip>
>
> Or you could even rotate the file (put the first line at the
> end). This way, you don't even need a tempfile:
>
> #! /bin/sh -
> # On solaris, use #! /usr/xpg4/bin/sh -
> file=/path/to/address-list
> {
> IFS= read -r address && {
> cat
> printf '%s\n' "$address"
> }
> } < "$file" 1<> "$file"
> sendmail -t -oi -oem << EOF
> From: The Friday Post Man <some@address.example>
> To: $address
> Subject: Your Friday mail
>
> blah
> EOF
>
The difference between the above and
# #!/bin/sh
#
# list=/path/to/copy/of/list
# body=/path/to/file/with/body/of/mail/with_other_headers
# temp=/path/to/temp/directory
#
# if test -s $list; then
#
# mail -s "your friday mail" -i $body \
# `sed -n '1p' $list` &&
#
# sed '1d' $list > $temp/tempfile$$
# mv $temp/tempfile$$ $list
#
# else
#
# mail -s "ALERT -- Empty Mailing List" his@address.example
#
# fi
#
#
...is that the latter doesn't give one a HEADACHE!
:-)
AC
- Next message: alan_at_ljubljana.agtrz.com: "Re: adding leading zeros to a filename"
- Previous message: William: "Re: extrapoled variable"
- In reply to: Stephane CHAZELAS: "Re: select line from file, and then the next line a week later"
- Next in thread: Janis Papanagnou: "Re: select line from file, and then the next line a week later"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|