03-31-05 08:01 AM
-----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...arch=0xF7DF979F
Comment: Fingerprint = D1DC 0AA4 1C4E EAD4 24EB 7E77 B261 50BA F7DF 979F
iD8DBQFCS5pVsmFQuvffl58RAjfaAJ922BorlkYM
SrpnKL/H2+CF5MmBmACfRcqd
BHlUYw44Dg52OkX8STbXdmE=
=8TCF
-----END PGP SIGNATURE-----
--
( When in doubt, use brute force. -- Ken Thompson 1998 )
[ Post a follow-up to this message ]
|