Re: Mysterious file descriptor behavior

From: Alex Fraser (me_at_privacy.net)
Date: 10/28/05


Date: Fri, 28 Oct 2005 20:50:52 +0100


<joe@invalid.address> wrote in message
news:m38xwd5xwv.fsf@invalid.address...
> "Alex Fraser" <me@privacy.net> writes:
> > <joe@invalid.address> wrote in message
> > news:m3hdb163sj.fsf@invalid.address...
> > > 50295@web.de writes:
> > [snip]
> > > > -bash-3.00$ ls -l /proc/$$/fd
> > > > total 4
> > > > lrwx------ 1 myname mygroup 64 Oct 28 16:34 0 -> /dev/pts/0
> > > > lrwx------ 1 myname mygroup 64 Oct 28 16:34 1 -> /dev/pts/0
> > > > lrwx------ 1 myname mygroup 64 Oct 28 16:34 2 -> /dev/pts/0
> > > > lrwx------ 1 myname mygroup 64 Oct 28 16:39 255 -> /dev/pts/0
> > [snip]
> > > Descriptor 255 isn't standard, it depends on the system as to what
> > > it means and whether it's there (it's not there on solaris for
> > > example).
> >
> > Note that the command is listing the descriptors open in the shell.
>
> Sorry, you lost me there. Are you saying it is standard somehow?

No, I'm saying it need not conform to any standard because it is the shell's
business what fds it has open.

(I haven't looked at the source, but would guess the above is done so the
shell can write to the tty/whatever after fds 0-2 have possibly been
replaced with pipe ends/files/whatever.)

Alex



Relevant Pages

  • Re: Opinion of McNamara ?
    ... make plain what I am responding to--not to mention the guideline about not ... quoting pages of material to justify a paragraph of response. ... If they actually found the shell in circumstances that would prove that ... Saying "Guns kill people" is like saying "Spoons made Rosie O'Donnell ...
    (rec.aviation.military)
  • Re: What shell do people use?
    ... >>> This isn't just about changing root's shell, ... newbies tend to need help from others and thus ... Which is what I'm saying above. ... interactive commands, and if you need ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Odd tcsh behaviour: subshells & stdout
    ... Every shell (except early versions of the Bourne shell) dups ... fds for saving purpose. ... In csh, you can only redirect fds 0,1,2. ...
    (comp.unix.shell)
  • Re: Orlando Auction any prices?
    ... all I am saying is that this will effect Stern big time ... ... You think people are going to shell out $4100 and then take that kind ... the machines were beat to hell for the most ...
    (rec.games.pinball)
  • Re: command line newsreader?
    ... Christopher Browne spake unto us, saying: ... but they can certainly be "used in a shell" and they also don't ...
    (comp.os.linux.misc)