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)
  • Positioning a file pointer to the begining of file for writing
    ... Reading fopenmanpages, the only way to do that is opening with ... After opening ... and reading it's content, I'd like to write over the existing content. ... Is there some way to set writing position to the start of file while ...
    (comp.os.linux.development.apps)
  • Re: Search script to index dynamic pages
    ... Ahhhh.. ... that's opening 'testtext.txt' for reading. ... Not writing. ...
    (comp.lang.perl.misc)
  • 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)