Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Nov 2006 08:50:34 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Robin Becker <robin@reportlab.com>
Cc:        FreeBSD-Questions <freebsd-questions@freebsd.org>
Subject:   Re: shell test for stdout=stderr
Message-ID:  <4569555A.8010904@infracaninophile.co.uk>
In-Reply-To: <4568CF28.5050407@jessikat.plus.net>
References:  <4568CF28.5050407@jessikat.plus.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigAE46D57E09E3A3D855E15FBA
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Robin Becker wrote:
> Is there a way for a shell script to test if 2> is the same as 1>? I
> want to put messages in both when they are connected to different files=
,
> but would like to avoid duplicating the message when they are the same.=


You could try using fstat(1) to print out the open file descriptors from
your process:

    fstat -p $$

and then compare the values in the DEV and INUM columns -- unfortunately
fstat has no way to map back from those device and inode values to
filenames.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW


--------------enigAE46D57E09E3A3D855E15FBA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFaVVg8Mjk52CukIwRCGnjAJ9sJW5msMNxOSHaaDT4TDNu1GsGxwCfSu0L
M65zQRMDNR/XoGxeiYlUGCU=
=U3id
-----END PGP SIGNATURE-----

--------------enigAE46D57E09E3A3D855E15FBA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4569555A.8010904>