shell file descriptor programming (was: Unlinked temp files)

John Chambers jc at minya.UUCP
Sat May 13 02:25:51 AEST 1989


In article <4542 at psuvax1.cs.psu.edu>, schwartz at shire.cs.psu.edu (Scott Schwartz) writes:
> In article <8087 at june.cs.washington.edu>, ka at june (Kenneth Almquist) writes:
> >It's supposed to be a feature.  The idea is that if you save file
> >descriptors by moving them, you don't necessarily want to pass them
> >to the programs you run.
> ...
> >because the feature only applies to file descriptors greater than two.
> 
> Yuck!  What an unpleasant 'feature'.  It's even got magic special cases
> to know about.  Who do I write to to vote against this?

It's definitely a mis-feature, and now I know a good argument against ksh,
at least for some applications.  I've worked on several projects for which
I produced an augmented I/O library that made conventional use of files
3 and higher.  With /bin/sh, it's easy enough to include in /etc/profile
(or wherever) a set of lines that initialize these files to a default (an
audit trail, for example), and then just assume that the files are always 
available.  If ksh shoots them down, it'd definitely interfere with such 
an approach.

One of the things that is generally done well on Unix is to set things up
so that they are generic and easily extendible.  This sounds like someone
has decided to take the opposite approach.  Instead of saying that files
0,1,2 are open by default, and anyone can extend the list, the approach
seems to be that exactly files 0,1,2 are open by default, and you aren't
allowed to modify the list.  This is the opposite of extendibility.  Who
needs such silly restrictions?  

-- 
John Chambers <{adelie,ima,mit-eddie}!minya!{jc,root}> (617/484-6393)

[Any errors in the above are due to failures in the logic of the keyboard,
not in the fingers that did the typing.]



More information about the Comp.unix.wizards mailing list