On Jan 16, 2004, at 5:02 PM, Larry Guest wrote:
I have a small script that does some admin work for me.
What I need to do now is not only have is display information to STDERR and STDOUT but also write the same information I see when I run the command to a file.
I have written it for others who are not very technical. I want them to
be able to see the script working and what it is doing. But I also need
a log file of the same information so I can have it mailed to me and
keep a copy on the server.
Here's a bit of a wacky Idea - solve it by a bit of indirection - namely write the code so that it does what you want it to do then nest it inside of a script like say
#!/bin/sh
myPerlCode 2>&1 | tee /tmp/myOutput.$$
mail me -s "command run" < /tmp/myOutput.$$ /bin/rm -f /tmp/myOutput.$$
that way your perl code remains simple, but what you hand out to the users to use is going to deal with all of the STDOUT|STDERR as well a always sending you the email...
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>