From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,924afd4c13d07312 X-Google-Attributes: gidfee84,public X-Google-Thread: 10fdc2,924afd4c13d07312 X-Google-Attributes: gid10fdc2,public X-Google-Thread: 1012a6,924afd4c13d07312 X-Google-Attributes: gid1012a6,public From: David Boyce Subject: Re: Sh shell script problem on OSF4.0 (but not on SGI) (getopts and shift) Date: 1997/06/09 Message-ID: <339C3615.A684DC57@world.std.com>#1/1 X-Deja-AN: 247418493 Sender: news@world.std.com (Mr Usenet Himself) References: <33831D34.41C6@toonboom.com> <338BF0E4.41C6@dcs.rhbnc.ac.uk> <5mhs00$btb@alexander.INS.CWRU.Edu> X-Priority: 3 (Normal) Organization: The World @ Software Tool & Die Newsgroups: comp.unix.osf.osf1,comp.unix.shell,comp.sys.sgi.bugs Chet Ramey wrote: > > In article <338BF0E4.41C6@dcs.rhbnc.ac.uk>, > Bob Vickers wrote: > > >As far as I can make out, /bin/getopts is a total waste of space, > >written by someone who doesn't know the first law of Unix programming: > >"A Unix process cannot alter the environment of its parent". > > Don't be so harsh. I assume that DEC is attempting to conform to the > letter of POSIX.2, which requires that certain `regular' builtins > (of which `getopts' is one) ``be implemented in a manner so that > they can be accessed via the POSIX.1 exec family of functions.'' > > POSIX.2 doesn't say they have to be useful, but they must be available. > For your amusement, `read', `cd', `alias' and the job control builtins > (fg/bg/jobs) must also be present in the file system as executables. > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > > Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu Yes, I was involved in the POSIX compliance effort at OSF and this is exactly the case. POSIX requires that these commands be exec-able so we put a little ksh script in /usr/bin which would run the ksh builtin of the same name, and then placed links to it by names such as /usr/bin/cd, /usr/bin/getopts, etc. Trust me, we were perfectly well aware of the ridiculous nature of what we were doing. I can't speak for implementations other than OSF/1 but presumably other vendors, at least those who were as obsessive about standards as we were, did similar things. David