Well, after posting this

On Mon, Jan 18, 2016 at 10:09 AM, Joel Rees <joel.r...@gmail.com> wrote:
> Trying to put some scripts together so I can set an update going one
> night, check it in the morning, reboot, and finish the update while
> I'm at work.
>
> So I want to do something like
>
>    cd /usr/src && cvs -d$CVSROOT up -Pd | tee /var/log/build/cvssrc.log
>    cd /usr/xenocara && cvs -d$CVSROOT up -Pd | tee
> /var/log/build/cvsxenocara.log
>    cd /usr/ports && cvs -d$CVSROOT up -Pd | tee /var/log/build/cvsports.log
>    cd /usr/src/sys/arch/`machine`/conf && config GENERIC.MP && \
>    cd ../compile/GENERIC.MP && make clean && make && \
>    make install | tee /var/log/build/buildsys.log 2>&1
>    ...
>
> except the 2>&1 is, I think the book says, too late to collect both
> output streams into buildsys.log .
>
> I found
>
>    exec > >(tee ${LOGFILE}) 2>&1
>
> suggested on stackexchange (with claims that it works in ksh), but a
> simple test with
>
>    ls /nonexisting > >(tee mylog) 2>&1
>
> fails with
>
>    ksh: syntax error: `> ' unexpected
>
> Any suggestions appreciated. Cluebats, too.

I checked over the answer on stackexchange, played around with an
example of juggling file descriptors, and found this seems to work:

   { ls ${DIR} ; } 2>&1 | tee mylog

catching the output whether DIR exists or not. So I'm going to try

   { rm -rf /usr/obj/* && cd /usr/src && make obj && \
   cd /usr/sr/etc && env DESTDIR=/ make distrib-dirs && \
   cd /usr/src && make build ; } 2>&1 | tee /var/log/build/buildsys.log

in a script by itself now.

Sorry for talking to myself on list

-- 
Joel Rees

Be careful when you look at conspiracy.
Arm yourself with knowledge of yourself, as well:
http://reiisi.blogspot.jp/2011/10/conspiracy-theories.html

Reply via email to