Skip to content

Instantly share code, notes, and snippets.

@n8foo
Created February 23, 2012 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8foo/1891362 to your computer and use it in GitHub Desktop.
Save n8foo/1891362 to your computer and use it in GitHub Desktop.
bash example to redirect stdout to logfile
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