tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Possible "new" redirect style for /bin/sh (needs a name)
> Variable expansion happens (relatively) early. All the redirect code
> sees is the number that came from the expansion.
This may be a silly idea, because I don't know enough about sh's
internals, but, would it be possible for these variables to have a
different type of value? Do values even have types, or are they all
just strings?
> for (fd = 0; fd < something_big; fd++) {
> if (fcntl(fd, F_GETFD, 0) < 0)
...
> }
I think fcntl(F_MAXFD) is, or at least could be, someone's friend here.
> Of course, the shell could keep track of all the fd's it has open,
> and when they get closed, etc - but that would be a whole bunch of
> extra code, and sh is complex enough without adding yet more global
> state it has to try and maintain.
Also, the shell may not know about all the fds it has open, if it was
execed with more than 0/1/2 open and doesn't explicitly probe its open
file table.
> What I need to know is whether people think adding this to /bin/sh
> (most probably including SMALL shells, as this is the kind of thing
> useful to use in places like installation scripts) is worth the cost.
Personally, I would say "no", but just because I don't think something
is worth doing doesn't mean it isn't. This is not something I've ever
wished for; indeed, I can't recall ever having even seen such code.
(What I would prefer to see is more flexible piping.)
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index