5.8.3 Special File name Caveats

Here are some things to bear in mind when using the special file names that gawk provides:

  • Recognition of the file names for the three standard preopened files is disabled only in POSIX mode.
  • Recognition of the other special file names is disabled if gawk is in compatibility mode (either --traditional or --posix; see section Command-Line Options).
  • gawk always interprets these special file names. For example, using ‘/dev/fd/4’ for output actually writes on file descriptor 4, and not on a new file descriptor that is dup()ed from file descriptor 4. Most of the time this does not matter; however, it is important to not close any of the files related to file descriptors 0, 1, and 2. Doing so results in unpredictable behavior.