more unix jokes - /dev/null
Leo de Wit
leo at philmds.UUCP
Tue Sep 20 05:56:41 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
>
>:-)
Maybe I'm missing something here, but this redirection also screws up
your input (is that the joke perhaps 8-). Try cat for command. After
the first line has been typed (from your terminal), the command
finishes.
But if you run the Bourne shell, you can also do something like:
command >&-
or
command 2>&-
which closes the standard output, resp. the standard error for 'command'.
Or you can even do
exec >&- 2>&-
and don't have to worry about output anymore ;-) !
This one's nice too:
exec <&-
And now I give back the pipe to Maarten (a Dutch phrase that sounds like
redirection 8-).
Leo.
More information about the Comp.unix.questions
mailing list