*BSD News Article 71180


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!newsfeed.internetmci.com!qns3.qns.net!news.ecn.uoknor.edu!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!f400.n712!f515.n712!f401.n711!not-for-mail
Newsgroups: comp.unix.bsd.freebsd.misc
Distribution: world
X-Comment-To: sgregory@pubspo.hq.af.mil
From: Trev Roydhouse <Trev.Roydhouse@f401.n711.z3.fidonet.org>
Date: Fri, 14 Jun 96 21:25:00 +1000
Subject: Re: How do I use email to start a script?? Never mind, new question ins
Message-ID: <2711505669@f401.n711.z3.ftn>
Organization: Sentry -- Sydney, New South Wales, Australia
X-FTN-AREA: COMP.UNIX.BSD.FREEBSD.MISC
X-FTN-Tearline: QM v1.30 
X-FTN-Origin: Sentry -- Sydney, New South Wales, Australia (3:711/401.0)
X-FTN-SEEN-BY: 711/401 501 712/400 515
X-FTN-PATH: 711/401 712/515
X-FTN-PATH: 712/400
Lines: 20

 > 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??  

 #!/bin/sh 
 # user is extracted from REMOTE_HOST environment 
 # variable "pcname" supplied by httpd; your mileage 
 # will probably vary 

 user=`echo REMOTE_HOST | cut -f 1 -c2-` 
 echo "Hello there ${user}" 

 cat << EOF | mail ${user} 
 Subject: Hello 

 G'day there ${user}!  
 EOF 
 # ends