more unix jokes - /dev/null

Tony Luck aegl at root.co.uk
Thu Sep 22 18:28:03 AEST 1988


In article <1414 at star.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>If one wants to run a command with output getting discarded, the obvious
>solution is:
>
>	command > /dev/null
>
>But what would you do if you happened to have no such device? :-)
>Is the intended still possible?
>
>Yes! (Better use the Bourne shell.)
>
>
>	command 1< /etc/passwd 2<&1
>
>:-)

This won't work with a well written 'command' as file descriptors 1 and 2
will be open for *reading* not for *writing*. And we all know how careful
programs are to check that their writes succeed ...

	main()
	{
		printf("Hello, world\n");
	}

Oh well perhaps there might be one or two utilities that don't check :-(

-Tony Luck (UniSoft Ltd.) <aegl at root.co.uk>



More information about the Comp.unix.questions mailing list