I am aware that iI can log using tee
But I want to log from inside my script, at the same time display the content on the stdout also.
Example, my code looks something like this:
names=$(print("name1 name2 name3 name4"))
for name in names
do
echo "Current Name: " $name
related_job= ps -ef | grep $name | awk '{print $9}' >> File.dat
echo "related job: " $related_job
done
Now, this block will certainly echoecho at stdout, but iI even want to log this to a log file, say script_name.logscript_name.log.
Also, iI am calling the script through a scheduler and sue to come constraint iI can't use script_name | tee log_file . I can just call the script by the script name.
What could be the solution to itthis?