shell test for stdout=stderr
Matthew Seaman
m.seaman at infracaninophile.co.uk
Sun Nov 26 00:51:07 PST 2006
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
--
Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
Kent, CT11 9PW
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20061126/b2b3635e/signature.pgp
More information about the freebsd-questions
mailing list