Oliver wrote:
> I've been looking for information regarding this and all i can gather
> is posters informing posties to use $< and $>. However, i can't seem
> to find an example on how to apply that.
>
> Information regarding my script
> Basically, this script runs as root, parses thru the shadow file to
> calculate if any accounts are about to expire, than parses the passwd
> file to get the user(s) names, and outputs the matching userids and
> names to a text file. I now need this script to switch to another user
> and send an email to an external email address with the contents of
> that text file as the body of the email.
> help....
One way is just do a system call something like:
system("su - otheruser -c 'echo hi | mail
' ");
This works on my system. But I haven't found how to do a whole file
without writing the text file to disk and then tell it to send the mail
as that disk file as input. This works, for example:
system("su - otheruser -c 'mail
< /etc/hosts'");
Boyd