Created
February 6, 2012 16:47
-
-
Save thrawn01/1753234 to your computer and use it in GitHub Desktop.
rebinds output of the currently running shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
echo "before exec" | |
TIMESTAMP_FORMAT=${TIMESTAMP_FORMAT:-"%F-%H%M%S"} | |
LOGFILE=test.$(date "+$TIMESTAMP_FORMAT") | |
# Redirect stdout/stderr to tee to write the log file | |
exec 1> >( tee "${LOGFILE}" ) 2>&1 | |
echo "after exec" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment