From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Jörg Ziefle" <gt4556a@prism.gatech.edu>, zsh-users@sunsite.dk
Subject: Re: 2nd mail question :)
Date: Wed, 27 Jun 2001 07:28:21 +0000 [thread overview]
Message-ID: <1010627072822.ZM5007@candle.brasslantern.com> (raw)
In-Reply-To: =?iso-8859-1?Q?=3C20010626233435=2EA4263=40acmex=2Egatech=2Ee?= =?iso-8859-1?Q?du=3E?= =?iso-8859-1?Q?Comments=3A_In_reply_to_J=F6rg_Ziefle_=3Cgt4556a=40prism?= =?iso-8859-1?Q?=2Egatech=2Eedu=3E?= =?iso-8859-1?Q?________=222nd_mail_question_=3A=29=22_=28Jun_26=2C_11=3A3?= =?iso-8859-1?Q?4pm=29?=
On Jun 26, 11:34pm, Jörg Ziefle wrote:
} Subject: 2nd mail question :)
}
} Does anybody see a way to execute an external program when new mail has
} come in? Events, for example?
It's not really documented, but you can put any $-expansion you like in
the notification message in mailpath. E.g.:
mailpath=( $HOME/Mail'?New mail in $_ at $(date)' )
} What I wanna do is when new mail arrives, I want to have a little
} program executed that starts my mailer with the right folder
} (user-specified if several folders have received mail).
Hrm. Why not just leave your mailer running and let it do the new mail
checking? (Secondary question, why not get a better mailer?)
The thing to remember about stuff in $(...) is that zsh wants to read
the output from it -- so zsh will wait not just until the program exits,
but until it actually reads end-of-file, which means even putting the
program in the background won't necessarily unblock zsh. At the same
time, the program's output (and maybe input) are directed away from the
terminal, so unless you explicitly point them back you can't interact
with the program.
So if you really want zsh to automatically fire up some kind of mail
client when new mail arrives, you need something like:
mailpath=( $HOME/Mail'?$(mutt -f "$_" </dev/tty >&/dev/tty)' )
Note placement of single vs. double quotes. Note also that zsh will run
this once for every file that has new mail. A better solution might be
something like this:
mailpath=( $HOME/Mail'?$(echo "$_" >>| ~/.newmail) )
precmd() {
if [[ -f ~/.newmail ]]; then
# There'll be one line for each mailbox.
# Run your mailer appropriately.
mutt -f "$(head -1 ~/.newmail)" # or whatever
rm ~/.newmail
fi
}
I predict, however, that after at most a day of having your mail client
repeatedly pop open in the middle of whatever else you're doing, you will
abandon this idea.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2001-06-27 7:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-27 3:34 Jörg Ziefle
2001-06-27 7:28 ` Bart Schaefer [this message]
2001-07-03 14:55 William H. Magill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1010627072822.ZM5007@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=gt4556a@prism.gatech.edu \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).