[Tutor] example of spawn

Tim Golden mail at timgolden.me.uk
Wed Jun 6 09:47:41 CEST 2007


Martin Walsh wrote:
> '/dev/null' is a special file in a *nix environment that discards any
> data written to it: http://en.wikipedia.org/wiki//dev/null
> I can't think of a windows parallel to /dev/null.

Merely for completeness, the windows (sort of)
equivalent is the little-known NUL special
filename. So:

   dir > nul

has the effect of showing no output. Likewise:

   copy abc.txt nul

will do nothing. (Useful, no?)

Confusion typically arises, because the command
line will swallow any part a filename after the
NUL, so NUL, NUL: and NUL.TXT are all equivalent.

Try this:

   dir > nul.txt

No output, and no file called "nul.txt". And
again:

   copy abc.txt nul.txt

will likewise do nothing. On the other hand:

   dir > null

will generate a filename "null" with the output
of the dir command.

Bit of a sidetrack, I admit, but just in case
anyone was wondering :)

TJG


More information about the Tutor mailing list