All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Furness <paul.furness@vil.ite.mee.com>
To: linux-newbie@vger.kernel.org
Subject: bash scripts creating log files
Date: 17 Sep 2002 12:15:53 +0100	[thread overview]
Message-ID: <1032261353.7489.17.camel@Zebra> (raw)

Hi, everyone.

I'm trying to write a bash script which is basically a wrapper around a
number of other commands.

What I _want_ to do is basically _copy_ stdout and stderr to a log file.

Thus, when I run a command, I wans the stdout and stderr to go to
wherever called the script (eg an interactive terminal) but I _also_
want it to go to a log file.

I can do it easily for things I'm echoing in my own script by writing a
function like this:


	function ECHO
	{
	    echo $1
	    echo $1 >> ${Logfile}
	}

and then any messages which I generate I use ECHO instead of echo:

	ECHO "This is a message"

What I can't figure out is how do I redirect the output of the things
I'm running to the same 2 places?

Anyone know a nice easy way to do this?

Tnx.

Paul.




-- 
Paul Furness

Systems Manager

2+2=5 for extremely large values of 2.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

             reply	other threads:[~2002-09-17 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 11:15 Paul Furness [this message]
2002-09-17 12:45 ` Exporting display Abhijit Vijay
2002-09-21 19:08   ` Kenneth Stephen
2002-09-17 13:04 ` bash scripts creating log files Jos Lemmerling
2002-09-17 13:13 ` Carl
2002-09-17 16:01 ` Paul Furness

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1032261353.7489.17.camel@Zebra \
    --to=paul.furness@vil.ite.mee.com \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.