Created
February 23, 2012 07:43
-
-
Save n8foo/1891362 to your computer and use it in GitHub Desktop.
bash example to redirect stdout to logfile
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
DATE=`date +%F` | |
case "$1" in | |
"-v") | |
echo "verbose enabled" | |
;; | |
"-h") | |
echo "(description)" | |
echo $"Usage: $0 (-v|-h)" | |
exit 1 | |
;; | |
*) | |
LOGFILE=$LOGDIR/$DATE.log | |
exec >> $LOGFILE 2>&1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment