dup(F)
dup --
duplicate an open file descriptor
Description
Opening a dup character special file is equivalent to a
dup(S)
of the file descriptor with the same number as the minor device.
The character special files /dev/stdin, /dev/stdout, and
/dev/stderr correspond to the standard input, output,
and error respectively.
Examples
The following commands have the same effect:
cat /dev/stdin skywards < apult
cat - skywards < apult
cat apult skywards
Another example is writing to the standard error from an
awk
script; the following awk actions are equivalent:
{ ... print "$1 is an illegal value" | "cat >&2"; ... }
{ ... print "$1 is an illegal value" > "/dev/stderr"; ... }
The following commands use a temporary file to compare the
contents listings of two
tar(C)
archives:
tar tvf archive1 > /tmp/$$
tar tvf archive2 | diff - /tmp/$$
rm -f /tmp/$$
ksh
process redirection can be used instead:
diff <(tar tvf archive1) <(tar tvf archive2)
Limitations
Not all /dev/fd/ files may be present on your system.
Files
/dev/stdin-
corresponds to the standard input
/dev/stdout-
corresponds to the standard output
/dev/stderr-
corresponds to the standard error
/dev/fd/0 - /dev/fd/99-
correspond to the file descriptors 0 to 99
See also
awk(C),
dup(S),
ksh(C),
sh(C),
tar(C)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003