*BSD News Article 70795


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!swrinde!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!jraynard.demon.co.uk!not-for-mail
From: james@jraynard.demon.co.uk (James Raynard)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: How do I use email to start a script?? Never mind, new question instead
Date: 12 Jun 1996 21:10:51 -0000
Organization: A FreeBSD Box
Lines: 24
Message-ID: <4pnbor$8o6@jraynard.demon.co.uk>
References: <31bd5b36.887446@news.hq.af.mil> <31bdb54e.23951400@news.hq.af.mil>
NNTP-Posting-Host: localhost.demon.co.uk
X-NNTP-Posting-Host: jraynard.demon.co.uk

In article <31bdb54e.23951400@news.hq.af.mil>,
Scott Gregory <sgregory@pubspo.hq.af.mil> wrote:
>
>I decided against the mail starting a script thing, however, how could
>I use a script to send mail to a user after a script has finished??

If you still want to use Perl, something like

open(OUTPUT, "|mail -s \"This is a test\" jbloggs");
print OUTPUT "Will this work?\n";
close(OUTPUT);

should send your message to user "jbloggs".

You could either put this code at the end of your other script, or use
Perl's "system" command to run the first one from inside this one.

Hope this helps.

-- 
James Raynard, Edinburgh, Scotland
james@jraynard.demon.co.uk
jraynard@FreeBSD.ORG