#!/bin/bash
echo hello
if test -t 1; then
# Stdout is a terminal.
exec >log
else
# Stdout is not a terminal.
npipe=/tmp/$$.tmp
trap "rm -f $npipe" EXIT
mknod $npipe p
tee <$npipe log &
exec 1>&-
exec 1>$npipe
fi
echo goodbye
# Released under GNU General Public License 3 by celeste:crystalfaery 2011-02-07 00:33:18+00:00
# http://www.crystalfaeries.net/linux/bin/script_logging