Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!indri!lll-winken!uunet!algor2!jeffrey
From: jeffrey@algor2.UUCP (Jeffrey Kegler)
Newsgroups: comp.unix.questions
Subject: Re: Unix deficiencies/problems
Summary: file descritors above 2 not too useful in shell scripts
Message-ID: <428@algor2.UUCP>
Date: 8 May 89 00:27:00 GMT
References: <810038@hpsemc.HP.COM= <810046@hpsemc.HP.COM> <159@dg.dg.com> <424@algor2.UUCP> <2656@mentor.cc.purdue.edu>
Reply-To: jeffrey@algor2.UUCP (Jeffrey Kegler)
Organization: Algorists, Inc., Reston VA
Lines: 25
In article <2656@mentor.cc.purdue.edu= mjs@mentor.cc.purdue.edu (Mike Spitzer) writes:
=In article <424@algor2.UUCP> jeffrey@algor2.UUCP (Jeffrey Kegler) writes:
==I miss very little from the IBM world, but the availability of formal file
==names is one of them.
=
=The Bourne shell and other reasonably sh-compatatible shells (like
=ksh) allow the redirection of any file descriptor, not just stdin,
=stdout, and stderr. You can have the shell open these file
=descriptors for your program and have "formal files" as you describe
=above. To use your example, you could:
=
= application logfile 2>errs 3rep1 6>rep2
=
You probably have not seen the above technique used very often, and for
good reason. It requires you to know the order in which the files were
opened, which is rather a subtle property to make a shell script depend on.
That is why only descriptors 0, 1 and 2 are usually used. The environment
opens them for the application, in well known order, and few applications
override the environments choices.
--
Jeffrey Kegler, President, Algorists,
jeffrey@algor2.UU.NET or uunet!algor2!jeffrey
1762 Wainwright DR, Reston VA 22090