Re: Redirecting Stderr to Screen AND A File At The Same Time
From: c0ldbyte (c0ldbyte_at_comp.unix.admin)
Date: 03/31/05
- Next message: Michael Tosch: "Re: how to find the first occurence of an specific text starting from the end of a file"
- Previous message: absinth: "Redirecting Stderr to Screen AND A File At The Same Time"
- In reply to: absinth: "Redirecting Stderr to Screen AND A File At The Same Time"
- Next in thread: Bill Seivert: "Re: Redirecting Stderr to Screen AND A File At The Same Time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 31 Mar 2005 06:36:06 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2005-03-31, absinth <absinth@gmail.com> wrote:
> How do I redirect the output of my script's standard error both to the
> terminal and to a file?
>
> For example I've tried:
> ./eimScTest.ksh 2>blah.out 2>&1
>
>
> To no avail
>
First of all you need to get the tty that the message should be printed
to. For example ( echo "Hello World!" >`tty` ). notice command tty in
back quotes ``, well those are telling the whole command to process
the tty command first. Now that we have the console part taken care of
on to bigger and better things like putting it in a file at the same
time. For this to happen Im sure there are multiple ways of doing it
but number one is break it into two commands and set a variable to hold
the output of the script first and then echo $VARIABLE into the terminal
and the file.
Best of luck,
--c0ldbyte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)
Comment: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF7DF979F
Comment: Fingerprint = D1DC 0AA4 1C4E EAD4 24EB 7E77 B261 50BA F7DF 979F
iD8DBQFCS5pVsmFQuvffl58RAjfaAJ922BorlkYMSrpnKL/H2+CF5MmBmACfRcqd
BHlUYw44Dg52OkX8STbXdmE=
=8TCF
-----END PGP SIGNATURE-----
-- ( When in doubt, use brute force. -- Ken Thompson 1998 )
- Next message: Michael Tosch: "Re: how to find the first occurence of an specific text starting from the end of a file"
- Previous message: absinth: "Redirecting Stderr to Screen AND A File At The Same Time"
- In reply to: absinth: "Redirecting Stderr to Screen AND A File At The Same Time"
- Next in thread: Bill Seivert: "Re: Redirecting Stderr to Screen AND A File At The Same Time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|