more unix jokes - /dev/null

Jim O'Connor jim at fsc2086.UUCP
Sun Sep 25 14:32:33 AEST 1988


In article <192 at bales.UUCP>, nat at bales.UUCP (Nathaniel Stitt) writes:
> Re: How to simulate "command > /dev/null" without a /dev/null.
> 
> How about:
> 
> 	command | grep i_hope_this_does_not_appear_in_the_output
> 

If you've got lex, you don't have to hope.  Just build a program using the
lex instructions:

%%
\n	|
.*	;
%%

which if I recall from my manual, should not print anything.  (i.e. all
input is matched and discarded).

Now that I think about it.  This is probably more effiecient

#include <stdio.h>
main()
{

while (getchar() != EOF)
   ;

}
---
James B. O'Connor		+1 615 821 4090 x651
Filtration Sciences Corp.      UUCP:  uunet!fsc2086!jim
105 West 45th Street           or      jim at fsc2086.UUCP
Chattanooga, TN 37411



More information about the Comp.unix.questions mailing list