Operating System - HP-UX
1755462 Members
3338 Online
108833 Solutions
New Discussion юеВ

Re: using tee pull script output into a log

 
SOLVED
Go to solution
rmueller58
Valued Contributor

using tee pull script output into a log

I have rebuilt a major script, and would like to define some logging mechanism to watch for error conditions in the script that might occur.

What is the process of creating a "tee" ?

Say for example in this code section:
I want to log files being processed by this script. The 1st section looks at file contained in a directory.
##### LOCAL FILE NAME EXTRACT #####
for fn1 in `find -type f -mmin -60 -print` |tee echo $fn1 >> ${LOG_FIL}

I am curious if the "redirection" in my find command would work?
I have several places within the code I would like to append to a daily log

I appreciate the info..


3 REPLIES 3
rmueller58
Valued Contributor

Re: using tee pull script output into a log

or would it be:
or fn1 in `find -type f -mmin -60 -print` |\tee echo $fn1 >> ${LOG_FIL}

so as to force a carriage return?
Jeff_Traigle
Honored Contributor
Solution

Re: using tee pull script output into a log

tee is used to send output to a file as well as to the stdin (typically the screen). Use in your context would be:

for fn1 in `find -type f -mmin -60 -print`
do
echo $fn1 | tee -a ${LOG_FIL}
done
--
Jeff Traigle
rmueller58
Valued Contributor

Re: using tee pull script output into a log

Thanks Jeff.. That did it..