web analytics
Skip to primary content
Skip to secondary content

MemoSoup

Mix of the things I always forget

MemoSoup

Main menu

  • Home
  • About
  • Links

Tag Archives: redirect

Redirect script output to the log

Posted on 13/09/2009 by bigspoon
Reply

If the whole output of the complex script should be redirected to the log, the following trick could be used.


if [ "$1" != "-log" ] ; then
$0 -log "$@" 2>&1 | tee the_log_file.$$.log
echo "The log file for the current session: the_log_file.$$.log"
exit 0
fi
shift # remove "-log" parameter

Posted in Unix | Tagged log, output, redirect, unix | Leave a reply

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Proudly powered by WordPress