<div dir="ltr"><div>Here is an example of using tee to write your stdout/err to a file and the screen at the same time.</div><div><br></div><div>/tmp/mylog will contain stdout</div><div>/tmp/myerror will contain stderr</div>
<div><br></div><div><br></div><div>#!/bin/bash<br></div><br>exec > >(tee /tmp/mylog)<br>exec 2> >(tee /tmp/myerror >&2)<br>ls /tmp<br>ls /foobar</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Aug 15, 2014 at 3:24 PM, John Blomfield <span dir="ltr"><<a href="mailto:jabfield@shaw.ca" target="_blank">jabfield@shaw.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Here is a snippet from a bash script cron job I run:<br>
<br>
.............<br>
if rsync -avz --delete --exclude=lost+found $SOURCEDIR $DESTDIR 1> $DEBUGLOG 2> $ERRORLOG; then \<br>
..........<br>
<br>
Occasionally, I need to run this script manually in a terminal and would like to see the output in the terminal as well as saving it to the debug and error log files. Any suggestions?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
John Blomfield<br>
Delivered by Thunderbird Email on Linux OpenSuse-KDE4<br>
<br>
Old John B's Linux Notes <a href="http://www.oldjohnbslinux.wordpress.com" target="_blank">http://www.oldjohnbslinux.<u></u>wordpress.com</a><br>
<br>
<br>
______________________________<u></u>_________________<br>
Discuss mailing list<br>
<a href="mailto:Discuss@vlug.org" target="_blank">Discuss@vlug.org</a><br>
<a href="http://lists.vlug.org/mailman/listinfo/discuss" target="_blank">http://lists.vlug.org/mailman/<u></u>listinfo/discuss</a><br>
</font></span></blockquote></div><br></div>