An answer I gave to a question, and the comments to it, had me read the POSIX Conformance section of the Base Definitions to figure out whether /dev/stdin, /dev/stdout and /dev/stderr were actually needed for conformance to the POSIX standard.
It turns out they are not:
The system may provide non-standard extensions. These are features not required by POSIX.1-2008 and may include, but are not limited to: […] Additional character special files with special properties (for example,
/dev/stdin,/dev/stdout, and/dev/stderr)
As far as I can find, this is the only mentioning of these files in the standard.
I have access to only one “system” (environment, really) which does not implement them, and that’s MinGW on Windows (no /dev at all as far as I can see). As far as I know, all the free Unices have them, and so does Cygwin, Windows’ new Linux environment and Darwin/macOS.
I’m not well versed with the commercial Unices though.
Is there a POSIX system, Unix, or a Unix-like environment of some description, alive today, that does not implement /dev/stdin, /dev/stdout, and /dev/stderr as files in the filesystem?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Is there a POSIX system, Unix, or a Unix-like environment of some description, alive today, that does not implement /dev/stdin, /dev/stdout, and /dev/stderr as files in the filesystem?
Yes, at least per my example system below.
I’m not an expert in this system by any means; however, AIX 6.1, which wikipedia claims is:
one of five commercial operating systems that have versions certified to The Open Group’s UNIX 03 standard
(https://en.wikipedia.org/wiki/IBM_AIX)
does not appear to implement those file descriptors in the installation I have access to. As you can see, if using bash, it will behave as if they did exist for the purposes of redirection:
$ uname -s AIX $ echo $SHELL /usr/bin/ksh $ ls -al /dev/stdin ls: 0653-341 The file /dev/stdin does not exist. $ ls -al /dev/stdout ls: 0653-341 The file /dev/stdout does not exist. $ ls -al /dev/stderr ls: 0653-341 The file /dev/stderr does not exist. $ echo foo >/dev/stderr The file access permissions do not allow the specified action. ksh: /dev/stderr: 0403-005 Cannot create the specified file. $ bash bash-4.2$ ls /dev/stderr ls: 0653-341 The file /dev/stderr does not exist. bash-4.2$ echo foo >/dev/stderr foo
As other commenters have mentioned, the following questions provide some interesting information as well:
Method 2
I’m posting well after the initial posts but thought I’d add this comment for future viewers.
I get the same results writing to /dev/stdout as above on an AIX 6.1 system, but on an AIX 7.1 system it works as expected, so it looks support for /dev/stdout was added.
AIX 6.1 (ksh93)
echo "Hello" > /dev/stdout ksh93: /dev/stdout: cannot create. [The file access permissions do not allow the specified action.].
AIX 7.1 (ksh93)
echo "Hello" > /dev/stdout Hello
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0