Re: daemons, sockets and ssh



www.isp2dial.com wrote:

Use

</dev/null >/dev/null 2>&1


That makes sense.


or

<>/dev/null >&0 2>&1


But does it ever make sense to have 0 open for writing, or 1 and 2
open for reading?

It's very common. For example, a terminal session is usually set up by
opening the terminal on fd 0 read/write and then duping it onto 1 and 2.

The "more" utility actually takes advantage of this. If you execute

ls -l | more

on a terminal then "more" can't read its interactive commands (space
for the next page, etc.) from fd 0, so it first tries to read them
from fd 2. It will only resort to opening /dev/tty if fd 2 is
unreadable.

--
Geoff Clare <netnews@xxxxxxxxxxxxx>
.



Relevant Pages

  • Re: Handling locked files with C#
    ... Did you try opening the file with, ... ME> have access to the data acquisition source codes. ... ME> acquisition program locks the files during acquiring and writing the ... ME> can open (for reading) locked files. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Simultaneously Write to and Read from the same file
    ... opened the file for writing elsewhere, ... should specify FileShare.ReadWrite when opening the file for reading. ...
    (microsoft.public.dotnet.general)
  • Re: Algorithm for determining % complete of a program
    ... for determining the progression status of an application ... Validating objects with common values (# of objects with common ... "Stage 2 of 5: Reading" ... "Stage 4 of 5: Writing" ...
    (comp.programming)
  • Re: Cant create a new file
    ... It had to do with opening for writing only. ... I just thought that if you open for reading AND writing ... "gets" or similar request. ...
    (comp.lang.ruby)
  • Re: Opening a directory for writing
    ... Opening a directory for writing ... I am reading all the files in a directory through readdir....Now after ... perldoc -f print ...
    (perl.beginners)