Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin
, stdout
, stderr
). Since 99% of the time I work with Linux, I just prepend /dev/
to get /dev/stdin
, etc., and this "seems to do the right thing". But, for one thing, I've always been uneasy about such a rationale (because, of course, "it seems to work" until it doesn't). Furthermore, I have no good sense for how portable this maneuver is.
So I have a few questions:
In the context of Linux, is it safe (yes/no) to equate
stdin
,stdout
, andstderr
with/dev/stdin
,/dev/stdout
, and/dev/stderr
?More generally, is this equivalence "adequately portable"?
I could not find any POSIX references.